Track 03 · Agents & toolsLesson 10 of 12

Subagents, skills and code mode

Split the work without multiplying latency and tokens.

What you'll be able to do

What you'll be able to do

01
  1. Explain three ways a single agent can decompose work: delegating to subagents, loading packaged skills on demand, and writing code that calls tools.
  2. Calculate the context and token trade-off of subagents versus one agent reading everything, and decide which a task needs.
  3. Write a valid SKILL.md that uses progressive disclosure, and say what belongs in the body versus referenced files and scripts.
  4. Design a code-mode tool surface and the sandbox it requires.
  5. Recognise when decomposition hurts (coordination overhead, lost context, debugging difficulty) and choose not to decompose.
Before you start

Before you start

The short version

The short version

A single agent with one long context degrades as the work grows: every document, tool definition and intermediate result competes for the same window, costs tokens on every step, and distracts the model. Three patterns decompose the work. Subagents give a sub-task its own clean context and a narrow brief, and return a short structured result, so the orchestrator never sees the raw material. Skills package instructions, scripts and reference files so the agent loads only a one-line description up front and the full procedure only when the task needs it. Code mode presents tools as a code API: the model writes a short program that calls tools and filters results in a sandbox, so thousands of rows never enter its context. Each pattern trades something: subagents cost more total tokens and add coordination, skills need curation and review, code mode needs a real sandbox. Use them when the work is genuinely separable or large; keep a single agent when it is small, tightly coupled or hard to debug.

Key takeaways:

  • Subagents reduce peak context, not total cost. Expect more total tokens and more calls.
  • A subagent's brief is a contract: objective, inputs, output schema, tools, boundaries.
  • Skills are progressive disclosure for procedures: metadata always, body on activation, files on demand.
  • Code mode keeps intermediate data out of the model's context, and makes sandboxing non-negotiable.
  • Decompose for isolation, parallelism or scale; never for elegance.

Pro lesson

The rest of this lesson is in Pro.

The mental model, worked example, field note, failure table, exercise and self-check, with the voice tutor.

  • Every stage and specialisation, in full
  • Every lab and every role project
  • Halden weeks 2–10, on your record
  • Every drill, live in the playground
  • All solutions, plus the server judge
  • Lab Assistant and every Teach with AI