Skip to content

AdamsGH/apex-orchestrator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

17 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

APEX Orchestrator

Autonomous Parallel EXecution β€” an AI-powered development orchestrator for large codebases. Takes a task in natural language, decomposes it into subtasks, executes them in parallel via LLM-powered workers, validates results, and commits changes.


🎯 Recent Updates (Feb 2026)

Git Changes UI βœ…

  • Real-time monitoring of git status, branches, commits
  • Interactive diff viewer with split-view
  • Stash management (create/pop/apply/drop)
  • Branch operations (checkout, delete, compare)

Database Management βœ…

  • Database size monitoring (auto-refresh every 5s)
  • Checkpoint cleanup strategies (keep_final_only, keep_last_n)
  • Thread details view with checkpoint counts
  • Reduced DB from 12GB to 0.11MB after cleanup

Graph Editor βœ…

  • Review mode with manual approve/reject
  • Subtask editing (add/delete/reorder)
  • Wave reorganization with drag & drop
  • AI suggestions (fix_deps, optimize_waves, split, merge)
  • Undo/redo with 50-entry history

πŸ“š Documentation


Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                     Docker Compose                       β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  sharp_eye UI (:7353)                                    β”‚
β”‚  React 19 + Ant Design + React Flow + SSE                β”‚
β”‚  β”‚  REST + SSE                                           β”‚
β”‚  β–Ό                                                       β”‚
β”‚  big_brain Orchestrator (:7352)                          β”‚
β”‚  Python 3.12 + LangGraph + FastAPI + OpenHands SDK       β”‚
β”‚  β”‚  LangGraph: ANALYZE β†’ DECOMPOSE β†’ EXECUTE β†’          β”‚
β”‚  β”‚             VALIDATE β†’ COMMIT                         β”‚
β”‚  β”‚  Workers = OpenHands Conversation (per git worktree)  β”‚
β”‚  β”‚  LLM = LiteLLM β†’ OpenRouter                          β”‚
β”‚  β”‚  Routing = RouteLLM (workers) + Sonnet (orchestrator) β”‚
β”‚  β”‚              β”‚                                        β”‚
β”‚  β”‚ MCP(HTTP)    β”‚ HTTP                                   β”‚
β”‚  β–Ό              β–Ό                                        β”‚
β”‚  quick_hands    Qdrant (:7350)                           β”‚
β”‚  MCP (:7351)    code, docs, history vectors              β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Components

Component Path Stack Purpose
big_brain src/big_brain/ Python 3.12, LangGraph, FastAPI Orchestrator core β€” graph, nodes, API, context engine
sharp_eye src/sharp_eye/ React 19, Ant Design, React Flow Dashboard UI β€” task management, run history, graph editor
quick_hands src/quick_hands/ Node.js, TypeScript MCP server β€” 16 code scaffolding tools

Graph Flow

START β†’ analyze β†’ decompose β†’ execute β†’ worker(s) β†’ validate β†’ commit β†’ END
                                  ↑                      β”‚
                                  └── retry (on failure) β”€β”˜
  • analyze β€” gathers context from codebase via RAG (Qdrant) and MCP tools
  • decompose β€” breaks task into subtasks with dependency waves (LiteLLM β†’ Sonnet)
  • execute β€” creates git worktrees per subtask, dispatches parallel workers
  • worker β€” executes subtask via OpenHands SDK (FileEditor + Terminal tools)
  • validate β€” checks success, file existence, Python syntax, LLM code review
  • commit β€” creates git commit with all changes

Tech Stack

Layer Technology
Graph engine LangGraph (StateGraph with checkpointing)
Worker execution OpenHands SDK (openhands-sdk + openhands-aci)
LLM abstraction LiteLLM (unified API for 100+ providers)
Model routing RouteLLM (automatic strong/weak model selection)
Embeddings FastEmbed (sentence-transformers/all-MiniLM-L6-v2, ONNX)
Vector DB Qdrant (code, docs, history collections)
API FastAPI (REST + SSE streaming)
UI React 19, Refine, Ant Design, React Flow
MCP Server Node.js TypeScript (16 scaffolding tools)
Isolation Git worktrees (one per parallel worker)

Quick Start

Prerequisites

  • Docker and Docker Compose
  • OPENROUTER_API_KEY environment variable set

Run with Docker Compose

# Start all services
docker compose up -d

# Check status
docker compose ps

# View logs
docker compose logs -f orchestrator

Run with Just

# Start system
just orch-up

# Run a task
just orch-run "Add description field to Tag model"

# Index codebase into Qdrant
just orch-index

# View logs
just orch-logs orchestrator

# Stop
just orch-down

CLI Usage

# Full execution
python -m big_brain "Add CRUD endpoints for Playlist"

# Dry run (analyze + decompose only)
python -m big_brain "Refactor auth module" --dry-run

# Verbose logging
python -m big_brain "Fix N+1 query in users page" --verbose

Services & Ports

Service Container Port Health Check
Qdrant orchestrator-qdrant :7350 GET /readyz
MCP Server orchestrator-hands :7351 GET /health
Orchestrator API orchestrator-brain :7352 GET /health
UI orchestrator-eye :7353 GET /

API Endpoints

