Skip to content
← Articles

Context engineering for AI agents: four things to check

Revised 2 min read

By Jake Bauman

ai-agents / context-engineering / production-ai / build-notes

Context Engineering in gold typography on charcoal

A better prompt can help an agent. It cannot make outdated documents current, give a tool the right permissions, or recover a customer requirement that never reached the model. Those are context problems.

By context engineering, I mean choosing what the model sees at each step: instructions, retrieved information, conversation history, and tool responses. Anthropic's agent design guidance describes the model, tools, and feedback loop as parts of a working system. LangChain's 2026 State of Agent Engineering survey also reports that respondents face quality and context-management challenges in production. Survey findings describe those respondents; they do not show that any one context technique fixes the problem.

1. Instructions

Give the agent the task, its authority, examples of acceptable output, and a clear stop condition. Avoid long lists of conflicting rules. If two instructions disagree, resolve the conflict in the source rather than hoping the model will choose the right one.

2. Retrieval

Make the source set specific to the task. A support assistant should retrieve the relevant current policy and order record, then cite or identify the source it used. When retrieval brings back many near-matches, inspect relevance before adding them to the model's context. The model should be able to say when the available evidence is incomplete.

3. Memory

Separate durable preferences from temporary work. A user's standing preference may belong in a persistent profile with consent; an abandoned draft decision should not. Give the agent a way to correct or discard stale memory, and verify that a compacted summary preserves required constraints.

4. Tools

Every tool should have a defined purpose and the least access needed for that purpose. Check the actual result of a tool call, including error cases. A successful model response is not proof that an external action completed.

Run a context audit

For one failing task, record the prompt, retrieved documents, memory, tool definitions, tool responses, and final answer. Ask what information was missing, irrelevant, stale, or contradictory. Change one part, then rerun the same test cases. If quality improves, keep the change and watch for regressions. This is a diagnostic method, not a claim that context engineering always matters more than prompt wording.

A previous version of this article cited an uncited performance example and attributed a slogan to Salesforce without a verifiable source. I removed both. For a small workflow to test these ideas, see the free Growth Agent Starter Kit.

Get the free Starter Kit.

Enter your email to see the download link on this page. Build Notes is optional and has a separate checkbox.

Your files appear here after signup. If email delivery is available, you may also receive your requested file by email. The newsletter is optional. Privacy.

Related reading