Context Engineering
The discipline of deciding exactly what information goes into an AI agent's context window on each turn—system prompt, tool definitions, retrieved documents, prior messages, memory, and skills—and what stays out. Context engineering replaces 'prompt engineering' as the dominant skill for production agents: in long-running agents the prompt is fixed, and quality is determined by what context is curated for each step. Done badly, context engineering causes hallucination, cost overruns, and lost-in-the-middle failures.
Example
A legal agent reviewing a contract used to stuff the entire 80-page contract plus 30 similar past contracts into context (190K tokens, $1.50 per review, lost-in-the-middle errors on key clauses). After applying context engineering—chunking the target contract, retrieving only the 5 most similar past clauses for each section, and pruning prior conversation turns—context drops to 35K tokens, cost falls to $0.18, and clause-extraction accuracy rises from 89% to 96%.
Frequently asked questions
- What's the difference between context engineering and prompt engineering?
- Prompt engineering is about wording instructions well: how you ask the model to behave. Context engineering is about which information is in front of the model at all: instructions plus tools plus retrieved data plus memory. For one-shot prompts, prompt engineering dominates. For multi-turn agents, context engineering dominates—the system prompt is usually fixed, and what changes (and matters) is the surrounding context.