Anthropic

Effective context engineering for AI agents

Sep 29, 2025
Effective context engineering for AI agents
SummaryAI, from the source post

This post introduces 'context engineering' as the evolution of prompt engineering for AI agents. It details strategies for curating the optimal set of tokens for LLM inference, addressing 'context rot' caused by transformer architecture's quadratic attention complexity and training data biases. Key contributions include: 1. Guiding principles for minimal, high-signal context. 2. Recommendations for system prompt design (altitude, organization, XML tagging). 3. Best practices for tool design (efficiency, clarity, minimal overlap). 4. Emphasis on curated, canonical few-shot examples over exhaustive lists. 5. Introduction of 'just-in-time' context retrieval for agents, using lightweight identifiers to dynamically load data at runtime (e.g., Claude Code's use of file paths and targeted queries). This contrasts with pre-inference retrieval and mirrors human cognition's on-demand information access. The post also highlights how metadata of references (folder hierarchy, naming conventions) provides crucial signals for agents.

More from the AI Code Generation and Software Engineering Agents trail