Problem

Enterprise customers send long security questionnaires, such as CAIQ, SOC 2, and SIG reviews, often with 250 or more questions. Answering them by hand means checking live cloud configuration, searching policy documents, and writing up each answer with evidence. It is slow, and a generic AI answer is worse than none, because a confident answer with no real evidence behind it is a liability.

Context

A self-built project that went through two versions. The first version automated AWS infrastructure auditing and reporting. The second turned it into an evidence-based engine that answers security questionnaires from live AWS evidence and policy manuals. It supports security reviews; it is not a formal compliance certification or an independent attestation.

My Role

I designed and built both versions end-to-end.

Architecture

First version: automated AWS audit

  1. A Python and Flask service in an isolated Docker container runs read-only AWS CLI audit commands and normalizes the JSON output.
  2. n8n orchestrates extraction, evaluation, and storage.
  3. A context-injected Langflow agent, using Groq, evaluates the collected configuration against security checkpoints.
  4. Findings, evidence, and remediation roadmaps are stored in Supabase.

Second version: evidence-based questionnaire engine

  1. Evidence collection. 50+ live AWS CIS Benchmark checks, run through the AWS CLI sidecar.
  2. Document retrieval. Policy manuals parsed with PyMuPDF, embedded locally with FastEmbed (all-MiniLM-L6-v2), and stored in Supabase with pgvector.
  3. Answering. A 6-node LangGraph state machine using Corrective RAG (CRAG). Retrieved passages are scored for relevance by Llama 3.1 8B on Groq, and weak retrievals are corrected before an answer is written.
  4. Verification. A Critic Agent checks that every answer cites a real AWS ARN or a real document section before it's accepted.
  5. Queueing. An asynchronous worker in n8n and PostgreSQL feeds questions through the engine, served by FastAPI.
Evidence-based AI auditing engine, second versionQuestionnaire questions go through an n8n and PostgreSQL queue to a FastAPI service running a LangGraph Corrective RAG state machine. It retrieves live AWS evidence and policy passages from pgvector, grades relevance with Llama 3.1 8B, corrects weak retrievals, generates an answer, and a Critic Agent rejects any answer without a verified ARN or document citation.Security questionnaireCAIQ · SOC 2 · SIGQueue workern8n + PostgreSQL · row locksFastAPI serviceone question per runLangGraph state machine · Corrective RAGRetrieveAWS evidence +pgvector passagesGrade relevanceLlama 3.1 8B on GroqGenerate answerfrom graded passagesCritic Agentverify ARN ordocument sectionrelevantCorrect retrievalre-query weak passagesweakno verified citationAWS account50+ CIS checks · CLI sidecarPolicy PDFsPyMuPDF · FastEmbedCited answerARN or document sectionverified
Simplified view of the Corrective RAG loop. An answer is only accepted when the Critic Agent confirms it cites a real AWS ARN or document section. It answers questionnaires with evidence; it is not a certification or attestation.

Technology Stack

LangGraph, LangChain, CRAG, LlamaIndex, Groq (Llama 3.1 8B), Supabase pgvector, FastEmbed, PyMuPDF, FastAPI, n8n, PostgreSQL, Docker, AWS CLI. The first version also used Langflow and Flask.

Implementation

Reliability / QA

The design separates "collect" from "judge" and "judge" from "accept". The model only sees evidence that was actually collected or retrieved. The Critic Agent rejects answers whose citations don't check out. Queue locks and backoff keep long runs stable instead of failing on rate limits.

Challenges

Solution

Evidence first, then retrieval with correction, then a critic that verifies citations, all driven by a queue that respects rate limits.

Results

A recorded walkthrough of the first version is linked below. The second version doesn't have a public demo yet.

Lessons Learned

For compliance work, an AI answer is only useful if someone can check it. Requiring a verifiable citation for every answer, and rejecting the ones that fail, turned the model from a writer into a researcher whose work can be reviewed.

Related services

Related projects

Public evidence

Need something similar?

Available for remote AI automation, n8n, AI agent, API integration, and B2B SaaS QA projects.