Task Dispatch¶
How it works¶
- Create a task with an agent image, instructions, and optional skills/configs
- Call
dispatch_task(task)— assembles brief, selects dispatcher, POSTs to it - Dispatcher queues the task, consumer dequeues and spawns the container
- Agent boots, downloads brief, checks in, does work, checks back
- Dispatcher fires callback to Controller with result
Brief Assembly¶
The brief is a JSON package containing everything the agent needs:
{
"task_id": "uuid",
"task_name": "Code review",
"skills": [{"slug": "code-review", "instructions": "..."}],
"configs": [{"slug": "style-guide", "content": "..."}],
"instructions": "Review the PR for quality.",
"context": "Repository: org/repo, PR #42"
}
Dispatch Modes¶
- HTTP (default): Controller POSTs to Dispatcher's
/tasksendpoint - Bus: Controller publishes to Redis Stream or SQS; Dispatcher consumes via XREADGROUP
Retry Policy¶
dispatch_with_retry() wraps dispatch with exponential backoff:
- Retryable: connection errors, timeouts, 5xx, "no active dispatcher"
- Non-retryable: BriefAssemblyError, ImageResolutionError, ValueError, 4xx