JOURNAL / AGENT SYSTEM DESIGN

An agent can only use
the context it receives.

A good instruction matters. So does every source, tool result, decision, and piece of history placed around it. The work is choosing what the agent needs for this step—and what it should leave behind.

Rows of books arranged on shelves in a dark library.CONTEXT / INFORMATION DESIGN / SYMPLOKA
MORE INFORMATION IS NOT ALWAYS MORE USEFUL

Give the next decision a clear view.

A system can search a vast collection and still work from a small, relevant brief. Select, label, and refresh the evidence as the task changes.

01 / LOOK BEYOND THE PROMPT

The prompt asks. The full context equips.

A prompt is the instruction: what to do, under which constraints, and in what form. The model’s context is the material it receives for a particular call. That may include the prompt, conversation history, tool definitions and results, retrieved documents, and a summary of earlier work.

“Context engineering” is a useful name for the work of curating that changing input. It shifts the design question from “What wording should we add?” to “What information should be available for this decision, and how will it stay current?”

The distinction matters most in multi-step systems. A request can be clear while the agent is missing the current policy, the result of its last search, or the reason an earlier route was rejected.

Start with the prompt itself ↗
02 / ASSEMBLE FOR THIS STEP

Bring together five things the next decision depends on.

GoalThe immediate task and the condition that tells the system it is done.
RulesStable instructions, allowed sources, output requirements, and actions that need approval.
EvidenceThe smallest set of relevant passages, each labelled with its source, date, and scope.
Working stateDecisions made, actions already tried, results received, and unresolved questions.
ToolsOnly the functions needed for this task, with their actual limits and permissions.
UncertaintyWhat is missing, conflicting, stale, or not yet verified—and when to ask for help.

Not every call needs every layer. A one-shot summary might need a source and a requested format. An agent deciding whether to run another check also needs the last result, the remaining uncertainty, and a clear stop condition.

03 / RETRIEVE, THEN CURATE

Search the collection; pass forward the useful evidence.

Retrieval can find material outside the model’s current input. Context design decides which results deserve space in it. Returning every matching document or replaying an entire conversation may increase noise without improving the decision.

  • Ask a specific question that matches the next action or decision.
  • Keep source names, dates, and section references attached to relevant passages.
  • Filter by the user’s permissions before exposing retrieved content to the model.
  • Check whether a newer source supersedes an older one; keep genuine conflicts visible.
  • Load more evidence when the first set is incomplete, instead of guessing from a thin result.

This is related to, but broader than, RAG. Retrieval is one way to add evidence. The agent also needs instructions, tool results, and a reliable account of its own progress. See where retrieval and fine-tuning fit ↗

04 / KEEP THE STATE USEFUL

Carry forward the work, not every line of the transcript.

Long-running agents accumulate messages, tool output, retries, and details that later become outdated. When the full history no longer helps with the next step, make a compact handoff that preserves the current goal, established facts, decisions, source references, failed attempts, and open questions.

Goal for this step: [the next decision or action]
Current facts: [fact] — [source and date]
Decisions already made: [decision and reason]
Actions and results: [what was tried; what happened]
Still unknown: [question, conflict, or missing source]
Available tools: [what this run may do]
Stop or ask when: [condition]

This is a handoff shape, not a required format. Keep durable memory separate from the working set assembled for each call. When using an API’s compaction feature, follow that provider’s state and replay rules; a compacted context is not a substitute for retaining the sources behind important claims.

Explore long-term AI memory and its trade-offs ↗
05 / TEST THE CONTEXT

Test what the agent receives, not only what it answers.

A long context window does not by itself show that a model can find and apply every relevant detail. In a 2024 study, researchers found that several evaluated models performed worse on some long-context tasks when the relevant passage appeared in the middle rather than near an edge. The result describes the models and tests in that paper; current systems and real workflows need their own evaluation. For the mechanics of tokenization and context limits, read the guide to tokens and context windows ↗.

Build a small test set from real decisions and vary the conditions around them:

PositionMove the key evidence earlier, later, and into the middle of a long input.
FreshnessInclude an outdated source beside the current one and check which the system uses.
ConflictPresent two sources that disagree and verify that the conflict is surfaced.
AbsenceRemove the needed evidence and check whether the system asks, searches, or abstains.
HistoryExtend the task across turns and verify that decisions and constraints survive a handoff.
PermissionsMake an otherwise relevant source unavailable and check that access rules still hold.

Track task success, evidence quality, incorrect or unsupported claims, tool choices, review effort, context size, latency, and cost. The right measures depend on the task. A good answer on one short example does not establish dependable performance across longer runs.

For a focused test plan across context lengths, evidence positions, languages, and missing information, see how to evaluate a long context window ↗.

Build a repeatable agent evaluation ↗
06 / ENFORCE THE BOUNDARY IN SOFTWARE

Context can guide a tool call. It cannot authorize one.

Documents, web pages, and tool results may contain hostile or misleading instructions. Treat retrieved content as data with provenance, and enforce access and approval in the tools and application. A paragraph in the model’s context does not replace a permission check.

For each action, expose only the required capability, validate its arguments, and check the caller’s authority at the point the action runs. If the action has a consequential side effect, pause at the human review boundary your product requires.

Keep agent permissions at the tool boundary ↗
RESEARCH & ENGINEERING GUIDANCEAnthropic: Effective context engineering for AI agents ↗OpenAI API: Compaction for long-running conversations ↗Liu et al., Lost in the Middle: How Language Models Use Long Contexts (TACL 2024) ↗