Anthropic: Effective context engineering for AI agents
Primary guidance on history, state, tools, external data, and maintaining useful context over time.
Compute College
Separate recent messages, durable facts, task state, and retrieved knowledge in a long-running AI workflow.
Conversation history is the sequence of recent messages. Task state records what a workflow has completed, what remains, and which decisions or tools are active. Durable memory stores facts or preferences that should survive a session. Retrieved knowledge comes from an external source for the current decision. Keeping these categories separate helps the application decide what to include, summarize, expire, or verify.
Memory trick: History is what was said. State is what is happening. Memory is what should persist. Retrieval is what is true enough for this decision.
Appending every message forever increases token cost and can preserve outdated or contradictory information. A memory system can also create privacy, access, and deletion obligations. Good state management makes a workflow shorter and more reliable by carrying forward the decisions that matter rather than the entire transcript.
A support assistant stores the current ticket ID and unresolved action as task state, keeps the last few user messages for conversational reference, retrieves the current account policy for each decision, and stores a user preference only after the product explicitly allows it. It does not copy every tool response into permanent memory.
Example figures are illustrative calculations, not current quoted market prices.
Current example
Anthropic’s context-engineering guidance describes message history, tools, external data, and agent state as parts of the information environment. This lesson applies that distinction to memory design and the cost of carrying state across requests.
Primary guidance on history, state, tools, external data, and maintaining useful context over time.
Source discipline: the reference explains the concept or method; it is not a substitute for measuring a production workload under its actual provider, model, and data conditions.
An append-only transcript is not reliable memory. It is not a verified database, and old user statements may no longer be true or authorized to reuse.
Practical takeaway
For one workflow, draw four stores: recent history, task state, durable memory, and retrieved knowledge. Define who can write each store, how entries expire, how they are verified, and what enters the model context for each step.
Decision check: can the system resume the task with the necessary state without replaying every prior message or trusting an unverified old fact?
Compute College track
Step 16 of 18: Conversation history state and memory