What is working context in AI agents?
Working context is the prompt an AI agent's model actually receives on a single call, rebuilt each time from durable state such as the session log, memory and artifacts, rather than kept as one growing transcript.
The simplest agents send the model the whole conversation so far, every time. That transcript is both the storage and the prompt. Working context separates the two: everything is stored durably, and for each call the harness builds a view containing only what that call needs.
Google's "Architecting efficient context-aware multi-agent framework for production" (2025-12-04, Hangfei Lin) states the idea directly: context is a compiled view over a richer stateful system.
Google's three principles
Separate storage from presentation
Durable state lives in sessions, memory and artifacts. The working context is a per-call view, so storage schemas and prompt formats can change independently.
Explicit transformations
The view is built by an ordered pipeline of processors, each building on the previous one. ADK's named processors include instructions, identity, contents and context caching.
Scope by default
Each model call and each sub-agent sees the minimum context it needs, and has to reach for more through tools.
What goes into a working context
Google lists the ingredients as instructions, identity, selected history, tool outputs, optional memory results and references to artifacts. The contents processor picks events from the session, drops partial events and framework noise, and turns the rest into role-tagged messages.
Order matters for cost. Stable material, such as system instructions, identity and long-lived summaries, goes at the front so the prompt cache prefix stays valid. Variable material, such as the latest turn and new tool outputs, goes at the end.
Working context in multi-agent systems
Scoping is where the idea earns its keep. In Google's agents-as-tools mode, a called agent sees only focused instructions and the artifacts it needs, with no history. In agent transfer, the sub-agent inherits a view over the session, and prior messages from other agents are re-cast so the new agent does not mistake them for its own.
Where it fails
A processor drops what mattered
Filtering and compaction are deliberate losses. If a constraint is filtered out, the model never sees it, and the bug only shows in the compiled prompt.
Invisible prompts
When the prompt is assembled at run time, nobody reads it by default. Logging the compiled view per call is the only way to debug what the model saw.
Cache churn
Putting variable content near the front invalidates the cached prefix on every call.
How Motiontic's engineers apply it
Motiontic's engineers keep the full session log as the source of truth and treat the prompt as a build output, logged per call and checked in evals. Changes to the pipeline, such as a new filter or a different history window, are scored against the same eval set before they ship.
Session compared with working context
| Session | Working context | |
|---|---|---|
| Role | Storage: the ground truth | Presentation: what one call sees |
| Lifetime | Durable across calls and restarts | Rebuilt for every call |
| Contents | Every message, tool call, result and error | A selected, transformed subset plus instructions |
| Size | Grows without limit | Kept within the attention budget |
| Changed by | Appending events | Processors, filters, compaction |
Common questions
What is working context in an AI agent?
It is the exact set of tokens sent to the model on one call, assembled from stored state such as the session log, memory and artifacts, rather than the full raw history.
What is the difference between a session and working context?
The session is the durable record of everything that happened. The working context is the per-call view built from it, which includes only what that call needs.
Why rebuild the context on every call?
It keeps each prompt small and relevant, lets different agents see different scopes of the same state, and keeps a stable prefix for prompt caching.
Related
Session (AI agents)
The durable log of a run, kept outside the window, that every prompt is built from.
Context engineering
Curating everything in the model's view, not just the wording of the prompt.
Prompt caching
Paying less for the part of the prompt that does not change between calls.
Narrative casting
Show the next agent what another agent did, labelled as someone else's work.
AI agent development
Agents that do real work for users, with the evals, traces and guardrails to keep them in production.
Running agents that have to hold up?
Describe the agent, the systems it touches and what it must never get wrong. The first call is with a lab engineer, who will say plainly whether it is ready for production, and whether Motiontic is the right team.