Context engineering & multi-agent systems
Here's the single most important skill in agent engineering, and it follows directly from Chapter 1: because the model's only memory is its context window, deciding what goes into that window each turn is the whole game. Prompt engineering is a subset of this. The discipline has a name — context engineering — and it's also the reason multi-agent systems exist.
1 · Prompt engineering vs context engineering
Prompt engineering is phrasing the question well. Context engineering is the broader craft of curating the entire set of tokens present at inference — treating that finite window as a scarce budget and spending it on the smallest set of high-signal tokens. Every turn, the window is re-assembled from competing claims on that budget:
2 · The four moves for managing context
A powerful modern move is just-in-time retrieval: keep lightweight identifiers (file paths, links, queries) in the window and load the actual data only when needed — like a human using an index instead of memorizing everything.
3 · Why you can't just stuff the window
Dumping everything in backfires, in named ways: context poisoning (a wrong fact gets reused and compounds), distraction (over-reliance on history), confusion (irrelevant tools/docs), and clash (contradictory info). Combine that with "lost in the middle" (Chapter 1) and the guidance is concrete: aim for 60–80% utilization and prefer rolling summarization over raw accumulation.
4 · When to reach for multiple agents
Multi-agent systems are the isolate move taken to its conclusion: a lead/orchestrator agent decomposes a task and spawns specialized workers that run in parallel — each with its own clean window — returning only a condensed 1,000–2,000-token summary. The detailed exploration stays isolated; only the distilled result comes back.
Anthropic's multi-agent researcher beat a single agent by >90% on research tasks, and token usage explained ~80% of the performance variance — but it burns roughly 15× the tokens of a chat. Use multiple agents for exactly three reasons: protect context, parallelize a wide search, or genuine specialization. Decompose along context boundaries, not task type (splitting by task creates a lossy "telephone game").
Reliability comes from how you wire agents, not how smart each is: decentralized independent agents amplified errors 17.2× vs a single agent; centralized orchestration held it to 4.4×; and an external adversarial inspector recovered 96.4% of faults.
Recap
- The window is the model's whole memory — curating it each turn is the core skill.
- Four moves: write, select, compress, isolate; target 60–80% fill.
- Multi-agent = isolate at scale: big wins, ~15× tokens, orchestrate centrally, add a verifier.
The most important "select" tool is retrieval. Next we build RAG end-to-end — and you'll run a live vector search that fetches the right context for a question.