> ## Documentation Index
> Fetch the complete documentation index at: https://koreai.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# How a turn is built

Every agent turn ends in one model request. The request holds a system prompt, the conversation history, and the tool list. This page explains which values the model sees each turn, where they come from, and how to keep a value out of the prompt. To learn how the platform keeps the request small, see [Context size, compaction, and budgets](https://koreai.mintlify.site/agent-platform/context-compaction.md).

## At a glance

The platform shapes each source of context before the model reads it:

* Memory and `## Current Context`: visibility rules and size limits.
* Conversation history and tool results: compaction.
* Knowledge-base results: a token budget.

[Guardrails](https://koreai.mintlify.site/agent-platform/abl/reference/guardrails.md#application-points) check content at set points: user input, the agent's reply, tool input, tool output, and handoff. A tool-output guardrail runs before the result enters the model context.

## What the model sees each turn

Session values reach the system prompt in two ways:

* Through the memory sections an agent declares, such as `## Session Memory` and `## Granted Memory`.
* Through a `## Current Context` block.

The agent's visibility mode decides which values go into `## Current Context`.

| Mode | When it applies | What goes into `## Current Context` |
| - | - | - |
| Allow-list (default) | The agent does not declare `BEHAVIOR:` with `role:` | Values that the agent's own `GOAL`, `PERSONA`, `LIMITATIONS`, or `SYSTEM_PROMPT` reference. Values passed in on handoff. Results of the agent's own tools. Values granted by `FLOW` steps. If any of those texts uses `{{context}}`, every session value is admitted. |
| Explicit | The agent declares `BEHAVIOR:` with `role: router`, `orchestrator`, or `assistant` | Only declared session memory, execution-tree memory, memory granted on handoff, and interaction details such as language, locale, and timezone. Undeclared and persistent values never appear. |

In both modes, these values never appear in `## Current Context`:

* Platform identifiers (session, tenant, project, and user IDs), raw input, and message metadata.
* The `config`, `env`, `session`, and `intent` namespaces.
* Keys that start with `last_search_kb_`, `last_browse_kb_`, or `profile:`.
* Keys that start with an underscore, except the handoff summary.
* Knowledge-base search results. They reach the model through the search tool call. See [Knowledge base retrieval](https://koreai.mintlify.site/agent-platform/knowledge.md#how-the-platform-searches).

Two more rules depend on the mode:

* **Allow-list mode:** a value already shown in a memory section does not repeat in `## Current Context`.
* **Explicit mode:** a declared session value can appear in both a memory section and `## Current Context`. Plan for this when you size 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](https://koreai.mintlify.site/agent-platform/abl/reference/tools.md#store-result). After a handoff, the receiving agent does not see the value unless you list it in `pass` or reference it directly.

When [PII protection](https://koreai.mintlify.site/agent-platform/pii-protection.md) is on for the project, the platform redacts protected values in `## Current Context` before the model reads them. The raw values stay available to tools.

### Size limits

| Item | Default limit |
| - | - |
| One `## Current Context` value | 8,000 characters |
| The whole `## Current Context` block | 24,000 characters |
| One automatic tool-result value (`last_<tool>_result`) | 4,000 characters |
| Declared memory sections (`## Session Memory` and similar) | No limit |

What happens when a limit is reached:

* **A value is too large:** the platform replaces it with a marker object that holds a preview of its start.
* **The block is too large:** the platform leaves out the remaining values and lists their names.
* **A tool result is cut:** the prompt adds a `## Prior Tool Result Context` note. The note tells the model to call a read or search tool again if it needs the missing details. It must not repeat a tool that changes data unless the user asks again.

Keep declared memory small, because nothing limits it. You can change the limits for a project or an agent. Voice agents use lower defaults. For all default budgets and for steps to diagnose a bloated or cut prompt in a trace, see [Context size, compaction, and budgets](https://koreai.mintlify.site/agent-platform/context-compaction.md).

### Keeping a value out of the prompt

Choose the option that fits the value:

* **A session or persistent memory value:** set `MODEL_VISIBLE: false` on the entry. The model no longer sees it in automatic context, but expressions, conditions, and tools can still read it.
* **A value no agent needs to declare:** do not declare it in `MEMORY:` and do not reference it. An allow-list agent never sees an undeclared value that it does not reference.
* **A value a tool needs:** declare it as a runtime-supplied parameter that the model cannot see.
* **A tool result:** use the tool's `MODEL_CONTEXT` to pass the model only the fields it needs. See [MODEL\_CONTEXT on a tool result](https://koreai.mintlify.site/agent-platform/abl/reference/tools.md#model_context-on-a-tool-result).

This example hides one memory value and passes a hidden parameter to a tool:

```yaml theme={null}
MEMORY:
  SESSION:
    - NAME: risk_score
      TYPE: number
      MODEL_VISIBLE: false
    - NAME: selected_category
      TYPE: string

TOOLS:
  use_runtime_state(runtime_state: string, operation: string) -> object
    params:
      runtime_state:
        default_source: runtime
        visibility_model: false
        visibility_trace: false
    context_access:
      read: [runtime_state]
```

> [!WARNING]
>
> `MODEL_VISIBLE: false` controls automatic placement only. The value can still reach the model through an explicit reference such as `{{risk_score}}` in `GOAL`, through a tool result, or through conversation history. It also does not carry across a handoff: the receiving agent must declare its own `MODEL_VISIBLE: false`. For the full rules, see [Model-visible session and persistent values](https://koreai.mintlify.site/agent-platform/abl/reference/memory-and-constraints.md#model-visible-session-and-persistent-values).

### Referencing values in prompt text

Use `{{customer_tier}}` in `GOAL`, `PERSONA`, `LIMITATIONS`, or `SYSTEM_PROMPT:`. The platform fills in the value and, in allow-list mode, admits it to `## Current Context`. The form `{{context.customer_tier}}` works the same way. Use the shorter form.

If a referenced value is not set, the literal `{{customer_tier}}` text stays in the prompt. Write the sentence so it still reads well with an empty value, or set a default with `INITIAL:`.

> [!WARNING]
>
> The platform leaves `{{config.*}}` and `{{env.*}}` values out of `## Current Context`. This protection does not apply to a `{{env.KEY}}` reference that you write directly in `GOAL`, `PERSONA`, `LIMITATIONS`, `SYSTEM_PROMPT:`, or `RESPOND`. The platform sends the resolved value as plain prompt text. [Referencing environment variables](https://koreai.mintlify.site/agent-platform/administration/workspace-and-team.md#reference-environment-variables) in those fields is supported. Use it only for a variable that is not marked **Secret**. The Secret flag only masks the value in the Studio UI. A secret variable in a model-visible or customer-visible field is not protected.

### What the model doesn't get

| Gap | What goes wrong | What to do |
| - | - | - |
| Today's date and time | The model can't work out "tomorrow" or "within 24 hours". | Supply the date from a tool result or a session value. Test a relative-date question. |
| `LIMITATIONS` in an orchestrator | The model never sees them. | Write the rule in `GOAL` or `INSTRUCTIONS`. |
| A changing `{{value}}` in `GOAL` or `PERSONA` | The provider's cached prompt is lost on every call. | Keep changing values in memory. |

## All prompt and context settings

Use this table to find the setting that changes what the model reads on a turn. It lists where each setting lives and its default. Follow the link for syntax and examples. It is not a list of every ABL setting. For the `EXECUTION:` block, see [Agent declaration](https://koreai.mintlify.site/agent-platform/abl/reference/agent-declaration.md#execution-configuration).

Settings take effect in new conversations once saved, or once published and deployed for production channels. Project settings take effect on the next turn unless noted.

| Setting | Where | Default | Changes |
| - | - | - | - |
| [`BEHAVIOR: role:`](https://koreai.mintlify.site/agent-platform/abl/reference/multi-agent-and-supervisor#behavior-settings) | Agent ABL | Not set. The prompt template is inferred from the agent type, and the implicit memory sections stay hidden | Which values reach `## Current Context`, and which prompt template is used. Values: `router`, `orchestrator`, `assistant` -- see [How a turn is built](https://koreai.mintlify.site/agent-platform/context-and-prompts.md#what-the-model-sees-each-turn) |
| `GOAL`, `PERSONA`, `LIMITATIONS`, `{{refs}}` | Agent ABL | -- | The identity section; references also make values visible in `## Current Context` |
| `SYSTEM_PROMPT:` | Agent ABL | Catalog template | Replaces the template. Runtime sections are still appended. `LIMITATIONS` still reach the model: use `{{limitations}}` to place them, or the runtime adds them after the prompt text |
| [`MEMORY: SESSION:`](https://koreai.mintlify.site/agent-platform/memory-and-state#session-memory) | Agent ABL | -- | `## Session Memory` content, and what the model may write |
| [`MEMORY: persistent:`, `remember:`, `recall:`](https://koreai.mintlify.site/agent-platform/memory-and-state#persistent-memory) | Agent ABL | -- | Values loaded into the session; `recall: INSTRUCTION` lines in the prompt |
| [`HANDOFF … CONTEXT:`](https://koreai.mintlify.site/agent-platform/abl/reference/multi-agent-and-supervisor#handoff-context) (`pass`, `summary`, `history`, `memory_grants`) | Agent ABL | `history: full` | The receiving agent's history, context, and granted memory |
| [`DELEGATE … INPUT` / `PURPOSE`](https://koreai.mintlify.site/agent-platform/abl/reference/multi-agent-and-supervisor#delegate) | Agent ABL | -- | The only context a delegate gets |
| `CONVERSATION:` | Agent ABL | -- | `## Conversation Behavior` lines; listening and barge-in behavior on voice |
| [`EXECUTION.inline_gather`](https://koreai.mintlify.site/agent-platform/abl/reference/agent-declaration#configuration-properties) | Agent ABL | `false` (on in the voice profile) | `## Information Collection` instead of the `GATHER` list |
| [`EXECUTION.compaction.*`](https://koreai.mintlify.site/agent-platform/context-compaction#size-limits-and-compaction) | Agent ABL | See [Context size, compaction, and budgets](https://koreai.mintlify.site/agent-platform/context-compaction.md) | Tool results, earlier turns, and `## Current Context` budgets |
| [`EXECUTION.prompt_version`](https://koreai.mintlify.site/agent-platform/abl/reference/agent-declaration#provider-prompt-caching) | Agent ABL; project runtime config `prompt_version` | Agent value, then project value, then `v1`. New projects start with `v2` | How the Runtime builds the prompt. `v2` adds a cache layout so supported providers can reuse the fixed part of the prompt |
| [`EXECUTION.prompt_cache_key`, `prompt_cache_retention`](https://koreai.mintlify.site/agent-platform/abl/reference/agent-declaration#provider-prompt-caching) | Agent ABL | Not set | The prompt-cache key and retention sent to OpenAI and Azure OpenAI. Other providers ignore them |
| `EXECUTION.models.summarization` | Agent ABL | Project tier | The model used for tool-result summaries |
| [`EXECUTION.voice.instructions`](https://koreai.mintlify.site/agent-platform/abl/reference/agent-declaration#voice-instructions-and-grounding-guards) | Agent ABL | -- | `## Voice Delivery Instructions` and voice formatting rules |
| `EXECUTION.guardrail_builtins` | Agent ABL | `false` | Whether a guardrail check can read `content`, `session_state`, and `tool_results` |
| [Tool `MODEL_CONTEXT`](https://koreai.mintlify.site/agent-platform/abl/reference/tools#model_context-on-a-tool-result) (`FIELDS` / `TEMPLATE`) | Tool ABL | -- | What the model sees of a tool result, now and later |
| [Response `MODEL_CONTEXT`](https://koreai.mintlify.site/agent-platform/abl/reference/flow#model_context-on-a-response) | Hook `RESPOND`, `COMPLETE`, `FLOW` step | -- | What the history records for a rich response |
| [Tool `compaction:`](https://koreai.mintlify.site/agent-platform/abl/reference/tools#result-compaction) (`essential_fields`, `summary_timeout_ms`, `max_search_tokens`) | Tool ABL | -- | Per-tool compaction, and the knowledge-base token budget |
| [Tool `store_result`](https://koreai.mintlify.site/agent-platform/abl/reference/tools#store-result) | Tool ABL | `true`; `false` once the tool has `on_result: SET` | Whether `last_<tool>_result` is kept |
| Tool param `default_source`, `visibility_model`, `visibility_trace` | Tool ABL | Visible | Hides a runtime-supplied value from the model and from traces |
| [KB `search_instructions`, `kb_name`, `description`](https://koreai.mintlify.site/agent-platform/knowledge#tool-level-search-settings) | Tool ABL / KB settings | -- | How and when the model searches |
| [Index Top K, similarity threshold, keyword weight](https://koreai.mintlify.site/agent-platform/knowledge.md#additional-settings) | Studio KB index settings | 10, 0.2, 0.5 (keyword weight when unset) | How many chunks come back |
| Citations | Studio KB citation settings | On by default, per index | Citation instructions added to the prompt |
| [`GUARDRAILS:`](https://koreai.mintlify.site/agent-platform/abl/reference/guardrails) | Agent ABL | -- | Per-agent checks -- see [Guardrail checkpoints](https://koreai.mintlify.site/agent-platform/safety-and-guardrails.md#guardrail-checkpoints) |
| Guardrail policies, providers, fail mode | Studio Govern → Guardrails | Fail open | Project and tenant checks; `## Current Policy` |
| [Project compaction](https://koreai.mintlify.site/agent-platform/context-compaction.md#where-to-set-compaction-policies) | Project runtime config (API or import) | Platform defaults | Project-wide budgets; resolved once per conversation |
| [Voice latency profile and overrides](https://koreai.mintlify.site/agent-platform/administration/general-settings.md#voice-low-latency-profile) | Studio Settings → Runtime Config | Auto-seeded for voice | Tighter budgets, fast model tier, reasoning off, inline gather on |
| Filler (`filler`) | Project runtime config | Profile defaults | Voice filler behavior and the status-update instruction |
| [PII redaction](https://koreai.mintlify.site/agent-platform/administration/general-settings.md#pii-redaction) (`pii_redaction`) | Project runtime config | On | Tokens in place of personal data in the prompt and in traces. Built-in detectors start off on new projects. |
| [Multi-intent](https://koreai.mintlify.site/agent-platform/administration/general-settings.md#multi-intent-recognition) (`multi_intent`) | Project runtime config | -- | Multi-request routing and task sections |
| Language detection (`language_detection`) | Project runtime config | -- | The language that `SET_INTERACTION_LANGUAGE` can apply, and the language an escalation hands off in |
| [Cross-channel recall](https://koreai.mintlify.site/agent-platform/administration/agent-behavior-settings.md#omnichannel) | Project omnichannel settings | Per project | `## Previous Conversations (Other Channels)`: up to 30 messages of 500 characters each |

> [!NOTE]
>
> Fixed by the platform, not configurable: the order of prompt sections, the Customer Output Contract, the tool-history marker, the realtime voice handoff history-replay limits, and the absolute limits on `## Current Context` (40,000 characters per value, 100,000 for the whole block). The defaults under these limits are 8,000 and 24,000 characters, and you can change them with `compaction.prompt_context`.

***

**Related articles:**

* [Context size, compaction, and budgets](https://koreai.mintlify.site/agent-platform/context-compaction.md) -- default size budgets, where context grows, and how to debug a bloated prompt from a trace.
* [Agent declaration](https://koreai.mintlify.site/agent-platform/abl/reference/agent-declaration.md) -- `GOAL`, `PERSONA`, `LIMITATIONS`, and `SYSTEM_PROMPT:` syntax.
* [Memory and state](https://koreai.mintlify.site/agent-platform/memory-and-state.md) -- declaring session and persistent memory.
* [Tools](https://koreai.mintlify.site/agent-platform/abl/reference/tools.md) -- shaping and storing tool results.
* [Minimize agent context](https://koreai.mintlify.site/agent-platform/abl/how-to/minimize-agent-context) -- limit what crosses a handoff.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.