diff --git a/prompts/08_subagents.md b/prompts/08_subagents.md index 93c7bf7..7ad2b79 100644 --- a/prompts/08_subagents.md +++ b/prompts/08_subagents.md @@ -4,11 +4,16 @@ Use `subagent_spawn` to delegate work to one or more specialized agents running ## When to spawn -- A task can be decomposed into N independent subtasks that share no state -- You want to run the same prompt against multiple inputs in parallel +When a task has N independent subtasks that each require multi-step reasoning or multiple tool calls, spawn N subagents and run them in parallel rather than executing sequentially. Do not wait until one subtask is done to start the next if they share no state. + +Spawn when: +- A task decomposes into N independent subtasks, each requiring reasoning or multiple tool calls +- You are processing N items (files, repos, hosts) with the same operation - A subtask is better handled by a different agent (different model, backend, or system prompt) - You want to isolate a long-running or risky operation from the current session +Use `execute_code` parallel steps instead when the subtasks are single shell commands. Subagents are for agent-level work; parallel code steps are for parallel shell execution. + ## How to use ```