Realtime API instruction limit (16,384 tokens) is too low for production voice agents with tool calling

We’re running a production voice agent for restaurant order-taking using gpt-realtime-1.5 via LiveKit. The agent handles thousands of calls per month in Spanish (Mexico) with 9 function tools.

Problem 1: Instruction token limit is too low

We discovered our system prompt was exceeding the instruction limit. The error from the API:

“Instructions cannot be longer than 16384 tokens, you have provided 17199 tokens.”

Our prompt needs to include: the full restaurant menu with prices and modifiers (~5,000 tokens), business rules, delivery location mappings, audio transcription corrections for Spanish, and returning customer context. All of this is necessary for correct behavior.

16,384 tokens is not enough for a production voice agent with a real menu and real business logic. The worst part is that the failure was silent — we had no idea the prompt was being truncated. Calls with new customers (less context) worked fine. Calls with returning customers (name, last order, saved address loaded into context) would exceed the limit and the agent would lose critical rules from the end of the prompt. This caused inconsistent behavior that took us weeks to diagnose.

Problem 2: Tool calling is unreliable ~10% of the time

Even when the prompt fits within the limit, gpt-realtime-1.5 does not follow instructions consistently. Approximately 1 in 10 calls has errors:

  • Paid modifiers placed in the “notes” text field instead of the “modifiers” parameter with extra_price, causing incorrect pricing. The customer gets undercharged because the system only calculates price from modifiers, not from notes. We have explicit instructions with examples saying “NEVER put paid extras in notes”, and it still does it.
  • Duplicate items added when the customer interrupts mid-tool-call. The model fires add_to_order, gets interrupted, then fires it again. The internal state now has 2x of the same item, but the model’s conversational context only remembers 1. The customer hears one thing, the order has another.
  • Ignoring explicit language rules. We say “always use Mexican pesos” and the model occasionally says “dollars”. We say “never offer fries as an add-on to a product that already IS fries” and it does it anyway.
  • The model understands the conversation correctly (its reasoning is right) but executes the tool call wrong. It knows the customer wants a burger with fries, but it puts “con papas naturales” in notes instead of calling add_to_order with the correct modifier and extra_price.

The conversational ability and voice quality are excellent. The problem is strictly instruction following and tool calling reliability. For a voice agent that takes real orders with real money, 90% accuracy is not enough. We need 99%+.

Questions:

  1. Is there a way to increase the instruction limit beyond 16,384 tokens? We need at least 20,000-24,000.
  2. Is there a roadmap for improving tool calling reliability in the Realtime API? The text models (gpt-4o, gpt-4.1) are significantly more reliable at structured function calling than the realtime models.
  3. Is there any way to make tool calls atomic with respect to user interruptions? This is a fundamental issue for any voice agent that modifies state.
  4. Should the API return a clear error or warning when instructions are truncated instead of failing silently?

Environment: gpt-realtime-1.5, LiveKit Agents SDK, Spanish (Mexico), 9 function tools, ~2 min average call duration.

Totally get why that feels tight especially when you’re aiming for 99% reliability on a voice agent. That last 10% gap is usually where things get tricky.

What’s going on here is the instruction limit you’re hitting is part of the overall context budget. With gpt-realtime-1.5, you actually get a 32k total context window, but about 4k is reserved for output, so the remaining space is shared across everything:

  • system instructions
  • conversation history
  • tool calls and metadata
  • audio + text inputs

So even if instructions feel capped, it’s really the combined load that’s squeezing things.

A few folks building similar setups have had better results by:

  • trimming instructions down to only “always needed” rules
  • moving less critical logic into tools instead of the prompt
  • aggressively managing conversation history (summarize or reset when possible)

Not ideal, agreed, but it does help stretch that space and improve consistency.

There’s also a solid guide on model optimization that walks through ways to rebalance this for voice agents. Worth a look if you haven’t already.

Also, you might wanna check the tools usage to see where the tokens are getting eaten.

-Mark G.

Hey Mark! Thank you very much for your response, it does help a lot.

What do you really mean by this? im interested in understanding it, looks good to test it.

and with this> solid guide on model optimization that walks through ways to rebalance this for voice agents."

do you happen to have it by any chance? Would love to take a look if I haven’t already.

thanks again for the response and we’ll continue building!

-Eugenio

Hi @Eugenio,

Totally get why that advice feels a bit vague at first especially when you need tight control for voice agents + tool calling.

What people mean by “only always-needed rules” is keeping your system prompt focused on the non-negotiables, and moving everything else out.

In practice:

  • Keep: core role, must-follow behaviors, strict tool usage rules
  • Cut: long examples, rare edge cases, repeated instructions, full tool docs

The tricky part is the model treats all tokens as competing for attention. So when the prompt gets long, the important rules don’t stand out as much which is usually where that ~90% reliability ceiling shows up.

You might also find this helpful: Realtime Prompting Guide it goes deeper into structuring prompts specifically for voice + realtime use cases.

-Mark G.

Following up now that gpt-realtime-2 is available.

I understand the earlier explanation that, for gpt-realtime-1.5, instructions/tools compete within the overall 32k Realtime context budget. The new question is about gpt-realtime-2 specifically. Its model page lists a 128,000 token context window and 32,000 max output tokens, so we tested whether the separate Realtime session instructions+tools ceiling also increased.

Using POST /v1/realtime/calls with the same WebRTC session payload shape, we observed:

  • gpt-realtime-1.5: ~17.8k estimated instructions+tools tokens succeeds; ~31.3k fails with HTTP 504
  • gpt-realtime-2: ~17.8k estimated instructions+tools tokens succeeds; ~31.3k fails with HTTP 504

These are local tiktoken estimates, so I do not expect them to match OpenAI’s internal realtime tokenizer exactly. The relevant observation is that both models appear to fail at roughly the same initial session payload size, before any conversation history, audio, or tool-call outputs exist.

Could OpenAI clarify the intended behavior?

  1. Is the Realtime session.instructions + tools limit currently fixed for all realtime models, including gpt-realtime-2?

  2. If yes, is that intentional? If so, it would be helpful for the gpt-realtime-2 / Realtime docs to state clearly that the 128k context window does not imply a larger initial session instructions+tools budget.

  3. If no, is the current /v1/realtime/calls behavior a bug, rollout issue, or endpoint-specific limitation?

  4. When the initial session config is too large, could the API return a clear 4xx validation error instead of a 504? That would make this much easier to diagnose in production.

Happy to provide request IDs and a minimal repro script if useful.

Hi just wanted to follow up on this thread. Also running into the instruction limit for gpt-realtime-2 despite the context window being much larger. Is there a way to make the instruction window larger?

@dribalta, thanks for the detailed testing and for calling out the distinction here.

One relevant detail from the current OpenAI documentation is that tool definitions, including function schemas and MCP server definitions—add tokens to the model context. The token-counting API can also count those tool definitions together with the rest of the input, which may help verify how much of the available context is being consumed by a large tool configuration.

That said, the documentation does not indicate that the full model context window can necessarily be used for the initial Realtime session.instructions + tools configuration, nor does it document a setting for independently increasing that limit. So your testing around where the Realtime session begins failing is still useful feedback, especially for clearer documentation and validation around large instruction and tool payloads.

Thank you for taking the time to share this feature request. We appreciate and value your feedback. While we can’t promise implementation or provide a timeline, we’re grateful you shared it with us. We’re closing this topic while keeping it visible for reference.