Lesson 15.05 · Phase 15 · Capstone: Your Own Agent Harness
Subagents & delegation
A subagent is a function call with its own context window. The parent pays for a summary, not for everything the child had to read.
Learning objectives
- Build a task tool that runs a fresh agent on a sub-problem and returns only its final answer.
- Define subagent profiles: a description the parent reads, a system prompt, a toolset (read-only by default), a step limit, and optionally a different model.
- Enforce the limits: a depth limit, a token budget shared with the parent, the same permission hooks, and an honest readonly flag on task itself.
- Measure what delegation changes: the parent's context per call, and the total tokens.
"Which functions in inventory/ modify their arguments?" To answer, an agent lists the folder and reads four files. Every one of those reads stays in the main agent's context and is re-sent on every later call, long after it stopped being useful. By the time the agent gets back to the actual job (fixing something), a third of its context is files it has finished with.
Loading the full lesson…