⚡ TL;DR - Quantifiable Impact
- 90% reduction in Subject Matter Expert (SME) content review time (from 2 weeks to 30 minutes).
- Zero hallucinations in published technical articles via a multi-tier RAG validator.
- Built utilizing Next.js, Supabase, n8n, and the Gemini API.
The Challenge: Content Bottlenecks and Hallucinations
At CongKong, our core challenge was producing high-fidelity technical articles and candidate matching content. Traditional content generation cycles took up to two weeks due to intensive manual research, fact-checking, and drafting.
When we attempted to automate this with simple LLM prompts, we immediately hit two major blockades:
- Hallucinations: Out-of-the-box LLMs routinely generated outdated code syntax or fake API document endpoints.
- Context Limits: Feeding raw source directories directly into prompts quickly hit context limitations and led to lost details.
We needed a system that could write high-quality technical content, verify it against actual documentation, and alert humans only for high-level reviews.
The Solution: Multi-Agent Decoupled Architecture
I designed and engineered an autonomous AI-driven Content Factory using an agentic workflow:
graph TD
A[Raw Source Material] --> B[Source Parser Node]
B --> C[RAG Vector Store - Supabase PGVector]
C --> D[Research Agent]
D --> E[Drafting Agent]
E --> F[Verification Agent - RAG Check]
F -->|Hallucination Detected| E
F -->|Verified Clean| G[Human-in-the-Loop Slack Alert]
G -->|Approved| H[Auto-Publish via CMS]
1. Ingestion and Vector Search (Supabase PGVector)
First, raw engineering specs and documents are parsed, chunked, and embedded using text-embedding-004. The embeddings are stored in Supabase PGVector using a hierarchical retrieval system.
2. Multi-Agent Orchestration (n8n & LangGraph)
Rather than a single monolithic prompt, we split the drafting process among distinct, specialized LLM agents:
- The Researcher: Queries the Supabase vector store, aggregates facts, and builds a strict markdown outline.
- The Writer: Takes the outline and drafts clean, technical prose, using pre-configured style guides.
- The Validator: A adversarial agent whose sole job is to cross-reference every claim in the draft against the source documents, verifying code snippets and assertions.
Engineering Deep Dive: Eliminating Hallucinations in Code Snippets
The hardest part was ensuring code block snippets were 100% correct. If an LLM generated code using an obsolete API version, the validator needed to catch it.
We implemented a Code Execution Sandbox using isolated Docker containers:
- The validator extracts all code blocks from the draft.
- It sends them to a secure sandbox executor.
- If the compiler or test runner fails, the exact stack trace is returned to the Writer Agent with a prompt to rewrite the specific section.
This loop repeats up to 3 times before raising a manual human flag, guaranteeing zero broken code blocks hit publication.
Key Metrics Achieved
- SME Review Time: Slashed from 2 weeks to under 30 minutes per comprehensive article.
- Production Throughput: Scaled from 3 posts per month to 30+ verified articles per month.
- Code Accuracy: 100% of generated code snippets successfully compile and pass execution linting.