Task delegation is the primary mechanism for spawning specialized agents to execute subtasks. The delegate_task tool (implemented as createDelegateTask) enables the main orchestrator agents (Sisyphus, Atlas, Prometheus) to distribute work to category-optimized or specialized agents. This page documents the tool's parameters, delegation modes, prompt construction, and execution flow.
For information about the categories system and model mappings, see Categories System. For background task lifecycle management, see Background Task Tools. For skill loading and evaluation, see Skills System.
The delegate_task tool is registered in the tool registry and created by the createDelegateTask factory function packages/omo-opencode/src/tools/delegate-task/tools.ts58-61 It requires either a category or subagent_type parameter to determine which agent will execute the task packages/omo-opencode/src/tools/delegate-task/tools.ts49-50
The tool arguments are defined in delegateTaskArgsSchema packages/omo-opencode/src/tools/delegate-task/tools.ts38-56:
| Parameter | Type | Description |
|---|---|---|
description | string | Short task description (3-5 words). Auto-generated from prompt if omitted packages/omo-opencode/src/tools/delegate-task/tools.ts43 |
prompt | string | Full detailed prompt for the agent packages/omo-opencode/src/tools/delegate-task/tools.ts44 |
load_skills | string[] | Skill names to inject. Optional; defaults to []. Pass an explicit array for skill-specific tasks packages/omo-opencode/src/tools/delegate-task/tools.ts39-42 |
run_in_background | boolean | true for async (returns bg_...), false for sync (waits). Use true ONLY for parallel exploration packages/omo-opencode/src/tools/delegate-task/tools.ts45-48 |
category | string | REQUIRED if subagent_type not provided. Uses category-specific model/prompt packages/omo-opencode/src/tools/delegate-task/tools.ts49 |
subagent_type | string | REQUIRED if category not provided. Direct agent invocation (e.g., "explore", "oracle") packages/omo-opencode/src/tools/delegate-task/tools.ts50 |
task_id | string | Continuation session id (ses_...) from task metadata; not a background task id packages/omo-opencode/src/tools/delegate-task/tools.ts51-54 |
command | string | The command that triggered this task packages/omo-opencode/src/tools/delegate-task/tools.ts55 |
Sources: packages/omo-opencode/src/tools/delegate-task/tools.ts38-63 packages/omo-opencode/src/tools/delegate-task/types.ts12-22
The delegate_task tool supports two primary delegation modes: category-based delegation and direct agent invocation.
When category is provided, the tool typically spawns a Sisyphus-Junior agent. This approach uses resolveCategoryExecution to find the optimal model and prompt appends for the domain packages/omo-opencode/src/tools/delegate-task/category-resolver.ts61-66 It also checks for "unstable" agents (e.g., those using reasoning models that may time out) that might require forced background execution via executeUnstableAgentTask.
When subagent_type is provided, the tool invokes a specific specialized agent directly via resolveSubagentExecution. This mode validates that:
resolveSubagentAgentMatch.The system maps natural language agent requests to internal code entities and configurations.
Title: "Agent Resolution and Code Entity Mapping"
Sources: packages/omo-opencode/src/tools/delegate-task/category-resolver.ts61-170 packages/omo-opencode/src/features/team-mode/AGENTS.md52-62
Default categories are defined in DEFAULT_CATEGORIES and verified in tests packages/omo-opencode/src/tools/delegate-task/tools.test.ts157-197
| Category | Model (Default) | Variant | Purpose |
|---|---|---|---|
visual-engineering | google/gemini-3.1-pro | high | UI/UX, Design Systems, CSS packages/omo-opencode/src/tools/delegate-task/tools.test.ts160-166 |
ultrabrain | openai/gpt-5.5 | xhigh | Logic-heavy tasks, architecture packages/omo-opencode/src/tools/delegate-task/tools.test.ts168-176 |
deep | openai/gpt-5.5 | medium | Goal-oriented autonomous work packages/omo-opencode/src/tools/delegate-task/tools.test.ts178-186 |
unspecified-high | anthropic/claude-opus-4-7 | max | General high-effort tasks packages/omo-opencode/src/tools/delegate-task/tools.test.ts188-196 |
Sources: packages/omo-opencode/src/tools/delegate-task/tools.test.ts157-218 packages/omo-opencode/src/tools/delegate-task/category-resolver.ts69-102
The system prompt for the delegated agent is built dynamically. For planning agents like Prometheus, a rigid structure is mandated through model-specific markdown variants stored in prompts-core packages/omo-opencode/src/agents/prometheus/AGENTS.md10-15
Prometheus generates plans using a parallel task graph with the following sections packages/omo-opencode/src/agents/prometheus/AGENTS.md73-80:
explore and librarian agents via call_omo_agent.Sources: packages/omo-opencode/src/agents/prometheus/AGENTS.md7-80 packages/omo-opencode/src/tools/delegate-task/sync-prompt-sender.ts87-91
The delegation system coordinates various task execution strategies depending on whether the task is synchronous or backgrounded.
executeSyncTask creates a new session and blocks until the agent finishes or a timeout occurs packages/omo-opencode/src/tools/delegate-task/sync-task.ts15-26 It handles spawn reservations to manage concurrency packages/omo-opencode/src/tools/delegate-task/sync-task.ts36-37 It also registers side effects like task toast management packages/omo-opencode/src/tools/delegate-task/sync-task.ts92-103
Title: "Sync Task Execution Flow"
executeBackgroundTask returns a task_id immediately and runs asynchronously via the BackgroundManager. It waits briefly for the session to initialize to publish correct metadata packages/omo-opencode/src/features/background-agent/AGENTS.md39-46
Existing tasks can be resumed using the task_id parameter. This function resolves the previous session context to maintain agent and model continuity, often triggered by the todoContinuationEnforcer hook packages/omo-opencode/src/hooks/AGENTS.md91
Sources: packages/omo-opencode/src/tools/delegate-task/sync-task.ts15-175 packages/omo-opencode/src/tools/delegate-task/sync-session-lifecycle.ts14-69 packages/omo-opencode/src/features/background-agent/AGENTS.md37-46 packages/omo-opencode/src/hooks/AGENTS.md84-96
Refresh this wiki