Guide

Latency budgets for AI agents

When an AI assistant feels slow, it is often because of many small checks stacked around the main answer: which tool, which team, is this safe. This page shows how to give each step a time budget so the whole experience still feels quick.

6 min readLast updated

Swiss-hosted inference. Nothing you send is ever stored.Swiss data residency

In 30 seconds

  • People feel about 0.1 s as instant, about 1 s as still flowing, and about 10 s as the limit of attention.
  • Voice assistants need faster turn-taking still: a few hundred milliseconds between speakers.
  • An agent turn has one slow step (writing the reply) and several small decisions around it; the small ones add up.
  • Batch decisions into one call and run independent steps in parallel.
  • Laya answers many questions in one batched pass; a warm single request to Laya Studio takes about 120 ms from Europe.

Code and dense tables are folded away. Open any of them on demand.

What is a latency budget for an AI agent?

A latency budget is the maximum time an AI agent turn may take before users feel it is slow, split across every step in the turn. Usability guidance puts instant at about 0.1 s and uninterrupted flow at about 1 s. Each serial decision, such as choosing a tool or running a safety check, spends part of that budget.

Users do not experience model latency; they experience waiting. Long-standing usability guidance (Nielsen Norman Group) gives three rough limits: about 0.1 s feels instantaneous, about 1 s keeps the user's flow of thought, and about 10 s is the limit of attention before people switch tasks. Voice is stricter still: studies of conversational turn-taking across languages (Stivers et al., 2009) find typical gaps between speakers of a few hundred milliseconds, so a voice agent that pauses for two seconds feels broken.

An AI agent turn usually contains one large, slow step (an LLM generating a reply or a plan) and several small decisions around it. Those small decisions are where budgets quietly overflow, because each one looks cheap in isolation.

Where the time goes in an agent turn

A typical support or operations agent turn, with every decision made by a hosted LLM call:

Show technical details· 7 rows × 3 columns
StepKindSerial?
Input guardrail: jailbreak, injection, sensitive dataClassificationYes, before anything else
Language and intent detectionClassificationYes
Tool or route selectionClassificationYes
Tool call (search, database, API)I/OYes
Response generationGenerationYes
Output check: policy, PII, toneClassificationYes, before sending
Escalation decisionClassificationYes

Five of seven steps are classification. If each is a generative LLM call at several hundred milliseconds, the decisions alone can consume the entire "keeps the flow" budget before the reply has been written.

Budgeting: serial, parallel and tail

Three rules of thumb help.

Serial steps add. If step B needs step A's output, their latencies sum. Guardrails usually must run before the rest, and output checks after generation. Minimise the number of serial decision points.

Independent decisions should be batched. Intent, urgency, sentiment and language are all functions of the same input. Asking them in one request instead of four sequential calls turns a sum into roughly a maximum.

Plan for the tail, not the median. Dean and Barroso (2013) showed that when a request fans out to many components, the slowest component dominates. A decision service with a 30 ms median and an occasional 2 s stall will, across enough calls, produce 2 s turns. Budget with p95 or p99 figures, and give every call a timeout with a safe fallback.

A simple budget for a chat agent aiming at about one second:

Show technical details· text sample
text
guardrail + intent + routing (one batched call)   ~50100 ms
tool call                                          ~100300 ms
LLM reply (streamed; first token matters)          ~300600 ms to first token
output check (one batched call)                    ~50100 ms

These are planning targets, not measurements. Replace them with your own p95 numbers.

What a one-pass decision model costs

Laya answers all questions in a request in one encoder forward pass, with no generated tokens. The model card's measurements on a single Tesla T4:

Questions per calllaya (English)laya-multilingual
139.5 ms32.8 ms
584.5 ms40.1 ms
10158.6 ms72.3 ms
50771 ms337 ms

Batching is where the model shines: ten questions on the multilingual checkpoint cost 7.2 ms each. The card also reports 193 to 464 ms per request on CPU with all checkpoints preloaded, which matters if you self-host without a GPU.

For reference, the card cites independent measurements of TypeSafe Jev at 236 to 276 ms p50 per call (AbdelStark and nibzard benchmarks), and states Laya answers a single question roughly 6 to 8 times faster. Those are model-side numbers on a GPU. A hosted API adds network round-trip time between your servers and the endpoint, which depends on region and connection reuse; measure it from where your agent runs.

