85 agentic tools audited for security incidents · Talk to the lab →
MotionticBook a call
Glossary

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 compared with working context
SessionWorking context
RoleStorage: the ground truthPresentation: what one call sees
LifetimeDurable across calls and restartsRebuilt for every call
ContentsEvery message, tool call, result and errorA selected, transformed subset plus instructions
SizeGrows without limitKept within the attention budget
Changed byAppending eventsProcessors, 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.

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.