Codex is an intelligent agentic coding assistant that understands your codebase, plans multi-step actions, runs tools safely, and helps you ship software faster β powered by the LLM of your choice.
| Feature | Description |
|---|---|
| π§ Agentic Reasoning | LangGraph-powered agent loop that thinks step-by-step before acting (Plan |
| π Codebase Understanding | Full AST symbol indexing (Tree-sitter) & semantic retrieval using pgvector embeddings |
| π οΈ Autonomous Tools | File reading, deterministic patch editing (apply_patch), regex grep, and linting |
| π§ͺ Self-Testing | Automatically executes test suites and self-heals code if tests fail |
| π Multi-Model Support | Works with Google Gemini, OpenAI GPT-4, and Anthropic Claude via LiteLLM |
| π― Smart Model Routing | Automatically assigns the right model tier for planning, coding, or summarization |
| β Approval Workflows | Critical operations require human confirmation before execution |
| π Interactive Web UI | Modern browser chat interface with live workspace switching |
Unlike passive chat interfaces that only process copy-pasted text, Codex is an autonomous software engineering agent that operates directly on your local workspace:
| Capability | Standard AI Chatbots (ChatGPT / Claude Web) | Basic Copilot Plugins | π€ Codex Agent |
|---|---|---|---|
| Codebase Awareness | β Manual copy-pasting (1β2 files at a time) | β
Full Codebase Indexing (AST Tree-sitter & pgvector semantic search) |
|
| Autonomous Tool Execution | β None (Text-only output) | β Cannot execute external tools | β Multi-Tool Agent Loop (File read, patch writing, grep, linting) |
| Automated Code Editing | β User must manually copy & paste code | β
Deterministic Multi-File Patching (apply_patch directly modifies files) |
|
| Self-Verification & Testing | β Cannot verify if code works | β Cannot run tests | β
Automated Test Execution & Self-Healing (Runs pytest & auto-fixes errors) |
| Model Flexibility & Routing | β Locked to one provider | β Locked to vendor model | β Smart Multi-Model Routing (Routes tasks dynamically between Gemini, GPT-4, Claude) |
| Security & Human-in-the-Loop | β No safety controls | β No approval gating | β Configurable Approval Workflows for critical write operations |
| Privacy & Self-Hosting | β Cloud-only proprietary SaaS | β Proprietary SaaS | β 100% Self-Hosted & Open Source (Your code stays on your machine) |
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β User (Browser Web UI / CLI) β
ββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββ
β HTTP / SSE
ββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββ
β FastAPI Control Plane API β
β /v1/runs /v1/tools /health /metrics β
ββββββββββββ¬βββββββββββββββββββββββββββββ¬ββββββββββββββ
β β
ββββββββββββΌβββββββββββ ββββββββββββββΌβββββββββββββ
β LangGraph Agent β β PostgreSQL + pgvector β
β (Plan β Act β Obs) β β (Run history + index) β
ββββββββββββ¬βββββββββββ βββββββββββββββββββββββββββ
β
ββββββββββββΌβββββββββββ βββββββββββββββββββββββββββ
β LiteLLM Router β β Redis β
β Gemini / GPT-4 / β β (Session cache & β
β Claude β β in-memory fallback) β
ββββββββββββ¬βββββββββββ βββββββββββββββββββββββββββ
β
ββββββββββββΌβββββββββββ
β Tool Sandbox β
β (Docker / Local) β
βββββββββββββββββββββββ
Follow this guide to run Codex locally on your computer and connect it to any project on your machine.
- Python 3.12+ installed on your system (Download Python)
- Astral
uv(Recommended for ultra-fast setup):- Windows:
powershell -c "irm https://astral.sh/uv/install.ps1 | iex" - Mac/Linux:
curl -LsSf https://astral.sh/uv/install.sh | sh
- Windows:
- PostgreSQL Database (Local via Docker OR a free cloud database from Render / Neon / Supabase)
- An LLM API Key (e.g. Free Google Gemini API Key or OpenAI/Anthropic key)
Option A: Using Git (Recommended)
git clone https://github.com/karunya666/Codexa.git
cd CodexOption B: Download ZIP
- Click the green Code button at the top of the GitHub repository.
- Select Download ZIP.
- Extract the ZIP folder on your computer and open terminal in the
Codexfolder:cd Codex
Using uv (Recommended):
uv pip install -e ".[dev]"Or using standard pip:
pip install -e ".[dev]"Create your .env file by copying the example:
# Windows PowerShell:
Copy-Item .env.example .env
# Mac / Linux:
cp .env.example .envOpen .env in your code editor and configure:
# 1. Database Connection (Use local Postgres OR free cloud Postgres like Render/Neon/Supabase)
DATABASE_URL=postgresql+asyncpg://user:password@hostname:5432/dbname
# 2. LLM API Key (Add your API Key)
GEMINI_API_KEY=AIzaSy...
# Or for OpenAI:
# OPENAI_API_KEY=sk-...
# 3. Model Configuration (Default is Gemini)
ROUTING_CONFIG_PATH=routing.config.gemini.json
ROUTING_DEFAULT_MODEL=gemini/gemini-3.1-flash-lite
# 4. Sandbox Backend (Set to 'local' for running without Docker)
SANDBOX_BACKEND=localRun the server command:
uv run coding-assistant serve(or python -m coding_assistant serve)
You will see the startup confirmation:
π Starting Codex server at http://127.0.0.1:8000
π API documentation at http://127.0.0.1:8000/docs
INFO: Application startup complete.
-
Open your browser and go to: π
http://localhost:8000 -
In the left sidebar under
WORKSPACE, enter the full folder path of the project you want the AI to work on:- Windows Example:
C:\Users\username\Projects\MyAwesomeApp - Mac/Linux Example:
/home/username/projects/MyAwesomeApp
- Windows Example:
-
Click the
Set Workspacebutton.
Once your workspace is connected, you can ask Codex anything about your project:
"Explain this repo, its file structure, and its main entry points." "List all API routes and authentication middleware in this project."
"Scan this project for potential memory leaks, unhandled exceptions, and security vulnerabilities." "Why is the user login session expiring prematurely in auth.py?"
"Add a new payment webhook handler in routes/payments.py to process Stripe events." "Refactor the database queries in services/user_service.py to use async SQLAlchemy."
"Generate comprehensive pytest unit tests for the functions in utils/parser.py."
You can also use Codex directly from your terminal:
uv run coding-assistant chat --workspace "C:\path\to\your\project"Available slash commands in CLI:
/workspace <path>β Switch project folder on the fly/statusβ View active models, tokens, and database status/helpβ List all commands/exitβ Exit CLI
| Provider | Environment Variable | Model Example | Get Key |
|---|---|---|---|
| Google Gemini | GEMINI_API_KEY |
gemini/gemini-3.1-flash-lite, gemini/gemini-2.0-flash |
Google AI Studio |
| OpenAI | OPENAI_API_KEY |
gpt-4o, gpt-4o-mini |
OpenAI Console |
| Anthropic | ANTHROPIC_API_KEY |
claude-3-5-sonnet |
Anthropic Console |
Codex/
βββ src/coding_assistant/
β βββ api/ # FastAPI REST & SSE endpoints
β βββ intelligence/ # LangGraph agent orchestration & planning
β βββ tools/ # Autonomous tool handlers (grep, AST search, patch)
β βββ sandbox/ # Sandbox execution engine (Docker & Local)
β βββ routing/ # LiteLLM capability-aware model router
β βββ db/ # SQLAlchemy asyncpg models & session management
β βββ services/ # In-memory & Redis cache, run worker
β βββ observability/ # OpenTelemetry tracing & Prometheus metrics
βββ web/ # Clean browser chat interface (HTML/CSS/JS)
βββ docs/ # Complete phase documentation
βββ tests/ # Pytest test suite (64+ tests)
βββ Dockerfile # Production container image
βββ pyproject.toml # Project manifest & dependencies
This project is open source under the MIT License. See LICENSE for details.
Built with β€οΈ using FastAPI, LangGraph, and LiteLLM
β Star on GitHub: karunya666/Codexa