Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions docs/architecture/orchestrator.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,18 @@ See `orchestrator/routes/pipelines.py:WORKTREE_BASE_DIR` and `gateway/worktree_m

The orchestrator coordinates specialized agent roles across pipeline phases. Each role runs in its own sandbox container with scoped permissions enforced by the gateway.

### Coordinator Role

When `coordinator_enabled: true` is set on a pipeline, a single **coordinator** agent runs instead of the fixed-phase dispatcher. The coordinator analyzes the task, spawns agents on demand, and manages phase transitions dynamically via the coordinator REST API.

| Role | Responsibility |
|------|----------------|
| **Coordinator** | Analyze task requirements, spawn appropriate agents, manage phase transitions, escalate HITL decisions |

**Execution model**: The coordinator container runs first and drives the entire pipeline. It communicates with the orchestrator via `egg-orch coordinator` CLI commands or the coordinator REST API. Guardrails (max agents, max retries per role, max respawns) prevent runaway behavior and are enforced by the orchestrator.

See the [Coordinator Guide](../guides/coordinator.md) for operational details.

### Refine Phase Roles

| Role | Responsibility |
Expand Down Expand Up @@ -392,11 +404,22 @@ Fixed IPs:
- `GET|POST /pipelines/{id}/messages` - Inter-agent message bus (send/poll; concurrent mode)
- `GET /pipelines/{id}/messages/status` - Message bus statistics (concurrent mode)
- `GET /pipelines/{id}/decisions` - HITL decision queue
- `POST /pipelines/{id}/coordinator/spawn` - Spawn an agent via coordinator (requires `coordinator_enabled`)
- `GET /pipelines/{id}/coordinator/state` - Get coordinator state (agents, phases, guardrails)
- `POST /pipelines/{id}/coordinator/phase` - Advance or skip to a target phase
- `POST /pipelines/{id}/coordinator/escalate` - Create a HITL escalation from the coordinator
- `DELETE /pipelines/{id}/coordinator/agents/{role}` - Cancel a running agent by role
- `POST /pipelines/{id}/deployment-check/start` - Start devserver for deployment validation
- `GET /pipelines/{id}/deployment-check/status` - Poll devserver status
- `POST /pipelines/{id}/deployment-check/teardown` - Tear down devserver
- `GET /pipelines/{id}/health` - On-demand pipeline health check (all tiers)

**MCP Server (`/mcp/`)** *(optional, requires `EGG_MCP_SERVER_ENABLED=true`)*
- `GET /health` - MCP server health check
- `GET /mcp/v1/tools` - List available coordinator tools
- `POST /mcp/v1/tools/call` - Execute a coordinator tool call
- `GET /mcp/v1/sse` - SSE stream for MCP protocol events (tool listing + heartbeats)

**CLI Access:**
The `egg-orch` CLI (`sandbox/bin/egg-orch`) provides command-line access to all orchestrator API endpoints. Available in sandbox containers for agent use, or can be run from the host with appropriate environment variables. See the [README CLI Reference](../../README.md#egg-orch-cli) for command details.

Expand Down
4 changes: 4 additions & 0 deletions docs/development/STRUCTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,13 @@ orchestrator/
│ │ └── state_consistency.py # Cross-reference orchestrator state vs Docker vs contract
│ └── tier2/ # Semantic checks (LLM-powered)
│ └── agent_inspector.py # Claude-powered agent progress analysis
├── coordinator_executor.py # Coordinator agent lifecycle management (spawn, crash recovery)
├── mcp_server.py # MCP server sidecar for coordinator integration with Claude Code (port 9850)
├── mcp_tools.py # MCP tool definitions and handlers for coordinator operations
├── routes/ # API route handlers
│ ├── checks.py # Deployment validation check endpoints
│ ├── containers.py # Container management endpoints
│ ├── coordinator.py # Coordinator REST API endpoints (spawn, state, phase, escalate)
│ ├── decisions.py # HITL decision endpoints
│ ├── health.py # Health check endpoints
│ ├── messages.py # Inter-agent message bus endpoints (concurrent mode)
Expand Down
Loading