Who picks the next step: code, or the model.
A subagent is a separate call with a context window of its own: it gets one task and returns only its answer. Orchestration decides the order of steps, fixed in code or chosen by the model.
new words
- Subagent
- A separate call with its own context window and its own tools, given one task. Its answer comes back; its working stays out.
- Workflow
- Steps in an order fixed by code. The same path every time: predictable and cheap.
- Agentic
- The model chooses each next step. For work whose path is not known in advance.
- Guardrails
- Checks around the loop: which tools may run, what shape a call must have, and a person's yes before an act that cannot be undone.
- Sandbox
- A closed place where commands run without reaching the rest of the computer.
the lesson
A long task fills one context window with everything read on the way. A subagent keeps that out. The main loop gives it one task; it works in its own context window and returns only its answer. Reading fifty files to find one list costs the main context the list, not the fifty files. Claude Code has subagents built in, each with its own context window and its own tools.
Orchestration is who picks the order of the steps:
- a workflow: code fixes the order, step 1, then 2, then 3, the same every time;
- agentic: the model looks at each result and picks the next step.
Use a workflow when you know the path, and let the model choose when you do not. Most real systems mix the two: code for the steps that never change, the model for the judgment between them.
Guardrails sit around the loop, in code, or as a second model that judges each step:
- an allowlist: the tools this loop may call, and no others;
- a shape check: a call with the wrong shape is refused before it runs;
- a sandbox: commands run where they cannot reach the rest of the computer;
- human in the loop: a person's yes before a send, a delete or a release (Claude basics, lesson 6).
A guardrail in code holds every time. A rule in the context window only makes the right step likelier (lesson 2).
try it
In a Claude Code window, type this and press Enter:
Use a subagent to find every file in this folder that mentions "invoice". Give me only the list of paths.
you should see
- Claude starts a subagent and waits for it to finish.
- Only the list comes back. Type
/context: the messages grew by the list, not by the files the subagent read.