Multi-Agent CodeGen
A production-scale code-generation platform where five specialized CrewAI agents turn a natural-language request into tested, documented code — grounded by RAG over 2M+ embeddings and validated in an isolated Docker sandbox with iterative refinement.

- 5
- Specialized agents
- 6
- Data sources
- 2M+
- Vector embeddings
- 78.2%
- Pass@1 accuracy
- 89.7%
- Success rate
- $0.16
- Cost per request
The problem
Plausible is not workingNo proof it runs
A single model returns code that looks right and often is not — no tests, no execution
Ungrounded recall
One prompt hallucinates APIs instead of drawing on real-world patterns
One overloaded role
Analysis, coding, testing and docs crammed into a single prompt with no audit trail
The crew
5 agents, design-firstA request flows through five specialized agents. Test Designer and Programmer run in parallel — the tests are written before the code, so generation aims at a real spec rather than being graded after the fact.
- ANALYZE01
Requirements Analyzer
GPT-4
Parses a natural-language request into a structured JSON specification the rest of the crew works from.
- SPEC02
Test Designer
GPT-4
Writes the test suite from the spec, before any code exists. Design-first: the bar is set before the Programmer runs.
parallel stage
- GENERATE03
Programmer
GPT-4 + RAG
Generates production code grounded in retrieved real-world patterns, not free-form recall.
parallel stage
- VERIFY04
Test Executor
Docker sandbox
Runs the generated code against the test suite in an isolated container; failures trigger iterative refinement.
- DOCUMENT05
Documentation Generator
GPT-4
Produces README and API docs for the accepted code, so the output ships explained.
Seven stages
Decisions, not descriptionsArrow keys to step
Ingest
Apache Airflow · ETL
- 6 sources: GitHub, Stack Overflow, docs, issues/PRs, examples, blogs
- Airflow DAGs schedule and orchestrate collection
- 200+ high-quality GitHub repositories
Decision
- Chose
- Airflow-orchestrated multi-source ETL
- Over
- A single scraper
- Manual dataset curation
Because
- Six sources need dependency-aware scheduling and retries
- Real code plus real Q&A plus real issues covers how developers actually write
Cost
Six connectors to maintain as each source's format drifts.
- 6
- sources
Architecture
Ingest to serveResults
Measured, not asserted| Metric | Result | Note |
|---|---|---|
| Pass@1 accuracy | 78.2% | across 87 test cases |
| Overall success rate | 89.7% | generations that pass |
| Average quality score | 7.8 / 10 | graded output |
| Average latency | 23.4s | end to end per request |
| Cost per request | $0.16 | ~18K tokens |
| Cache hit rate | 40% | cost optimisation |
Because every generation is grounded in retrieval and gated by sandboxed tests, the output is code you can trust to run — not just code that looks plausible.
Stack
Everything usedAgents
- CrewAI
- GPT-4
- LangChain
Retrieval
- Pinecone
- text-embedding-3-large
- RAG
Backend
- FastAPI
- Async Python
Data & orchestration
- Apache Airflow
- Google Cloud Storage
- BigQuery
Testing & safety
- Docker sandbox
- pytest
- Security scanning
- HITL review
Interface
- Streamlit