Skip to main content
SecurAtlas generates AI-powered narratives, playbooks, and suggestions using a queue-based pipeline that falls back across multiple LLM providers. The system is fully event-driven: data changes enqueue jobs, a worker drains the queue, and the app reads cached results.

Why It Matters

  • Gap narratives explain a tenant’s risk posture in plain English, updated automatically as controls and evidence change.
  • Remediation playbooks give actionable steps per control, tailored to cloud provider.
  • Evidence & policy suggestions reduce manual work during audits.
  • All content is cached with content-hash deduplication — regeneration only happens when underlying data actually changes.

Architecture at a Glance

Multi-Provider Fallback

The worker tries providers in priority order. If a provider fails 3 consecutive times, its circuit opens for 5 minutes. This survived a real Anthropic outage (April 15, 2026 — 1h 32m down) without user-visible impact.
PriorityProviderPrimary Model
1Anthropicclaude-sonnet-4-20250514
2OpenAIgpt-4.1
3Googlegemini-2.5-pro
4Groqllama-3.3-70b-versatile
See Multi-Provider Fallback & Resilience for circuit breaker details.

Key Design Decisions

DecisionRationale
Queue-based, not inlineAI calls take 2-15s; blocking the request path would destroy UX
Content-hash deduplicationDon’t regenerate if underlying data hasn’t changed — saves cost and avoids churn
Multi-provider with circuit breakerSingle-provider dependency is a production risk (proven by Anthropic outage)
Per-tenant budgetsPrevents runaway costs; tier-based defaults match subscription level
Edge Function workerRuns in Supabase’s Deno runtime, triggered every 60s by pg_cron

What It Replaces

Previously, gap narratives were generated inline during page load via a direct Anthropic API call. This had no fallback, no caching, no budget controls, and blocked rendering for 3-8 seconds. The new system is async, resilient, and cost-controlled.

Content Types

TypeScopeCache Key
gap_narrativePer tenantRisk snapshot + control statuses + evidence timestamps
remediation_playbookPer control + cloud provider (shared)Control key + title + description + implementation notes
evidence_suggestionPer evidence itemTitle + description + evidence type + updated_at
policy_suggestionPer policy versionPolicy ID + version ID

Next Steps

Architecture

Database schema, worker details, cron schedules

Integration Guide

How to wire AI content into Next.js components

API Reference

All RPCs and their parameters

Operations

Runbook for monitoring, debugging, and recovery