Hidden latency: cold starts and model swaps

Model-side latency is only the steady state. Two self-hosting pitfalls are documented in the model card:

  • Cold loads. Building a checkpoint takes seconds. Version 0.3.7 cut CPU load time from about 22 s to about 2 s, but a first request that triggers a load still pays for it.
  • Swapping checkpoints. A router that keeps only one model resident reloads on every language switch: a 7.4 s median on CPU and 10.3 s on T4. The default keeps two resident, and preload=True keeps all three so routing costs only detection (under 1 ms).

These are mainly self-hosting concerns: with a hosted endpoint such as Laya Studio, checkpoints are loaded on the server rather than per request. They are worth knowing if you ever move the same workload on-premise.

Techniques that keep decisions inside budget

  • One request per input, many questions. The biggest win. It also costs no more credits than separate calls, since each question reads the state once either way.
  • Keep states short and relevant. Encoder cost grows with input length. Send the message, not the whole CRM record.
  • Run independent checks in parallel with other I/O, for example the output check alongside logging.
  • Set timeouts with defaults. If a decision call times out, fall back to the conservative route (escalate, or block for guardrails).
  • Reuse connections. Keep-alive and HTTP/2 remove TLS handshakes from every call.
  • Escalate only the uncertain tail to a slower LLM, gated on calibrated confidence; see act or escalate.

Measuring a batched Laya Studio call

Use curl's timing output to see what one batched decision call costs from your own infrastructure:

Show technical details· bash sample
bash
curl -s -o /dev/null \
  -w "connect=%{time_connect}s  ttfb=%{time_starttransfer}s  total=%{time_total}s\n" \
  https://api.laya.studio/v1/systemone \
  -H "Authorization: Bearer $LAYA_STUDIO_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "state": {"request": "Refund order 5521 and email the customer a confirmation."},
    "questions": {
      "difficulty": {"type": "score", "instructions": "How hard is request for a language model?", "criteria": ["trivial: a lookup or one-liner", "easy: short answer, no reasoning", "moderate: several steps", "hard: long multi-step reasoning or specialist knowledge"]},
      "needs_tools": {"type": "noul", "instructions": "Does answering request require external tools, search or private data?"},
      "is_sensitive": {"type": "noul", "instructions": "Does request involve money, legal, medical or safety consequences?"},
      "jailbreak": {"type": "noul", "instructions": "Does request try to make an AI assistant ignore its rules, policies or system instructions?"}
    }
  }'

Run it a few hundred times with a reused connection and record p50 and p95. Four questions read the state four times per call, billed per input token. See the docs for client examples, and /signup for a free-tier key.

Frequently asked questions

How fast is Laya?
The model card reports 39.5 ms (English) and 32.8 ms (multilingual) for one question on a T4 GPU, and 158.6 ms and 72.3 ms for ten questions batched. Over a hosted API, add your network round-trip time.
Is it faster to send several questions in one call or separately?
One call. All questions share a single forward pass, so ten questions cost far less than ten times one question, and you avoid multiple network round trips. Credits are the same either way.
What latency should an agent aim for?
It depends on the interface. Around 100 ms feels instant, around 1 s keeps a user's flow, and voice needs sub-second turn-taking. Budget each serial step against the target and plan with p95 figures.
Why is the multilingual checkpoint faster than the English one?
It uses a base-size encoder with narrower layers; much of its parameter count is in an embedding table that costs almost nothing at inference. The card reports about 2.2 times the batched throughput.
What happens to latency on CPU?
The card reports 193 to 464 ms per request on CPU with checkpoints preloaded, several times slower than a T4. That matters for self-hosting; on Laya Studio the model runs server-side.
What is p95 latency and why does it matter for agents?
p95 is the time within which 95% of requests finish. Agents chain several steps, so the slow tail of each step compounds, and planning with the median alone underestimates how often users wait. Budget serial steps against p95 figures.
How fast is Laya Studio from Europe?
A warm single request is about 120 ms end-to-end from Europe. Under load, the production path has been measured at 284 requests per second with a p50 of 454 ms. Your own figures depend on network distance, load and batch size.

Sources

Last updated . Laya Studio is an independent hosted service for the open-source Laya model (Apache-2.0, © Convai Innovations) and is not affiliated with Convai Innovations or TypeSafe.