Skip to main content
Every agent turn ends in a single model request: one system prompt, the conversation history, and the tool list. This page explains which values the model can see each turn, where they come from, and how to keep a value out of the prompt entirely. For how that request is kept small — the size budgets and compaction policies — see Context size, compaction, and budgets.

At a glance

Before the model reads it, every source of context is shaped: memory and ## Current Context by visibility rules and size limits, conversation history and tool results by compaction, and knowledge-base results by a token budget. Guardrails check what goes into and comes out of each call, but they never see the assembled prompt itself.

What the model sees each turn

Session values reach the system prompt in two ways: through the memory sections an agent declares (## Session Memory, ## Granted Memory, and similar), and through a ## Current Context block. Which values land in ## Current Context depends on the agent’s visibility mode. These values are never shown in ## Current Context, in either mode:
  • Platform identifiers — session, tenant, project, and user IDs — plus raw input and message metadata.
  • The config and env namespaces.
  • Keys that start with an underscore, except the handoff summary.
  • Knowledge-base search results. They reach the model through the search tool call instead — see Knowledge base retrieval.
  • In allow-list mode, values already shown in a memory section. In explicit mode, a declared session value can appear in both a memory section and ## Current Context, so budget for that when sizing prompts.
Tool results are visible only to the agent that produced them. A last_<tool>_result value appears in the prompt of the agent that called the tool — see Store result. After a handoff, the receiving agent does not see it unless it’s listed in pass or referenced directly.

Size limits

Each ## Current Context value is limited to 8,000 characters by default, and the whole block to 24,000. Automatic tool-result values are limited to 4,000 characters. A value over its limit is replaced by a marker object holding a preview of its start. Declared memory sections (## Session Memory and similar) are not size-limited, so keep declared memory small. The full set of default budgets, the voice-profile overrides, and how to diagnose a bloated or truncated prompt in a trace live in Context size, compaction, and budgets.

Keeping a value out of the prompt

To keep a value out of what the model reads:
  • Don’t declare it in MEMORY: and don’t reference it. An allow-list agent never sees an undeclared value it doesn’t reference.
  • If a tool needs the value, declare it as a runtime-supplied parameter the model can’t see.
  • For tool results, use the tool’s MODEL_CONTEXT to pass the model only the fields it needs — see MODEL_CONTEXT on a tool result.

Referencing values in prompt text

Use {{customer_tier}} in GOAL, not {{context.customer_tier}}. In GOAL, PERSONA, and LIMITATIONS, the context. form makes the value visible in ## Current Context, but the placeholder itself is not filled in — only the plain {{var}} form interpolates. If a referenced value is unset, the literal {{customer_tier}} text stays in the prompt. Word the sentence so an empty value still reads sensibly, or set a default with INITIAL:.
There is no per-entry setting to hide one declared memory value from the model while leaving the rest of a MEMORY: SESSION: block visible. Use the options in Keeping a value out of the prompt above instead.
{{config.*}} and {{env.*}} values are left out of ## Current Context automatically, but that protection doesn’t extend to a {{env.KEY}} reference written directly into GOAL, PERSONA, LIMITATIONS, SYSTEM_PROMPT:, or RESPOND — the resolved value is sent as plain prompt text, same as any other reference. Referencing environment variables in those fields is supported and often useful, but only for a variable that isn’t marked Secret. A secret variable referenced in a model-visible or customer-visible field defeats the point of marking it secret — the Secret flag only masks its value in the Studio UI.

Related articles: