- Fewer sequential model calls per turn.
- Smaller and more stable prompts.
- Fast tools that return only what the model needs.
This page is about response latency. For the Arch AI reinforcement-learning loop, see Optimize. It is a different feature with a different goal.
Where a turn’s time goes
Fewer model calls per turn
Topology
- Keep routing shallow. Each hop (router to specialist to sub-specialist) adds at least one full model call. Two levels is usually enough.
- Route deterministically where you can. A handoff
WHENthat the runtime can evaluate against stored state fires without asking the model. Stored state is a flag that your tools or flow already set.ESCALATEtriggers written as expressions work the same way. - Let coordinators answer simple turns.
role: orchestratorcan answer greetings and trivial questions directly.role: routeralways spends a call on routing. - Delegate only for real sub-tasks. A delegate runs its own full turn while the parent waits, up to 30 seconds by default. If one API call is enough, use a tool.
- Hand back only when it pays off.
ON_RETURN: action: resume_intentmakes the parent handle a message again right away. Use it only where the customer would otherwise repeat themselves. - Send each receiver less. A handoff with
history: summary_onlyorlast_nand a short summary gives the receiver a smaller first prompt.
Inside an agent
- Answer straight from a tool.
on_result: do: - RESPOND: "…"sends the reply and ends the tool loop. This saves the model call that would phrase the answer. Add a responseMODEL_CONTEXTso later turns know what was said. - Use
FLOWsteps withREASONING: falsefor fixed steps such as setting values, calling a tool, or responding. They run deterministically, without a reasoning call. AGATHERstep still makes a small extraction call to read the customer’s answer. - Make one tool do one job end to end. Three sequential lookups cost three model rounds. One tool that does all three costs one. The model can also call independent tools in parallel in a single round.
- Turn on
EXECUTION.inline_gather: true. Field extraction then happens in the same call as the reply. If the agent’s single knowledge tool also setskb_fast_path: on, inline gather turns off the automatic knowledge-base search for that agent. Measure both settings before you commit. - Validate inputs before calling.
process: before: require:rejects bad inputs without a failed API call and a retry round. - Use
confirmonly on irreversible actions. Each confirmation costs a full extra turn with the customer. - Choose the multi-intent completion signal. With the default
completion_signal: delivered_response, a small check runs after each queued request’s reply. Withtask_signal, the agent signals completion itself.
Smaller, stable prompts and payloads
Prompt size sets the time to first token on every call in the turn. You pay that cost again on each tool round. Providers that cache automatically can reuse a prompt that starts the same way every turn.Prompt and context
- Explicit visibility. Declare
BEHAVIOR: role:so## Current Contextholds only declared and granted values. Avoid{{context}}in production prompts. - Small memory. The platform sends session memory in full on every call. Store IDs and short strings, not objects or lists. Set
MODEL_VISIBLE: falseon values the model does not need. - Tight context budgets. On latency-sensitive agents, lower
prompt_context.total_max_chars(voice default: 16,000) andauto_tool_result_value_max_chars(voice default: 2,000). See Context size, compaction, and budgets. - Short history. Keep
prior_turns: compact. Put a responseMODEL_CONTEXTon every rich reply. Usehistory: last_non handoffs in long conversations. - Short instructions. The platform sends
GOAL,PERSONA,LIMITATIONS, andsearch_instructionson every call. Move rarely needed guidance into a tool description or aRECALL INSTRUCTIONthat loads only when relevant. - A stable start to the prompt. Identity, rules, and the tool list come first. Values that change each turn come later, in memory and
## Current Context. A{{variable}}inGOALorPERSONAchanges the start of the prompt each time the value changes. To avoid this, use an explicit-mode agent and declare the changing values in memory. They then stay in the memory sections and## Current Context, and the stable start does not change.
Tools
- Fewer tools per agent. The platform sends every tool’s description and schema on every call. The model also chooses faster and better from a short list. Split large tool sets across specialists.
- Short descriptions and parameters. Use one or two sentences per tool. Hide parameters that the model does not fill with
default_source: runtimeandvisibility_model: false. - Small results. Add
MODEL_CONTEXT: FIELDSto every tool that returns more than a few fields. This avoids the summarization call and keeps each tool round small. Better still, return compact payloads from the API itself: filter, paginate, and drop fields the agent never uses. - Structured, not summarized. On chat agents where speed matters, prefer
tool_results.strategy: structuredwith flatessential_fields. Summarizing costs an extra call. The voice low-latency profile setsstructuredby default. - Tight timeouts. Set
timeouton the project tool to what the API needs, not the 30-second default. Use transport retry only on idempotent reads.
Knowledge base
- Token budget. Set
max_search_tokenson every KB tool. Use 2,000 to 4,000 for voice and more for long-form chat. - Fewer, better chunks. Lower Top K and raise the similarity threshold.
- Automatic first search. Set
kb_fast_path: onon a single-KB agent’s knowledge tool. The platform then searches before the model runs, which saves a model round. It is off by default. The agent is not eligible if it has other business tools, handoff or delegation tools, orGATHERfields collected with inline gather. See How the platform searches. - Selective extras. Use
search_instructionsandretrieval_profile: object-awareonly where they improve answers. Each one adds planning time or extra parallel searches with reranking.
The runtime reads
compaction.max_search_tokens from the full tool definition. If an agent only references a project tool, set max_search_tokens on the project tool. An agent’s own TOOLS: entry for a project tool can override only search_instructions, kb_fast_path, and business_rules.Checks, side calls, models, and voice
Guardrails and checks
- Order rules by cost. Put
check(CEL) rules first. Use provider rules for moderation. Usellm_checkonly for meaning patterns that other rules cannot catch. Each judge is an extra model call at its checkpoint. - Streaming and output rules. An agent with output guardrails or response constraints holds a streamed reply until the checks pass. This applies in every stream-safety mode except Terminate forward and Retract capable. Nothing shows until the full reply is generated and checked. If you need both output rules and fast streaming, set the project’s stream-safety mode to Terminate forward. Text then flows, and the platform stops it on a violation.
- Reask costs a full regeneration. On latency-critical agents, use
blockwith a clear message instead. - Timeouts. Lower the policy’s Model and LLM timeouts for voice. Choose the fail mode on purpose.
- PII. Model-based detection waits up to its time budget on each scan (200 ms by default). A pattern-only rule skips that wait if pattern detectors cover the data.
Model tiers
Voice
- Keep the low-latency profile on. The platform adds it to a project when the project gets its first voice channel. It sets fast model tiers, inline gather, tight compaction, and voice fillers. It does not change model reasoning unless you enable its reasoning defaults. Make sure the workspace has a fast-tier model configured.
- Fillers hide waiting; they do not remove it.
voiceDelayMs(300 ms in the profile) and status tags (piggybackEnabled) keep the caller informed while tools run. - Short spoken replies. Use
CONVERSATION: speaking: max_sentencesand short instructions. - Realtime voice. On Gemini Live, the platform handles tool calls without blocking the voice model only when the channel’s pending-tool fillers are on. Without them, a long tool call blocks the voice model. Amazon Nova Sonic has its own pending-tool filler setting. Keep tool results small for realtime voice with
compaction: provider_fields. - Buffered stream safety on voice. Buffered and Gated delay the first audio until the checks finish.
Measuring before and after
- Operate → Sessions → a session → Performance → LLM & Tools lists every model and tool call in a turn with its latency, tokens, and cost. Count the sequential model calls.
- Traces tab → an LLM step → Summary shows input tokens. Compare turn 1 with turn 20 to see growth.
- Insights → Analytics Explorer → Generations shows time to first token and latency across sessions.
- Change one thing at a time (topology, tool payloads, or tiers). Then re-run the same test conversation in a new session.
Speed checklist
- At most two routing hops, with deterministic
WHENwhere state allows it. - Status-style answers come straight from the tool (
on_result: do: RESPOND). - Every tool with more than a few fields has
MODEL_CONTEXT. No tool-result summaries on hot paths. - Fewer than about 10 tools per agent, with one- or two-sentence descriptions.
-
max_search_tokensis set on every knowledge base. - Session memory holds IDs and short strings only.
- Routing and summarization use the cheapest tier that passes your evaluations.
- Output rules use
checkor providers, or the stream-safety mode keeps the reply streaming.
Design guidance
The most reliable agents keep the prompt small and explicit. Declare only what the model needs, shape every tool result, and pass state between agents on purpose instead of relying on history.- Make visibility explicit. Production agents should declare
BEHAVIOR: role:so## Current Contextholds only declared and granted values. Allow-list mode with{{context}}admits everything in the session. - Shape tool results at the source. Give every tool that returns more than a few fields a
MODEL_CONTEXT. Save anything that later turns need into session values withon_result, because history keeps only a placeholder. - Keep memory lean. The platform shows session memory in full on every turn and does not size-limit it. Hold large objects in tool results or persistent memory, not in declared session memory.
- Hand off on purpose. For long conversations, prefer
passplus a templated summary, withhistory: last_norsummary_only, over the full-history default. Give delegates everything they need inINPUTandPURPOSE. - Give the agent the date. The main system prompt has no current date or time. Only
GATHERdate extraction receives today’s date. Supply a date explicitly when an agent reasons about relative dates. - Keep secrets out of prompt text. Put credentials in auth profiles, mark personal fields
SENSITIVE, and useSECURE_INPUTfor card data. - Put stable text first.
GOAL,PERSONA,LIMITATIONS, and the tool list form the stable start of the prompt. Values that change each turn come later, in## Current Context. A stable start helps provider-side prompt caching, which shows as Cache Read tokens on the session Overview. - Write guardrails for one message at a time. A
checkrule sees only the current message. Model-judge checks also receive up to five recent messages as context, and provider checks can receive recent messages too. Do not write rules that depend on earlier turns. Choose the fail mode on purpose.
Pre-ship checklist
- Each agent declares
BEHAVIOR: role:, or you checked its## Current Contextin a trace. - No
{{placeholder}}shows unfilled in the system prompt of a test trace. - No
{{config.*}}or{{env.*}}appears inGOAL,PERSONA,LIMITATIONS,SYSTEM_PROMPT, orRESPOND. - Every tool with a large or nested result has
MODEL_CONTEXT, tested against a real response. - Rich responses carry a response
MODEL_CONTEXT. - Handoff
CONTEXT:keys are lowercase, andhistoryuses a supported form. - Delegates receive everything they need through
INPUTorPURPOSE. - Sensitive
GATHERfields are markedSENSITIVEwith aPII_TYPE. - Guardrail rules set
kindandactionand useabl.-prefixed functions. The policy fail mode is chosen on purpose. - Memory is tested with an identified user. Knowledge-base retrieval is tested with a real customer identity.
- Voice agents: the fast model tier has a model assigned. Custom-prompt voice agents state their own spoken-style rules.
- A long test conversation (20+ turns) is checked for prompt size in the trace.
- Final tests ran in a new conversation, on the version that you will deploy.
Related articles:
- Context size, compaction, and budgets — the size budgets this page refers to.
- How a turn is built — visibility modes and what reaches the model each turn.
- Test agents — running and reading a test conversation.
- Sessions — reading a trace’s Performance and Traces tabs.