Skip to main content
A voice system prompt is sent on every turn, before the first word is spoken. Keep it to how the assistant should talk. Put a rule that applies to one action in that tool’s description. Anything that changes per call or per turn goes after the instructions that never change.
voice_prompt takes the stable instructions first and one per-call fact second. On each voice turn the suffix is, in order: the call fields you chose to show, that fact, the UTC time for this turn, and on the first turn a note that the greeting was already heard. The time is fixed for every model call in the turn, including tools, and changes on the next turn, so it stays after the per-call lines. Do not paste the date or the caller at the top of the instructions. The reused prefix stops at the first byte that changed. A call’s call_context (telephony from, to, call_id, and every custom parameter, tokens included) is not shown to the model unless you name its fields in prompt_call_context_keys:
fragment
Those fields become sorted key: value lines that stay the same for the whole call, so they extend the cached prefix. Each value is flattened to one line of at most 200 characters, and the block is labelled as call data rather than instructions. A caller hello cannot change the list. Do not repeat a field you named in the second argument of voice_prompt. The other fields stay in session data, where a callable system prompt can read the ones it needs. A callable system prompt can return voice_prompt(...) when the per-call fact comes from your own lookup. Return the instructions as a plain string when you have no extra fact; Timbal still appends the named call fields and the time.

Move rare rules onto the tool

The system prompt is the behavior for every turn: length, tone, and when to ask a question. A refund window, a required confirmation, or a field the tool needs belongs on the tool. The model reads it when it calls that tool, and you can leave the tool off agents that never take that action.
Register only the tools this call can use. Each tool’s name, description, and parameters are sent on every turn, in the same order. Renaming a tool, editing its description, or reordering the list changes the prefix the same way editing the instructions does.

What gets reused

OpenAI, Groq, and Anthropic reuse an unchanged prefix of the request. Timbal sends the stable instructions and the tool list before the per-call lines, and those lines before the per-turn time and greeting note.
  • OpenAI. Prefixes of 1,024 tokens and longer can be cached. Timbal sends a stable key for the voice session (prompt_cache_key). On models before GPT-5.6 that key helps routing; from GPT-5.6 it separates cache accounting per session. On GPT-5.6 and later, the Responses API (the default) also marks the end of the stable instructions so the per-turn block does not have to match. TIMBAL_OPENAI_API=chat_completions does not send that marker; the static text is still the start of the system message. Cached tokens are input_cached_tokens on the run’s usage.
  • Groq. Exact-prefix caching is automatic on groq/openai/gpt-oss-20b, groq/openai/gpt-oss-120b, and groq/openai/gpt-oss-safeguard-20b, and an unused entry expires after 2 hours. There is no session key. Cached tokens are input_cached_tokens.
  • Anthropic, including Claude on AWS Bedrock. Timbal turns on prompt caching. The stable instructions are one breakpoint and the growing conversation is another. Haiku 5.5 caches a prefix of at least 512 tokens; Haiku 4.5 needs 4,096. A shorter prefix is answered normally and is not an error. Cache reads are cache_read_input_tokens on the run’s usage. The default lifetime is 5 minutes; pass model_params={"cache_control": {"type": "ephemeral", "ttl": "1h"}} for an hour. model_params={"cache_control": None} turns caching off.
The first turn writes the prefix. Later turns in the same call read it when the instructions and tools are unchanged. A short prompt is still the faster one to process when it is under the model’s minimum.

Next steps

Add the action the prompt mentions in Using tools. Read cached-token counts next to turn latency in Events and usage.