Route Description
Core
GET /health Health check
POST /tasks Create a new task (with optional require_review)
GET /tasks List tasks
GET /tasks/{id} Get task details
POST /runs Start a task run
GET /runs List runs
GET /runs/{id} Get run details
GET /stream/{run_id} SSE stream for run progress
GET /skills List available skills
GET /stats Get usage statistics
GET /graph Get graph structure
Graph Editor
POST /tasks/{id}/approve Approve/reject plan
PUT /tasks/{id}/subtasks/{sid} Update subtask
POST /tasks/{id}/subtasks Create subtask
DELETE /tasks/{id}/subtasks/{sid} Delete subtask
PUT /tasks/{id}/waves Reorganize waves
Database
GET /database/stats Database size, checkpoints, threads
GET /database/details Thread list with checkpoint counts
POST /database/cleanup Cleanup old checkpoints
Git Operations
GET /git/status Git status (branch, files, ahead/behind)
GET /git/diff/{file} Unified diff for file
GET /git/branches List all branches
GET /git/commits Commit history
GET /git/branch-diff Changes in branch vs base
POST /git/checkout Switch branch
DELETE /git/branches/{name} Delete branch
GET /git/stash/list List stash entries
POST /git/stash/push Create stash
POST /git/stash/pop Pop stash
POST /git/stash/apply Apply stash
DELETE /git/stash/drop Drop stash

Configuration

All configuration is via environment variables with sensible defaults:

Variable Default Description
OPENROUTER_API_KEY β€” OpenRouter API key (required)
OPENROUTER_BASE_URL https://openrouter.ai/api/v1 OpenRouter base URL
ORCHESTRATOR_MODEL anthropic/claude-sonnet-4-20250514 Model for orchestrator nodes
WORKER_MODEL anthropic/claude-haiku-4-5-20241022 Default worker model
WORKER_CHEAP_MODEL deepseek/deepseek-chat Cheap model for simple tasks
WORKER_LARGE_CTX_MODEL google/gemini-2.5-pro-preview-06-05 Large context model
OPENHANDS_MAX_STEPS 30 Max agent steps per subtask
WORKER_PARALLEL_LIMIT 4 Max parallel workers per wave
ROUTELLM_THRESHOLD 0.5 Routing threshold (0=cheap, 1=strong)
ROUTELLM_STRONG_MODEL anthropic/claude-sonnet-4-20250514 Strong model for routing
ROUTELLM_WEAK_MODEL deepseek/deepseek-chat Weak model for routing
QDRANT_URL http://localhost:6333 Qdrant server URL
MCP_SERVER_URL http://localhost:3000 MCP server URL
WORKSPACE_ROOT /workspace Workspace root path
EMBEDDING_MODEL sentence-transformers/all-MiniLM-L6-v2 FastEmbed model (384 dimensions)

Project Structure

apex/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ big_brain/              # Orchestrator (Python)
β”‚   β”‚   β”œβ”€β”€ api/                # FastAPI routes
β”‚   β”‚   β”‚   β”œβ”€β”€ app.py          # Application setup
β”‚   β”‚   β”‚   └── routes/         # tasks, runs, skills, stats, stream, graph
β”‚   β”‚   β”œβ”€β”€ graph/              # LangGraph
β”‚   β”‚   β”‚   β”œβ”€β”€ state.py        # OrchestratorState, SubTask, WorkerResult
β”‚   β”‚   β”‚   β”œβ”€β”€ builder.py      # Graph construction
β”‚   β”‚   β”‚   └── nodes/          # analyze, decompose, execute, worker, validate, commit
β”‚   β”‚   β”œβ”€β”€ workers/            # Worker execution layer
β”‚   β”‚   β”‚   β”œβ”€β”€ openhands_worker.py  # OpenHands SDK integration
β”‚   β”‚   β”‚   β”œβ”€β”€ git_isolation.py     # Git worktree management
β”‚   β”‚   β”‚   └── routing.py          # RouteLLM model selection
β”‚   β”‚   β”œβ”€β”€ context/            # Context engine
β”‚   β”‚   β”‚   β”œβ”€β”€ engine.py       # Context gathering
β”‚   β”‚   β”‚   β”œβ”€β”€ rag.py          # Qdrant vector search
β”‚   β”‚   β”‚   β”œβ”€β”€ indexer.py      # Codebase indexer with embeddings
β”‚   β”‚   β”‚   └── mcp_client.py   # MCP server client
β”‚   β”‚   β”œβ”€β”€ prompts/            # LLM prompt templates
β”‚   β”‚   β”œβ”€β”€ skills/             # Project knowledge files
β”‚   β”‚   └── config.py           # Pydantic configuration
β”‚   β”œβ”€β”€ sharp_eye/              # UI (React)
β”‚   β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”‚   β”œβ”€β”€ pages/          # Dashboard, graph editor
β”‚   β”‚   β”‚   β”œβ”€β”€ resources/      # Tasks, runs, skills CRUD
β”‚   β”‚   β”‚   β”œβ”€β”€ components/     # CostBadge, LiveLogStream, StatusTag
β”‚   β”‚   β”‚   └── providers/      # Data provider, live provider
β”‚   β”‚   └── vite.config.ts
β”‚   └── quick_hands/            # MCP Server (Node.js)
β”‚       └── src/tools/          # Backend, frontend, operations tools
β”œβ”€β”€ dockerfiles/                # Dockerfile.orchestrator, .orchestrator-ui, .mcp-server
β”œβ”€β”€ docker-compose.yaml         # 4 services: qdrant, mcp, orchestrator, ui
β”œβ”€β”€ justfile                    # Build/run recipes
β”œβ”€β”€ requirements.txt            # Python dependencies
└── plans/                      # Design documents

About

No description, website, or topics provided.

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors