prompts: add heterogeneous fan-out pattern to subagents fragment
This commit is contained in:
parent
427161638f
commit
d1cd906db1
|
|
@ -37,10 +37,22 @@ Prompt is all remaining arguments after flags.
|
||||||
- N = 1: raw result
|
- N = 1: raw result
|
||||||
- N > 1: results separated by `=== {job-id} ===` headers, in submission order
|
- N > 1: results separated by `=== {job-id} ===` headers, in submission order
|
||||||
|
|
||||||
|
## Heterogeneous fan-out
|
||||||
|
|
||||||
|
To run N subagents with N different prompts, combine with `execute_code` parallel steps — each step is one `subagent_spawn` shell invocation:
|
||||||
|
|
||||||
|
```
|
||||||
|
execute_code: steps=[
|
||||||
|
{code: "subagent_spawn 'Summarize core/pkg/agent/loop.go'"},
|
||||||
|
{code: "subagent_spawn 'Summarize core/pkg/backend/anthropic.go'"},
|
||||||
|
{code: "subagent_spawn 'Summarize 9p/internal/p9/server.go'"}
|
||||||
|
]
|
||||||
|
```
|
||||||
|
|
||||||
|
Three concurrent subagents, three different prompts. Results appear under `=== step N ===` headers from `execute_code`.
|
||||||
|
|
||||||
## Design rules
|
## Design rules
|
||||||
|
|
||||||
**Same agent across parallel subagents.** Different agents produce different output schemas; concatenating them is incoherent.
|
**Same agent across parallel subagents.** Different agents produce different output schemas; concatenating them is incoherent.
|
||||||
|
|
||||||
**Prompt for structured output when you need to parse results.** Tell subagents the exact format to respond in (numbered list, JSON, markdown sections) so you can extract what you need from the joined block.
|
**Prompt for structured output when you need to parse results.** Tell subagents the exact format to respond in (numbered list, JSON, markdown sections) so you can extract what you need from the joined block.
|
||||||
|
|
||||||
**All subagents receive the same prompt.** Differentiate their work inside the prompt — include a shard index, file path, or role description if the tasks differ.
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue