Graine AI

Context

What the agent reads on every turn and in what order, which source wins when two disagree, measuring it or keeping long conversations within a budget, what the agent knew in each conversation, what an agent reads over time, and the tools described in every request.

On every turn, the agent's model reads one request put together from several sources: your instructions, what the agent knows about the person, the screen they are on, the conversation so far and what the agent's tools returned. Context is how that request is assembled — which sources, in what order and how large — and, when you choose, kept within a budget.

Context never decides what is true about a person; Memory does that. It decides what reaches the model, how much of it, and what was left out — and it measures every request, so you can see what the agent knew in any conversation.

What the agent reads on every turn

ONE REQUEST, IN THE ORDER THE AGENT READS ITWITHIN A BUDGETAgent instructions · your variables · the date and timePast conversations · remembered factsLanguage noteApp screenKnowledge base passagesEarlier conversationThis conversation, with tool resultsThe latest messageNever trimmedinstructions, memory, language note,screen and passagesTrimmed, cheapest loss first1. Older tool results are cleared2. The oldest exchanges are left outNever trimmed, with the latest six exchangesBeside every request: the tools the agent may use, described for the model.

Each part is there only when it applies: memory for an identified person, the screen in your app, passages for an agent with a knowledge base. Dashed parts are the only ones a budget may trim.

SectionWhat it holdsWhen it is there
1Agent instructionsYour prompt, with its variables filled in from your API call, a campaign's contact list or your app — and the date and timeEvery turn
2Past conversationsWhere things stand with the person: at most four short lines from their earlier conversations, and what has worked on that topicMemory on, and the person identified — Memory
3Remembered factsUp to 20 facts about the person, with rules on how to use themThe same
4Language noteThe language to reply inAfter the conversation switches language
5App screenThe screen the person is on, its fields and what is failing, as your app last reported it — read fresh on every turnIn your app, when it reports the screen — Screen context
6Knowledge baseThe passages that best match the person's latest message, looked up again on every turnAgents with a knowledge base
7Earlier conversationUp to the latest 20 messages of a conversation the person is continuingWhen a conversation continues — Conversations continue
8This conversation and Tool resultsEvery message so far, with what each tool returned, in full, in the order it happened — the latest message lastEvery turn
9ToolsThe tools the agent may use, described for the modelAgents with tools — Tools in every request

The names in the second column are the ones Call History uses.

A flow agent builds its request for the step the conversation is on: the flow's Briefing, the step's instructions, the screen, the latest 50 messages and, with a knowledge base, the matching passages. Choosing the next step is a separate request, made by the decision model.

Who wins when sources disagree

Fresh beats remembered, and what was said beats what was inferred. From first to last:

  1. What the person says in this conversation.
  2. What your app shows right now: the screen they are on, and what the agent's tools returned on this turn.
  3. The values sent with the conversation: the variables from your API call, your campaign or your app. Something noted from an earlier conversation never replaces a variable of the same name.
  4. The knowledge base passages found for this turn.
  5. What was noted before: lines from past conversations, what has worked, and remembered facts. They reach the agent with an instruction to go with the current conversation wherever the two disagree.
  6. A continued conversation's earlier messages.

The language a conversation asks for comes before the language remembered for the person.

A budget never touches the top of this list. It clears older tool results first — the agent can call the tool again — and then leaves out the oldest exchanges.

Measure only, or keep within a budget

The setting is in Agent → Context → Keep within a budget. Context is the agent's own section, right after Memory, and a flow agent has it too. From the top, it shows the order the agent reads in, What this agent reads, this setting, Tools in every request, and whether Shorten long conversations is on, with a link to where that is changed: AI Model Settings, or for a flow agent Models in the flow builder.

ChoiceWhat happens
Measure onlyEvery request is measured and shown in Call History. Nothing is left out
Keep within a budgetMeasured, and each request is kept within the budget you set: 2,000 to 200,000 tokens, 12,000 by default
OffNothing is measured or changed
Not setMeasure only for app, web and chat conversations; Off for phone calls

A choice applies to every conversation the agent has, phone calls included: choosing one is how a phone agent opts in. Use the default goes back to not set. Saving is a change to the agent like any other — on a live agent, in a workspace that reviews changes, it goes for approval — and it applies from the next conversation.

What a budget trims first

While a request is over the budget:

  1. Older tool results are cleared. A tool result from before the latest turns is replaced by one line saying it was cleared; the agent can call the tool again if it needs the result. Tool results kept whole sets how many earlier turns keep their results whole, besides the current one: 0 to 10, 2 by default.
  2. The oldest exchanges are left out, a whole exchange at a time — a message from the person with everything that answered it — starting with a continued conversation's earlier messages. The latest six exchanges and the current message always stay, and the agent is told that earlier turns are not shown, so it asks again rather than guessing.

Never left out: the agent's instructions, the date and time, the language note, what the agent knows about the person, the app screen and the latest message. A request still over the budget after everything that may be trimmed is sent as it is, and Call History counts it.

Only the copy sent to the model is trimmed. The transcript, Call History, the live view and what the agent remembers always keep the whole conversation.

Which agents a budget trims

A budget trims a prompt agent. These are measured, never trimmed, and Call History says so: a flow agent, whose steps build their own requests; an agent with a knowledge base; and an agent on a GPT-5.4 model, whose service condenses long conversations itself — use Shorten long conversations for those.

Choosing a budget

Look at What this agent reads first, and set the budget comfortably above a typical turn, so that only unusually long conversations are trimmed. If Tool results take most of a turn, keep fewer of them whole, or have the tool return only what the agent needs.

Sizes are estimated tokens — roughly four characters to a token in English and two in most other scripts — not the model's own count. Use them to compare sections and conversations, not to reconcile a bill.

What the agent knew, in Call History

Open a conversation in Call History. Under Memory, What the agent knew shows:

  • the largest request, in estimated tokens, and how many requests were measured;
  • a bar for each section, at its largest during the conversation — so the bars can add up to more than the largest request;
  • with a budget: the budget, what was trimmed to stay within it ("4 older tool results were cleared to stay within 8,000 tokens"), and any request still over it;
  • a note where one applies:
NoteWhat it means
A flow agent: measured, never trimmedEach step builds its own request; a budget only measures it
Passages from the knowledge base aren't countedThe passages an agent with a knowledge base adds on each turn are not in the sizes
Long conversations are shortened by the model's own compactionA GPT-5.4 model condenses long conversations itself; a budget only measures
A phone call measured because the agent opted inThe agent's Context is set, so its phone calls are measured too

Nothing is shown for a conversation that measured nothing: Context set to Off, a phone call of an agent whose Context is not set, or a conversation from before this was available. The record holds sizes and counts only — never text from the conversation.

The execution log's Instructions show the agent's prompt as it stood when the call ran, before what is added on each turn; What the agent knew is where each turn's full size is.

What this agent reads

At the top of Agent → Context, What this agent reads sums up the agent's recent measured conversations, over the last 7 days or 30 days:

  • how many conversations, the size of a typical turn and of the largest one;
  • for each section, the Typical size (the median across conversations) and the Largest;
  • what a budget trimmed across them, and any request still over budget;
  • which choices ran — for example, Measure only in 70 conversations and Keep within a budget in 10.

It reads up to the 500 most recent measured conversations in the period, and anyone who can see the workspace's calls can see it.

Tools in every request

Every tool the agent may call is described to the model in each request, whether or not it is used, so a tool the agent rarely needs still adds to every turn. Agent → Context → Tools in every request lists them:

  • its API tools and MCP servers, as set in Integrations & Tools — for an MCP server, the tools it allows, or every tool it offers;
  • in your app and on your website, its App actions and Components, as the agent has them. They are offered in those conversations only, never on phone calls.

With measured conversations, it also shows how large the tools are in a typical turn and at the largest: the Tools row of What this agent reads, over the same period. In a flow, a tool limited to some steps is described only on those steps.

What a tool returns joins the conversation as a Tool result. A budget clears older tool results first, and the agent can call the tool again when it needs one. To make every turn smaller, remove the tools the agent doesn't use, or have a tool return only what the agent needs.

Good to know

  • Nothing about the person is decided here. Context changes how much of each source the model reads on a turn, never what is remembered or kept.
  • Phone calls are left as they are unless the agent's Context is set.
  • Measuring adds no noticeable time to a reply: sizes are estimated from the length of the text, not counted by a tokenizer.

Where next

On this page