System Overview
Execution Phases
Sequential Phases
Most phases execute sequentially:- PRD → Product Requirements Document
- Data → Data models and schemas
- Design → Design system and tokens
- Logic → Business logic and workflows
- API → API specification
- Frontend → Frontend architecture
- Deployment → Infrastructure and CI/CD
Parallel Execution
Some phases support parallel execution (fan-out/fan-in):- PRD, Data, Logic - Can execute in parallel
- Results merged after completion
- Used for independent artifact generation
Human-in-the-Loop (HITL)
Strategic interrupt points for human review:Interrupt Triggers
- After Logic Phase: Review business rules before API design
- After API Phase: Review API spec before frontend implementation
- Manual Interrupts: User-initiated pauses
Interrupt Flow
- Agent sets
interrupt_signal: true - Supervisor pauses execution
- Human reviews artifacts
- Human approves or requests changes
- Execution resumes or restarts
State Management
Architecture State
State Transitions
Artifact Generation
Artifact Types
- Markdown: PRDs, specifications, documentation
- Code: Schemas, configurations, scripts
- JSON: Structured data, configurations
Artifact Storage
- Small artifacts: D1 database (text storage)
- Large artifacts: R2 storage (object storage)
- Versioning: Timestamp-based versioning
Graph Execution
The supervisor uses graph-based execution:Parallel Nodes
Sequential Nodes
Streaming Architecture
Real-time progress via Server-Sent Events:Event Types
agent_start- Agent execution startedagent_progress- Progress updateagent_complete- Agent execution completedphase_complete- Phase completedinterrupt- HITL interrupt triggered
Stream Flow
Error Handling
Agent Errors
- Agent failures don’t block entire pipeline
- Errors logged in execution traces
- Supervisor can retry or skip failed agents
State Recovery
- Checkpoints stored at interrupt points
- State can be restored from checkpoints
- Project state persisted in D1
Related Documentation
- Backend Supervisor - Implementation
- Backend Agents - Agent details
- Supervisor API - API reference