Skip to content

Orchestrator

The Orchestrator is Nova’s central coordination service. It manages agent lifecycles, dispatches tasks through the Quartet Pipeline, maintains the Redis task queue, connects MCP tool servers, and runs database migrations at startup.

PropertyValue
Port8000
FrameworkFastAPI + asyncpg
DatabasePostgreSQL 16 (raw asyncpg queries, no ORM)
State storeRedis (db 2)
Sourceorchestrator/
  • Agent lifecycle — create, list, update, delete agents stored in Redis
  • Task routing — accept tasks via REST, run them through the agent loop (tool-use + LLM), return results or stream via SSE
  • Quartet Pipeline — execute the 5-stage agent chain (Context, Task, Guardrail, Code Review, Decision) for async tasks
  • Task queue — Redis BRPOP-based async queue with heartbeat (30s) and stale task reaper (150s timeout)
  • MCP tool dispatch — load MCP server configurations from the database, connect to them at startup, and expose their tools to agents
  • API key management — create, list, and revoke API keys (SHA-256 hashed, sk-nova-* format)
  • DB migrations — apply versioned SQL migrations from orchestrator/app/migrations/*.sql at startup (idempotent, no Alembic)
MethodPathAuthDescription
POST/api/v1/agentsAPI keyCreate a new agent
GET/api/v1/agentsAPI keyList all agents
GET/api/v1/agents/{id}API keyGet agent details
PATCH/api/v1/agents/{id}/configAdminUpdate agent model, system prompt, fallback models
DELETE/api/v1/agents/{id}API keyDelete an agent
MethodPathAuthDescription
POST/api/v1/tasksAPI keySubmit a task (synchronous)
POST/api/v1/tasks/streamAPI keySubmit a task (SSE streaming)
GET/api/v1/tasks/{id}API keyGet task result
MethodPathAuthDescription
POST/api/v1/pipeline/tasksAPI keySubmit task to the async pipeline queue
GET/api/v1/pipeline/tasksAPI keyList recent tasks (filterable)
GET/api/v1/pipeline/tasks/{id}API keyGet task status and output
POST/api/v1/pipeline/tasks/{id}/cancelAPI keyCancel a queued/pending task
GET/api/v1/pipeline/tasks/{id}/findingsAPI keyGuardrail findings for a task
GET/api/v1/pipeline/tasks/{id}/reviewsAPI keyCode review verdicts
GET/api/v1/pipeline/tasks/{id}/artifactsAPI keyArtifacts produced by a task
POST/api/v1/pipeline/tasks/{id}/reviewAPI keyApprove/reject a pending human review
GET/api/v1/pipeline/queue-statsAPI keyQueue depth and dead-letter count
GET/api/v1/pipeline/dead-letterAdminInspect dead-letter queue
MethodPathAuthDescription
POST/api/v1/chat/streamAdminStreaming chat with the primary Nova agent
MethodPathAuthDescription
GET/api/v1/podsAPI keyList all pods
POST/api/v1/podsAdminCreate a new pod
GET/api/v1/pods/{id}API keyGet pod details and agents
PATCH/api/v1/pods/{id}AdminUpdate pod settings
DELETE/api/v1/pods/{id}AdminDelete pod and its agents
GET/api/v1/pods/{id}/agentsAPI keyList agents in a pod
POST/api/v1/pods/{id}/agentsAdminAdd agent to pod
PATCH/api/v1/pods/{id}/agents/{aid}AdminUpdate agent config
DELETE/api/v1/pods/{id}/agents/{aid}AdminRemove agent from pod
MethodPathAuthDescription
GET/api/v1/mcp-serversAPI keyList registered MCP servers
POST/api/v1/mcp-serversAdminRegister a new MCP server
PATCH/api/v1/mcp-servers/{id}AdminUpdate server config
DELETE/api/v1/mcp-servers/{id}AdminRemove server
POST/api/v1/mcp-servers/{id}/reloadAdminReconnect to server
MethodPathAuthDescription
POST/api/v1/keysAdminCreate API key (raw key shown once)
GET/api/v1/keysAdminList all keys
DELETE/api/v1/keys/{id}AdminRevoke a key
MethodPathDescription
GET/health/liveLiveness probe
GET/health/readyReadiness probe (checks DB + Redis)
VariableDescriptionDefault
DATABASE_URLPostgreSQL connection string
REDIS_URLRedis connection stringredis://redis:6379/2
ADMIN_SECRETAdmin authentication secret
REQUIRE_AUTHEnforce API key authfalse
DEFAULT_CHAT_MODELDefault model for interactive chat
NOVA_WORKSPACEHost path mounted at /workspace
LOG_LEVELLogging levelINFO
SHELL_SANDBOXDefault sandbox tier (isolated/nova/workspace/host)workspace
CORS_ALLOWED_ORIGINSComma-separated allowed origins*
  1. Recover any Redis agents stuck in running state from a previous crash
  2. Initialize the PostgreSQL connection pool and apply versioned schema migrations
  3. Ensure one canonical “Nova” agent exists; prune duplicates
  4. Load MCP server configurations from the database and connect to enabled servers
  5. Start background tasks: queue worker (BRPOP) and stale task reaper
  • Async throughout — all database access uses asyncpg with connection pooling; all Redis operations use redis.asyncio
  • No ORM — raw SQL queries via asyncpg for maximum performance and control
  • Tool registry — built-in tools (file I/O, shell, git, platform) are statically registered; MCP tools are dynamically loaded at runtime via get_all_tools()
  • Sandbox tiers — four access levels (isolated, nova, workspace, host) control filesystem and shell access per pod; configured via SandboxTier enum
  • Fault tolerant — all optional integrations wrapped in try/except with logger.warning; missing config never crashes the service