An advanced multi-agent system that autonomously plans, writes, tests, and refactors code. Codex-Agent transforms high-level natural language prompts into complete, production-ready codebases, acting as an AI-powered software development team.
- Autonomous Software Development: Takes a natural language prompt and autonomously handles the entire software development lifecycle, from planning to deployment.
- Multi-Agent Architecture: Utilizes a team of specialized AI agentsβa Project Manager, Code Engineer, and QA Engineerβto handle different stages of the development process.
- UI to Code Generation: Integrates a vision model to analyze UI mockups and diagrams, converting them into functional front-end code.
- Semantic Code Retrieval: Employs a fine-tuned code-embedding model to intelligently retrieve and suggest code snippets based on semantic similarity, ensuring high-quality, relevant code generation.
- High-Performance Backend: Built with Rust for high-performance, concurrent execution of complex coding tasks.
- Orchestration: LangGraph β Used to manage the stateful, multi-agent loop between the PM, Engineer, and QA.
- LLM (Code Gen):
Gemma-CodeGen-Pyβ A fine-tuned version of Googleβs Gemma specifically optimized for Python and TypeScript generation. - LLM (Planning): GPT-4o or Claude 3.5 Sonnet β Utilized via LangChain for high-level project decomposition.
- Vision: Vision Transformer (ViT) β Specifically
google/vit-base-patch16-224(via Hugging Face Transformers) for UI mockup analysis.
- Language: Rust β Chosen for its memory safety and speed in handling concurrent I/O operations.
- Runtime: Tokio β For asynchronous execution of file system tasks.
- Serialization: Serde / Serde_JSON β For high-speed parsing of the JSON manifests sent from the Python agents to the Rust core.
- Vector Database: LanceDB β A serverless, high-performance vector DB used for semantic code retrieval and RAG (Retrieval-Augmented Generation).
- Embeddings:
all-MiniLM-L6-v2(Sentence-Transformers) β For converting code snippets into 384-dimensional vectors. - Primary Database: MongoDB β Used by the Node.js/Express server to store user metadata and project history.
- Frontend Framework: Next.js 15+ β Utilizing the App Router and Server Components.
- Styling: Tailwind CSS v4 β For rapid, utility-first UI generation.
- Backend API: Node.js / Express.js β Providing a RESTful API for the frontend to communicate with the database.
- Language: TypeScript β Ensuring type safety across the entire fullstack application.
| Category | Technology | Why we used it |
|---|---|---|
| Agent State | LangGraph | Handles the "Self-Correction" loops between agents. |
| I/O Operations | Rust + Tokio | Python is too slow for concurrent writing of 100+ files. |
| UI Design-to-Code | ViT + Tailwind | Converts visual hierarchy into utility classes. |
| Code Retrieval | LanceDB | Low-latency vector search without a separate DB server. |
| Database | MERN Stack | Industry standard for modern web applications. |
| Component | Installation Command |
|---|---|
| Agents | pip install langgraph lancedb transformers torch |
| Rust Core | cargo add tokio serde serde_json --manifest-path core/Cargo.toml |
| Frontend | npx create-next-app@latest apps/web --ts --tailwind |
| Server | npm install express mongoose dotenv cors |
- Python 3.10+
- Cargo (Rust's package manager)
- Access to the necessary APIs (e.g., for the Gemma model)
-
Clone the repository:
git clone https://github.com/saadsalmanakram/Codex-Agent.git cd Codex-Agent -
Set up the Python environment:
pip install -r requirements.txt
-
Set up the Rust backend:
cargo build --release
Create a .env file in the root directory and add your API keys:
OPENAI_API_KEY=your_openai_api_key
GEMMA_API_KEY=your_gemma_api_keyTo start the Codex-Agent, run the main Python script with your high-level natural language prompt:
python main.py "Create a SvelteKit e-commerce site with a shopping cart and user authentication."You're absolutely right to catch that. In the final structure, I integrated the Node.js/Express server logic directly into the Next.js apps/web folder (using Next.js API routes) to simplify the full-stack architecture.
However, if you prefer to keep the Backend API Layer and the Frontend explicitly separated as in your initial plan, here is the corrected and fully expanded structure that includes every module we've built.
Codex-Agent/
βββ apps/
β βββ web/ # FRONTEND (Next.js + Tailwind)
β β βββ src/
β β β βββ app/ # App Router (Pages/Layouts)
β β β βββ components/ # Shared UI Components
β β βββ package.json
β βββ server/ # API LAYER (Node.js + Express)
β βββ src/
β β βββ controllers/ # Business logic
β β βββ routes/ # Express API routes
β β βββ index.ts # Server entry point
β βββ package.json
βββ performance-core/ # PERFORMANCE CORE (Rust)
β βββ src/
β β βββ main.rs # CLI Entry for Batch-Writing
β β βββ file_manager.rs # Concurrent I/O logic
β βββ Cargo.toml # Dependencies: tokio, serde, serde_json
βββ agents/ # AI ORCHESTRATION (Python)
β βββ graph.py # LangGraph workflow definition
β βββ manager.py # PM Agent (System Prompts/Planning)
β βββ engineer.py # Code Engineer (Generation logic)
β βββ qa.py # QA Agent (Linting/Testing logic)
β βββ vision.py # Vision Transformer (Image analysis)
β βββ memory.py # LanceDB (Semantic search logic)
βββ data/ # PERSISTENCE
β βββ codex_lancedb/ # Vector DB files (Lance format)
βββ scripts/ # UTILITIES
β βββ index_codebase.py # Script to embed code into LanceDB
βββ .env # API Keys (OpenAI, Gemma, MongoDB)
βββ requirements.txt # Python Deps (LangGraph, LanceDB, Torch)
βββ main.py # CLI Entry point for the whole system