Paths Subjects Questions Quizzes Pricing Search

Context Engineering for Agents

Why prompt-level context tricks stop working past turn 20, and what replaces them: tool design, compaction, sub-agent isolation, and just-in-time retrieval

Overview Read

Context Engineering for Agents

Every technique earlier in this track — the system/user split, few-shot examples, chain-of-thought, structured outputs, prompt caching — is built around a prompt that gets authored once and evaluated a small, predictable number of times. Even a multi-turn chat session usually stays in the tens of turns, with a human in the loop periodically resetting the topic. An agent breaks that assumption structurally, not incrementally. It runs a loop — observe, decide, act, observe the result, decide again — and every iteration of that loop appends to the same context window rather than starting fresh. By turn 50, the context is not a prompt you wrote; it's an accumulated transcript of everything the agent has read, run, and said, most of which you did not author and cannot fully predict in advance.

This changes what "engineering the context" means. A single-turn prompt has one failure surface: did you write it well. An agent's context has a growth process with its own failure modes — tool outputs of wildly unpredictable size landing in the transcript verbatim, instructions from turn 1 competing for attention with 40,000 tokens of turn 2-through-49 noise, and a hard ceiling (the context window) that a naive "just keep appending" strategy will eventually hit, if attention dilution and rising per-call cost don't degrade the agent first. None of the single-turn techniques from earlier in this track stop being true — a good system prompt is still a good system prompt — but none of them are sufficient once the thing consuming the context is a loop instead of a call.

This subject is the synthesizing capstone for the track: it takes prompt engineering, prompt evaluation, and prompt-caching cost discipline and asks what each looks like under compounding repetition. It leans on Claude Code throughout as the concrete, inspectable worked example — not because the ideas are Claude Code–specific, but because a real coding agent making real tool calls over a real long session is the clearest place to see context engineering under load. The subject after this one, claude-md-and-memory, picks up exactly where this one hands off: the persistent, versioned, repo-level instruction file that gives an agent's context a stable floor across the very sessions this subject shows growing and getting compacted.


Pro content

Sign up free, then start a 14-day Pro trial — no card needed.

We use cookies for product analytics to improve OmniAtlas. See our Privacy Policy.