Web-deployed multi-agent AI system for autonomous software development with role-based orchestration and self-healing agent outputs.
What is the LLM Agent Orchestrator?
A sophisticated multi-agent system for autonomous software development. Built with Python, supporting
a Django web interface and Redis Queue worker mode, it enables teams of specialized AI
agents to collaborate on complex coding tasks through a persistent virtual file system.
🎯 Design Philosophy: This system bridges the gap between simple chatbots and
complex multi-agent architectures. Each agent has a distinct persona, role, and expertise area,
working together through structured communication protocols to produce complete, executable software
projects.
Core Capabilities
- Multi-Agent Collaboration: 6+ specialized agents (Strategist, PM, Architect,
Programmer, Bug-Hunter, Consensus Finder)
- Multi-Provider Support: Google Gemini, OpenAI GPT, Anthropic Claude, and Local
LLMs (LM Studio)
- Virtual File System: Persistent code storage with automatic versioning and
history tracking
- Self-Healing JSON: Automatic retry logic with syntax error recovery for code
generation
- Context Injection: Initial reviews receive a compact project snapshot; later reviews receive diffs, changed files, direct dependencies, scratchpad decisions, and runtime constraints
- Run Controls: Browser sessions can reconnect to active jobs, pause at a safe boundary, add session-bound steering, resume from a checkpoint, or continue a completed project without recreating its files
System Components
Agent Layer
Specialized AI personas with distinct system prompts
Temperature and token limits per agent
Orchestration Engine
Round-robin speaker rotation
Question-based delegation (QUESTION TO syntax)
Approval-based progression (APPROVAL trigger)
File System Layer
current/ - Active codebase (executable)
versions/ - Historical snapshots
logs/ - Conversation and configuration history
Use Cases
✅ Ideal For
• Proof-of-concept prototypes
• CLI tools and automation scripts
• Small web applications (Flask, FastAPI)
• Educational code examples
• Single-file utilities
❌ Not Recommended For
• Production-critical systems
• Projects requiring compiled languages (C++, Rust)
Complex GUI applications
• Projects needing binary assets (images, audio)
• Real-time systems with hard deadlines
Technical Stack
Backend
Python 3.11+ runtime
RQ/Redis worker queue for hosted runs
Frontend
Django templates + static JavaScript UI
Django (web)
LLM Integration
google-genai, openai, anthropic SDKs
Local OpenAI-compatible API
Storage
File-backed generated projects and logs
Redis-backed queue/session limits in RQ mode
Language Scope
Python-first execution: Python remains the hard automated runtime path for approved dependency installation, startup probes, and test discovery. The validator registry also hard-checks JSON and TOML, plus JavaScript, PHP, and shell syntax when their local runtimes are available. HTML and CSS receive bounded structural checks. Dependency/vendor trees are excluded from validation and test discovery.
Sandbox boundary: The optional Linux runner uses a separate unprivileged service, bounded archive extraction, scrubbed child environments, Bubblewrap namespaces, resource limits, and an isolated network for generated code. Dependency installation remains approval-gated because it needs package-index access. Operators can additionally use a strict private version-and-hash package policy and a tested Seccomp profile. This remains defense in depth, not a VM or MicroVM boundary for hostile multi-tenant code.
Production Queue Runtime
RQ / Redis
Browser requests enqueue long LLM runs.
A separate worker executes provider calls and validation.
Small Server Profile
One active worker keeps Oracle Free Tier stable.
Queue, session, and client limits protect constrained deployments.
Live Status
/healthz/ reports service health.
/queue_status/ reports active and queued jobs.
A durable worker lease flags delayed workers without launching duplicate runs.
System Architecture
Core Components
1. AgentSimulation (agent_logic.py)
Central orchestration engine managing conversation state, chat history, retry logic, JSON validation,
and file system operations.
2. LLM Provider Layer (llm_providers.py)
GeminiProvider
google-genai SDK
Model-dependent context window
OpenAIProvider
openai SDK v1.0+
Most reliable API
AnthropicProvider
anthropic SDK
Extended context windows
LocalProvider
OpenAI-compatible REST
http://localhost:1234/v1
Data Flow
1. User Input → Prompt
2. Select Agent (Round-Robin / QUESTION TO)
3. Load Context (Architect plan + current/ files)
4. LLM API Call (with bounded retry/backoff)
5. Parse Response (validate JSON if Programmer)
6. Save Files (current/ + versions/)
7. Update UI → Next Turn
File System Structure
output/project_name_20240115_143022/
├── logs/
│ ├── conversation.log # JSON-lines
│ └── agents.json # Config snapshot
├── current/ # EXECUTABLE
│ ├── main.py
│ └── src/
│ ├── __init__.py # Auto-generated
│ └── main.py
└── versions/ # HISTORY
├── main.py.v001
└── main.py.v002
Communication Protocols
APPROVAL
Consensus Finder signals completion
Advances round or ends simulation
QUESTION TO [Role]
Delegates to specific agent
Example: QUESTION TO Programmer: Fix import
AGENT_FAILURE
Retry exhaustion signal
Halts after retry exhaustion or provider failure
JSON Self-Healing
- Parser detects syntax error in Programmer response
- Error message constructed with original attempt
- Correction prompt sent back to Programmer (no turn increment)
- Loop until valid JSON or retry limit is reached
- Valid JSON → Files saved → Flow continues
⚠️ Critical Detail: JSON healing loop does NOT increment turn counter, preventing
downstream agents from reviewing code that was never saved.
Agent System
1. Strategist (Konrad) - Optional
Role
Strategic planning and requirement interpretation
Creates task checklists with role assignments
Config
Temp: 0.8 | Tokens: 8K | Enabled: False
Color: #9a9fa0 (gray)
2. Project Manager (Klaus)
Role
Converts plan into User Stories
Defines domain-specific minimal features
Makes fundamental technical decisions
Config
Temp: 0.7 | Tokens: 8K | Enabled: True
Color: #bb8fcd (purple)
3. Software Architect (Eva)
Role
Creates definitive technical design (pure spec, no code)
Defines file structure, entry point, interfaces, and import safety
Keeps requirements testable and unambiguous
Config
Temp: 0.6 | Tokens: 30K | Enabled: True
Color: #c6e1f4 (light blue)
Import Safety: Static validation checks internal module paths and imported public symbols without executing generated code. Installed packages in .sandbox_deps are excluded from code review and test discovery.
4. Programmer (Ben)
Role
1:1 implementation of Architect's design
Strict JSON output format (enforced)
Config
Temp: 0.2 | Tokens: 30K | Enabled: True
Color: #53ff79 (green)
JSON Format:
{"files": [
{"file_path": "main.py", "content": "..."},
{"file_path": "engine.py", "content": "..."}
]}
5. Bug-Hunter (Findus)
Role
Deep code analysis for logical errors
Circular dependency detection
Logic cohesion verification
Config
Temp: 0.1 | Tokens: 8K | Enabled: True
Color: #8cb4df (blue)
6. Consensus Finder (Judge)
Role
Final completeness verification
Compares planned vs. actual files
Blocks approval until 100 % complete
Config
Temp: 0.7 | Tokens: 8K | Enabled: True
Color: #27e0bb (cyan)
Communication Patterns
Round-Robin:
PM → Architect → Programmer → Bug-Hunter → Consensus
Question-Based:
Bug-Hunter finds error → QUESTION TO Programmer
Programmer fixes → Back to Bug-Hunter
Bug-Hunter approves → Continue to Consensus
Configuration System
Agent Parameters
name
Display name in UI
internal_name
Persona nickname
system_prompt
Complete role definition
color
Hex code (#RRGGBB)
enabled
Boolean toggle
temperature
0.0-1.0 randomness
max_output_tokens
256-32768 max length
Recommended Configs by Role
Creative
Strategist, PM
Temp: 0.7-0.8 | Tokens: 4K-8K
Design
Architect
Temp: 0.5-0.6 | Tokens: 16K-30K
Implementation
Programmer
Temp: 0.1-0.3 | Tokens: 16K-30K
Analysis
Bug-Hunter, Consensus
Temp: 0.1-0.2 | Tokens: 4K-8K
Environment Variables
GEMINI_API_KEY
ai.google.dev
OPENAI_API_KEY
platform.openai.com
ANTHROPIC_API_KEY
console.anthropic.com
Best Practices
- System Prompts: Use ALL-CAPS for critical rules (NEVER, MUST, ALWAYS)
- Temperature: Code generation: 0.1-0.3, Design: 0.5-0.7, Brainstorming: 0.8-1.0
- Token Meter: Gemini, OpenAI, and Anthropic report actual completed-request usage when available; local or compatible endpoints fall back to a conservative estimate. The preflight guard remains conservative.
- Ordering: Architect MUST come before Programmer (plan cached for context
injection)
⚠️ Critical: Architect must precede Programmer. System caches Architect's plan as
last_architect_plan for injection into Programmer/Bug-Hunter/Consensus contexts.
Simulation Workflow
1. Initialization
- Launch the web application
- Load default agent config
- Check API key environment variables
- Detect available LLM providers
2. Configuration
User
Select provider/model
Enter API key
Adjust agents
Set rounds (1-10)
System
Validate API key
Update UI dropdowns
Initialize logs
Prepare queue
Workflow Profiles
Fast
Direct multi-agent routing for quick, exploratory work.
Engineering
Records a task specification and architecture decision, requests one bounded PM review, then permits at most one architecture revision before implementation.
Phased Engineering (experimental)
PM reviews an adaptive, budgeted plan before the user approves the final ADR set; each implementation phase then passes deterministic validation, defect review, and Architect ADR-conformance.
Phased Engineering persists implementation_plan.json, a human-readable implementation_plan.md, zero or more material ADR-*.md records, a safe-boundary graph_checkpoint.json, and a phase result for every delivery gate. The PM selects a small, standard, or high-risk delivery budget; it constrains rather than pads ADRs and phases. The user remains the final authority: edited ADRs are impact-reviewed and any revised plan returns for fresh approval. These artifacts make resume behavior inspectable.
3. Orchestration Loop
Round N:
Turn 1-5: Agents respond in sequence
If APPROVAL → Advance Round / End
If QUESTION TO → Jump to target agent
Else → Next agent
4. Multi-Pass Refinement
Pass 1: Programmer delivers → Bug-Hunter finds issue
Pass 2: Programmer fixes → Bug-Hunter approves
Pass 3: Consensus checks → Missing file found
Pass 4: Programmer adds → Consensus → APPROVAL
5. Completion
Success
APPROVAL + round limit reached
Pause
User requests a safe checkpoint
Failure
3 retries exhausted
Error
Critical exception
Browser Session Recovery
- Each browser session receives a server-owned session key.
- RQ jobs persist their status, update stream, artifact manifest, generated project files, and a worker liveness lease.
- After a reload, the browser offers a reconnect action for the same session only. Paused RQ runs expose a resume action from their durable checkpoint.
- Persisted events are replayed while SSE reconnects; polling remains the recovery path if a proxy buffers streams.
- Completed projects can start a controlled continuation with a new instruction; the existing generated files remain the source of truth.
- Completed projects remain available for ZIP download until the configured retention cleanup runs.
- A stale lease is diagnostic only: the app waits for the durable RQ state or a user-controlled checkpoint resume instead of risking concurrent writers.
Continuity scope: Pause, resume, steering, and continuation are limited to the same server-owned browser session and output directory. Checkpoints, API keys, and worker context are private metadata and are never included in project ZIP exports. The app does not accept arbitrary project-folder uploads as an execution source.
Troubleshooting Guide
API Issues
Immediate Red Error
Symptom
Error immediately on start
No agent responses
Solution
1. Verify API key (copy-paste)
2. Check model dropdown
3. Test connection
4. Try different model
Gemini 400 Error
Symptom
Provider request fails or times out mid-simulation
Chat may retry with bounded backoff
Solution
Check provider/model access and quota
Hosted mode: check queue_status and worker logs
Try a known available model from the refreshed dropdown
Local LLM Refused
Cause
LM Studio not running
Wrong port (need 1234)
Solution
1. Start LM Studio
2. Verify port 1234
3. Test: curl localhost:1234/v1/models
4. Enter "local" as API key
JSON Errors
Infinite Healing Loop
Cause
Model doesn't understand correction
Temperature too high
Solution
1. Lower Programmer temp to 0.1
2. Use stronger model (GPT-4, Opus)
3. Simplify project scope
Import Errors
ModuleNotFoundError
Symptom
ModuleNotFoundError for a local module or third-party dependency
Solution
1. Verify the generated entry point imports local files correctly
2. Check that requirements.txt contains only real third-party packages
3. Approve expected sandbox dependencies when prompted
4. If dependency approval is denied, agents must implement a fallback
Circular Import
Cause
Module A imports B, B imports A
Solution
1. Trace import chain
2. Use forward refs: def foo(x: 'Class')
3. Move imports inside functions
4. Extract shared code to 3rd module
Known Limitations
- Binary Assets: Binary assets and native GUI dependencies may require explicit requirements, approval, and manual review
- Large Projects: 50+ files may exceed context. Workaround: Split into modules
- GUI/game frameworks: Dependencies such as pygame can be installed into
.sandbox_deps after approval. Long-running startup probes are accepted for games and event loops; native desktop GUI limits such as missing Tkinter libraries or an X display are reported as host limitations rather than code defects.
Critical Recovery: If broken beyond repair:
- Close app/stop server
- Delete output/ directory
- Verify API key
- Start minimal (PM, Architect, Programmer, Consensus)
- Test: "Create hello world script"