Latency Budgets and API Selection Criteria for Real-Time Agent Tool Calls
Pick APIs by their P95 latency, not average speed, to keep agent loops responsive.

For real-time agent tool calls, choose a web data API that returns structured JSON or LLM-ready Markdown, keeps its schema consistent, and meets a per-stage P95 latency budget. Cache controls, concurrency limits, and advertised speed belong in that decision. The central rule is simple. Select APIs against the slow end of the whole agent loop, because fast average calls do not guarantee a responsive agent.
Why real-time agent tool calls fail at the tail, not the average
An agent is midway through its reasoning when a synchronous API call stalls. It cannot use a result that has not arrived, so the next step waits too. The model may have responded quickly, and the tool may usually be fast. Neither helps this request finish on time. In a sequential loop, every blocking stage adds its delay to the same user wait.
That is why the median, or P50, is a weak basis for API selection. It describes the middle request in a distribution whose slow requests can disrupt an interaction. P95 exposes that slower end of the distribution. A stage with a comfortable P50 can still have a P95 that consumes the entire response budget, leaving nothing for the work after it.
Delays accumulate across the chain rather than averaging out, and a longer chain gives more stages a chance to stall. This does not mean that stage percentiles can simply be multiplied to calculate total latency. It means that good typical performance at each stage is not enough to establish good end-to-end performance.
The blocking stages need separate budgets, followed by measurement of the complete loop. A faster model cannot recover time already lost to an external call, and a fast search service cannot compensate for an inference stage that repeatedly exceeds its allocation.
How a per-stage latency budget exposes the real constraint
A conversational voice agent gives the budget a concrete shape. An illustrative allocation is about 50ms for voice activity detection, 150ms for speech-to-text, 400ms for the LLM’s time-to-first-token, 150ms for text-to-speech, and 50ms for the network. Together, those slots allow about 800ms to first audio. Each vendor must fit the time allowed in its slot. The breakdown is a planning example with production P95 performance still to be tested.
To apply that model, assign a maximum P95 to each stage that blocks the response. If inference exceeds its allocation, downstream stages inherit less time. They do not receive a fresh budget. The end-to-end measurement then tests whether those allocations hold together under the actual loop’s load and dependencies.
Tool execution needs its own explicit allocation. Rough planning ranges, rather than acceptable-performance targets, are 10–200ms for an internal API call and 100–2,000ms for an external call, while a multi-step workflow can take several seconds. In particular, the upper end of the internal range should not become the default simply because it appears in an estimate.
For a text or retrieval-augmented generation agent, the same method applies without the speech stages. The budget then covers inference, retrieval, tool execution, and any later model turn needed to finish the response. Loop shape determines the allocation. A tool that runs once has a different effect from one that blocks every turn.
Beijing Normal University’s Cost–Utility Alignment in LLM Agent Trajectories looks at the full trajectory to judge how efficiently an agent works. That approach captures costs that accumulate across turns but produce value only when the task is complete. In practice, the budget shifts API discussions away from model brands and toward the stages that constrain the task.
Where time actually goes in the LLM inference stage and what to do about it
LLM inference introduces substantial tail-latency risk because the same request can behave differently at different times. UW-Madison and NVIDIA’s What Limits Agentic Systems Efficiency? documented more than 69× latency variation for fixed-length requests within a single provider across dates. Queue depth and infrastructure noise make provider variance a planning risk, even when the model and workload look stable.
For synchronous agents, the primary inference criterion should therefore be P95 time-to-first-token, or TTFT. Throughput measures how fast output comes, while TTFT measures how long it takes to start. Both affect performance, yet the first-token delay deserves priority when the loop is blocked on the model. Cost alone says even less about whether that stage fits.
Frontier reasoning models usually have a TTFT of 0.5–2 seconds. At the higher end, that first wait takes up a large part of a four-second total budget before a tool call fires. The remaining work still needs time to run. A selection process built around average token throughput can miss that constraint entirely.
Two provider features offer direct leverage on this allocation. Priority processing tiers at major providers can reduce latency variance, making them worth budgeting for synchronous loops. Prompt caching can substantially cut TTFT on repeated calls with a large system prompt. Both work with the same model, though how the caching works needs to be documented and testable.
A smaller model is not automatically the better choice. If its faster response creates a clarifying turn or a retry, the task can take longer overall. P95 TTFT needs to be compared alongside measurements of task completion time. A faster call earns its place only if it helps the agent finish.
Web environment latency: the stage most agent builders undercount
The web layer can consume more time than inference. The UW-Madison and NVIDIA study found that web environment latency can account for more than half of total latency in web-interactive agentic systems. Search, scraping, and structured extraction are all part of that layer. Treating it as a small tool overhead can lead to spending time speeding up the wrong stage.
Search itself is not a uniform commodity. Agentic benchmarks show roughly 20× latency variation across search API providers, enough to threaten a four-second total budget. The relevant comparison is P95 response time under realistic query load. Result quality belongs in the same evaluation because an unhelpful response can force the agent to search again.
For giving an agent the ability to scrape websites, the useful default is an API that returns developer-defined structured JSON or LLM-ready Markdown. Raw HTML leaves preprocessing work inside the synchronous loop. Structured extraction removes the need for the model to parse an unstructured blob and reduces token consumption. It also makes the result predictable enough to cache.
That predictability depends on a stable output contract. Schema drift can leave an agent receiving data that no longer matches what it expects, without an obvious error. JSON schema consistency therefore deserves heavy weight in API selection. A quick response in an incompatible format is not useful completion.
Brand data, documentation, and product pages can benefit from warm-cache responses with near-zero latency. An extraction API should expose cache-hit behavior and time-to-live, or TTL, controls so that freshness can be weighed against speed. Opaque caching makes that tradeoff harder to manage within a budget.
Parallelism and caching as the two structural fixes that cut budget consumption across stages
Once the budget shows where time goes, parallelism can cut the wait between steps that could run together. Independent tool calls do not need to take turns. Dispatching them together changes how their delays contribute to the loop without requiring any individual API to respond faster. The benefit comes from changing the execution structure.
The cost–utility framework identifies parallel dispatch as a targeted response to serial-call misalignment. The key word is independent. When one call requires the result of another, the dependency remains, regardless of whether the API supports concurrent requests. The budget must distinguish those cases before parallelism is proposed as the fix.
Caching attacks the other source of avoidable work, which is repetition. A large system prompt cached at the provider can reduce TTFT on repeat calls without a model change. Across many daily sessions, that saving accumulates. Web caching applies the same principle to retrieval and extraction when the content’s freshness requirements allow reuse.
Parallelism shortens the portion of the path occupied by independent work, while caching reduces repeated work on later requests. Their effects still need to be measured end-to-end. A gain at the tool layer may make no difference to the whole loop if another stage is still the main bottleneck.
Speculative retrieval is a related technique for suitable loops. Starting a vector search before the model explicitly requests it can save a retrieval round-trip when the result is needed, at little cost when it is not, especially when retrieval is slow relative to the model’s decision speed. Like parallel dispatch, its value depends on the structure of the task rather than a blanket rule to execute everything early.
Concrete API selection criteria to apply at each stage of the agent loop
For an API evaluation, the budget translates into stage-specific comparisons with different priorities. Each starts with the performance requirement, then considers features that protect or reduce that allocation. A feature earns weight because of its effect on the loop.
For inference, require P95 TTFT that fits the inference allocation under realistic concurrent load. Check variance across dates and times rather than trusting the averages that vendors report. Then check whether priority tiers are offered and how much more it costs to reduce variance. Parallel tool-call support is a binary capability requirement where independent calls need concurrent dispatch, while documented, testable prompt caching allows repeated prompts to consume less budget.
For web search, compare P95 response time and result quality together. Fast but unhelpful results can create another query, so evaluation should include agent-task success rate. Rate limits and concurrency matter just as much when many sessions run at the same time. Throttling can force queries into a queue and erase the gains expected from parallel execution.
For scraping and extraction, require LLM-ready Markdown or structured JSON for the synchronous path. Weight JSON schema consistency heavily, and measure P95 extraction time on pages with realistic complexity. Cache transparency and TTL controls should then show whether slowly changing content can be served quickly without surrendering control over freshness.
For internal tool APIs, aim for a P95 of under 100ms. For external tools, the time left after inference and retrieval provides the basis for an honest evaluation of “fast. Async or webhook support is preferable to polling for workflows where results arrive later, because polling adds its own waiting. Idempotency and retry behavior also belong in the evaluation, since retries under time pressure and backoff cascades can multiply worst-case latency.
These criteria make the default choice conditional on the workload. An extraction service that fits simple pages may not fit a loop built around complex pages, and a search API that works for one session may queue under concurrent use. The deciding evidence is performance on the intended stage and task. Feature breadth does not substitute for that fit.
When per-millisecond optimization is the wrong problem to solve
A system can meet its P95 targets and still feel unresponsive. At the seams between stages, what the agent says or shows while waiting shapes the interaction independently of raw latency. Silence during a tool call feels different from progress that helps the user. Instrumentation alone cannot judge that difference.
This is a limit of the measurement. Measured latency describes elapsed time, while perceived latency describes the user’s experience of that time. Treat the per-stage P95 budget as a hard engineering constraint. Then make streaming, progressive disclosure, and agent speech during tool calls separate product requirements alongside fast execution.
The cost–utility framework evaluates expenditure against the contribution to the completed task. A quick trajectory that needs retries or clarifying turns can be less efficient than a slightly slower one that resolves the request in one pass.
The practical order is to write the budget before selecting APIs or models, evaluate P95 rather than P50, and separately audit seam behavior and task completion rate. Each answers a different question. Together, they make API selection serve the actual goal, which is an agent that completes useful work within a wait the user can tolerate.


