Delegate tasks to subagents
Assigns focused tasks to subagents and checks their results.
Goal
Use this skill to delegate a focused, bounded task to delegate_subagent_task. The child agent executes the task once in an isolated context, returns its result to the master agent, and terminates. It does NOT create an interactive session with the end user or switch roles in the current chat.
Use when
- The user asks to delegate, split, investigate, or run an isolated subtask with a separate agent.
- The task benefits from a separate chat/context or a shorter, focused prompt.
- The user explicitly wants background execution or the work is long-running and does not block the next master step.
Sequential Workflow
- Call
delegate_subagent_taskwith a self-containedprompt. - Omit
parallelor set it tofalse. - Use the returned tool result as the subagent answer.
- Continue only after integrating the returned result into the master response or next step.
Parallel Workflow
- Call
delegate_subagent_taskwithparallel: true. - Read the immediate tool result and keep both identifiers:
background_process_idinitiating_message_key
- Continue with master work that does not depend on the subagent result.
- Use
inspect_background_processwithbackground_process_idto check status and stream events. - Use
get_subagent_execution_trace_by_initiating_messagewithinitiating_message_keyto inspect the subagent trace and final answer. - If the result is not ready, inspect again later with the newest
last_event_counter. - Use
cancel_background_processonly when the user wants the background run stopped or when the run is clearly obsolete.
Verification Rules
- For sequential runs, the tool response is the verification surface.
- For parallel runs, check the background process first. A completed process can still have trace details that should be read through
get_subagent_execution_trace_by_initiating_message. - If
get_subagent_execution_trace_by_initiating_messagereturns no trace yet, the subagent may still be running or may not have persisted a trace. Useinspect_background_processbefore treating that as failure. - If the
background_process_idis lost, usesearch_background_processeswithprocess_type: "subagent_execution"andprocess_subject: "delegate_subagent_task".
Prompt Rules
- Make the prompt self-contained: goal, constraints, expected output, and what not to change.
- Mention whether the subagent should only inspect, produce a proposal, or implement changes.
- Include relevant keys or names when targeting another chat/context.
- Keep the prompt narrow enough that the master can evaluate the result.
Targeting
chat_keyselects an exact target chat and takes priority over context/name targeting.context_nameselects a target context when nochat_keyis given.chat_nameselects or creates a chat inside the target context.history_lengthcontrols how much target-chat history the subagent sees. Use0for an isolated run.
Examples
Sequential:
{
"prompt": "Inspect the current context and summarize the risks in the proposed scheduler change. Return concrete findings only.",
"history_length": 0,
"parallel": false
}
Parallel:
{
"prompt": "Investigate the generic-agent-interface tests for brittle assumptions around subagent tool schemas. Return a concise report with file references.",
"history_length": 0,
"parallel": true
}