Skip to content

Task Dispatch

How it works

  1. Create a task with an agent image, instructions, and optional skills/configs
  2. Call dispatch_task(task) — assembles brief, selects dispatcher, POSTs to it
  3. Dispatcher queues the task, consumer dequeues and spawns the container
  4. Agent boots, downloads brief, checks in, does work, checks back
  5. 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 /tasks endpoint
  • 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