Chapter 18 · CLI
Subagents: built-in and custom agents
Subagents are helper agents the main session can delegate work to: some built-in and some custom. Proper delegation saves main context and parallelizes work.
Video
Steps
- Understand when delegation pays off: an independent task with a clear definition whose result returns summarized.
- Create a custom subagent with its own role, tools and permissions, keeping the definition narrow to prevent stray actions.
- Phrase delegations with full context: the task, the relevant files and the expected result shape.
- Verify the agent result before relying on it; a good report is no substitute for checking.
Mechanism animation (illustration)
Common pitfall: Do not assume separate context means no inherited permissions or context. Built-in and custom agents have different defaults; inspect the tool set, permission mode and delegation before use.
Hands-on exercise: Create a simple subagent (a testing specialist, for example), delegate a defined task and verify the result against the actual work.
Filmed demo · Video is added in the media phase
Recap
Comprehension check
When is delegating to a subagent worthwhile?
Recap
- Delegation saves main context
- Custom agents with narrow definitions and own permissions
- Verify results before relying