Multi-Task Orchestrator
Decompose complex tasks into parallel sub-tasks with automatic dependency resolution.
Overview
The orchestrator lets an agent break a complex request into multiple independent sub-tasks that run in parallel, with results fed into dependent tasks as they complete.
User: "Research 3 competitors, write a comparison table, draft an executive summary"
↓
Planner LLM → [subtask 0: research A] [subtask 1: research B] [subtask 2: research C]
↓ ↓ ↓
[subtask 3: comparison table] (depends on 0,1,2)
↓
[subtask 4: executive summary] (depends on 3)
↓
Synthesise → final response in parent session
Usage
From the TUI
/orchestrate Research the top 3 AI coding tools, write a comparison, and draft a recommendation memo.
Check progress:
/plan-status <plan-id>
Via the agent tool
The plan_tasks tool is available to every agent:
Use plan_tasks to: research the latest EU AI Act developments, identify 5 affected industries, and draft a compliance checklist for each.
Via REST API
POST /v1/orchestrate
Authorization: Bearer <token>
Content-Type: application/json
{
"taskDescription": "...",
"maxSubtasks": 5
}
Response:
{ "planId": "uuid-..." }
How It Works
1. Planner Session
A temporary opencode session is created with the "task decomposition specialist" system prompt. It receives the task description and outputs a JSON array:
[
{ "description": "Research competitor A", "agent": "build", "dependencies": [] },
{ "description": "Research competitor B", "agent": "build", "dependencies": [] },
{ "description": "Write comparison table", "agent": "build", "dependencies": [0, 1] }
]
2. Sub-task Execution
Each sub-task with no unmet dependencies is enqueued as an orchestrator-subtask job immediately. Tasks with dependencies re-enqueue themselves every 5 seconds until all deps complete.
Each sub-task:
- Creates its own opencode session
- Receives completed dependency results as context:
"Context from previous steps:\nSubtask 1: ...\nResult:\n..." - Polls for completion (10-minute timeout)
3. Synthesis
When all sub-tasks reach terminal status (completed or failed), an orchestrator-synthesize job fires. It prompts the original parent session to combine all results into a coherent response.
Checking Status
GET /v1/orchestrate/:planId
Returns:
{
"plan": { "id": "...", "status": "executing", "taskDescription": "..." },
"subtasks": [
{ "index": 0, "status": "completed", "description": "...", "result": "..." },
{ "index": 1, "status": "running", "description": "..." },
{ "index": 2, "status": "pending", "description": "..." }
]
}
Limits
| Parameter | Default | Max |
|---|---|---|
maxSubtasks | 5 | 10 |
| Sub-task timeout | 10 minutes | — |
| Planner timeout | 3 minutes | — |
