Skip to content
AI.info

AI agents

Cost, Latency, Deployment, Monitoring, and Incidents

Design production agent systems around latency budgets, cost controls, versioned dependencies, monitoring, rollout, and incident response.

By the end you can

Example

A successful research agent became unusable after launch because every task took twelve minutes

The planner spawned many searches, retries, and model calls. Quality was acceptable. What broke the product was everything the quality score did not contain: tail latency, vendor rate limits, and cost per completed report all exceeded the budget.

Neither half of that failure was unforeseeable. Both halves have been measured and published. Take latency first. A component that is slow for one request in 100 sounds harmless. Send one user request out to 100 such components in parallel and 63% of requests come back slow. Dean and Barroso worked that out in 2013. An agent that fans out inherits a tail it never sees in its own metrics.

Cost is the same story. A Princeton team ran the 164 HumanEval problems five times each in 2024 and priced the runs. LATS with GPT-4 reached 88.0% accuracy at $134.50 of API cost. Their trivial warming baseline reached 93.2% at $2.45. An agent that costs roughly fifty times more is not reliably the more accurate one.

  • Decision at stake: Design production agent systems around latency budgets, cost controls, versioned dependencies, monitoring, rollout, and incident response.
  • Hidden assumption: Model token price is a sufficient measure of agent economics — yet on one benchmark the $134.50 configuration scored 88.0% and the $2.45 one scored 93.2%.
  • Primary control question: Agent metrics can look healthy while customers absorb hidden failure costs. Dean and Barroso give the mechanism: 1 request in 100 slow at the component becomes 63% slow at the fan-out, and the component dashboard never moves.
  • Evidence to collect: Cost is reported per successful and policy-compliant task, and latency is reported as a bucketed histogram rather than a mean, as Google's Site Reliability Engineering prescribes.

Comparison

Which form of production agent operations fits the task?

Big-bang release, Progressive release, and Per-task routing differ mostly in how much blast radius you accept at once. One of those blast radii has a published measurement, with a root cause attached.

On 19 July 2024, Windows machines crashed. The cause was a Rapid Response Content update, and CrowdStrike published its own root cause analysis on 6 August 2024. A new IPC Template Type defined 21 input parameter fields. The integration code that invoked the Content Interpreter supplied it only 20 input values. Then a Template Instance introduced a non-wildcard matching criterion for the 21st input. The Content Interpreter read past the end of the input array — an out-of-bounds memory read — and the system crashed. Microsoft estimated 8.5 million Windows devices affected. That is what one off-by-one field count buys when the content goes to all hosts at once.

The fix, in the vendor's own words, is the Progressive-release column written out as a procedure: “Staged deployment mitigates impact if a new Template Instance causes failures such as system crashes, false-positive detection volume spikes or performance issues. New Template Instances that have passed canary testing are to be successively promoted to wider deployment rings or rolled back if problems are detected. Each ring is designed to identify and mitigate potential issues before wider deployment.” — CrowdStrike, mitigation 6, “Template Instances should have staged deployment”.

So the three options are not three tastes. Big-bang release replaces the old system for all traffic. Simple routing, a large unknown blast radius, a poor default — and 8.5 million devices is the shape of that unknown when it resolves. Progressive release means shadow, canary, staged authority and monitored expansion. It limits exposure, it needs comparison infrastructure, and it is what the vendor committed to after the fact rather than before it. Per-task routing selects workflow or model by risk and complexity. It controls economics, it makes the router itself a critical component, and it earns its keep at scale.

FigureComparison · 3 columns

Big-bang release

Replace the old system for all traffic.

  • Simple routing
  • Large unknown blast radius
  • Poor default

Progressive release

Shadow, canary, staged authority, and monitored expansion.

  • Limits exposure
  • Needs comparison infrastructure
  • Preferred

Per-task routing

Select workflow or model by risk and complexity.

  • Controls economics
  • Router becomes critical
  • Useful at scale

Key idea

Agent metrics can look healthy while customers absorb hidden failure costs

Low model error and fast median latency may coexist with expensive retries, long tails, repeated clarifications, human cleanup, or rare high-severity incidents. The arithmetic that connects a healthy component to a twelve-minute task was published in 2013.

Start with a component that is not broken. In Communications of the ACM, Dean and Barroso asked the reader to “consider a system where each server typically responds in 10ms but with a 99th-percentile latency of one second. If a user request is handled on just one such server, one user request in 100 will be slow (one second). ... If a user request must collect responses from 100 such servers in parallel, then 63% of user requests will take more than one second”.

The component in that example is not broken and never reports itself as broken. Its median is 10ms, and 99 requests in 100 are fine. Fan-out is what converts it. The same calculation, pushed harder, does not relent: at one-in-10,000 single-server slowness across 2,000 servers, almost one in five user requests still exceeds one second. Making the rare event rarer does not rescue a wide enough request.

An agent planner that spawns many searches, tool calls and model calls before it answers is that parallel request, assembled one step at a time. Measure completed-task value, tail behavior, review burden, and incident cost alongside component metrics. None of those four is visible in a component's own median.

One slow response in a hundred is a rounding error until the agent asks a hundred of them; then it is 63% of the requests, and not one component dashboard has moved.

A cheaper model call can cost more per outcome

Production agent performance emerges from the full trajectory: model prefill and generation, tool latency, retries, parallelism, state access, approvals, and downstream queues.

A cheaper call can cost more per outcome, and a dearer one often buys nothing. Both have been measured on a public benchmark. A Princeton team ran the 164 HumanEval problems five times each in 2024 and reported total API cost beside accuracy. LATS with GPT-4 reached 88.0% accuracy at $134.50. The trivial warming baseline reached 93.2% at $2.45: higher accuracy, for roughly one-fiftieth of the cost. Reflexion and LDB cost over 50% more than that baseline.

The objection there is to the reporting, not to the agents: “Agents differ drastically in terms of cost. For substantially similar accuracy, the cost can differ by almost two orders of magnitude. Yet, the cost of running these agents isn’t a top-line metric reported in any of these papers.” A team that reports accuracy alone cannot tell the $134.50 configuration from the $2.45 one. That is the same blindness that lets a twelve-minute research agent pass review.

So the optimization target is cost and time per acceptable outcome. Deployment must version the runtime, prompts, tools, policies, memories, graders, and environment assumptions together. Otherwise there is no unit to attribute a cost change to.

Operational ceilings are published, and they are not generous. AWS Step Functions gives an HTTP task 60 seconds as a hard quota and stops an Express workflow after five minutes. A Standard workflow may run a year, but only through 25,000 execution-history events. Over a full year that is one event every 21 minutes, so an agent appending several events per step exhausts the count in days rather than months. Azure Durable Functions takes the other position: an orchestration instance can last seconds, days or months, or be configured never to end. Neither choice is free, and both belong in the cost model.

Figure

Published ceilings on a long-running run: 60 seconds for an HTTP task, 5 minutes for an Express workflow, a year for a Standard one — and no ceiling at all on Azure.

Pick the orchestrator and you have already picked how long the agent is allowed to work, so those published ceilings belong in the design review rather than in the first incident.

Visual

Monitoring and the incident system need separate owners

Operating an agent means versioning a release unit: model, prompt, tools, policies, state schema, graders, and dependencies. That unit is then held to limits. A latency budget allocates time across planning, tools, approvals, retries, and response. A cost budget covers tokens, tool fees, compute, storage, human review, and failure recovery. Monitoring tracks outcome, policy, state, latency, cost, and error indicators. The fifth node is the incident system: detection, containment, rollback, evidence, correction, and learning. Monitoring and the incident system should not answer to one owner, or to one test.

What a release unit with one hole in it costs is on the public record. Knight Capital deployed new code to eight SMARS servers and reached seven of them. The SEC's order describes the gap: “During the deployment of the new code, however, one of Knight’s technicians did not copy the new code to one of the eight SMARS computer servers. Knight did not have a second technician review this deployment and no one at Knight realized that the Power Peg code had not been removed from the eighth server, nor the new RLP code added. Knight had no written procedures that required such a review.” On 1 August 2012, processing 212 small retail orders, the system routed millions of orders over 45 minutes, obtaining over 4 million executions in 154 stocks for more than 397 million shares. Knight lost over $460 million. The SEC imposed a $12,000,000 civil money penalty. Seven of eight servers held the intended version. The release unit was the eighth.

Monitoring and incidents are two duties in statute too, and they run on different clocks. The EU AI Act requires providers of high-risk AI systems to establish and document a post-market monitoring system, based on a post-market monitoring plan that forms part of the Annex IV technical documentation. That is Article 72, and it is a standing obligation, owned continuously. Article 73 then sets the incident clocks. Serious incidents go to market surveillance authorities not later than 15 days after becoming aware, and not later than 10 days in the event of the death of a person. The widest cases move faster still: “Notwithstanding paragraph 2 of this Article, in the event of a widespread infringement or a serious incident as defined in Article 3, point (49)(b), the report referred to in paragraph 1 of this Article shall be provided immediately, and not later than two days after the provider or, where applicable, the deployer becomes aware of that incident.” A monitoring plan filed in Annex IV documentation and a two-day reporting deadline cannot be discharged by the same rota.

FigureProcess · 5 steps
  1. 1

    Release unit

    Model, prompt, tools, policies, state schema, graders, and dependencies.

  2. 2

    Latency budget

    Time allocated across planning, tools, approvals, retries, and response.

  3. 3

    Cost budget

    Tokens, tool fees, compute, storage, human review, and failure recovery.

  4. 4

    Monitoring

    Outcome, policy, state, latency, cost, and error indicators.

  5. 5

    Incident system

    Detection, containment, rollback, evidence, correction, and learning.

Steps

Prepare an agent production plan

The production plan is written for an agent you intend to launch, not for a hypothetical one. It has to show where cost lands when the agent fails quietly, so that healthy-looking numbers are not hiding what customers absorb. And it has to state what one successful, policy-compliant task costs to run.

First, define the release artifact: version every behavior-changing model, tool, policy, schema, and grader. The eighth SMARS server is the standing argument for treating this as one artifact rather than five deployments. Second, allocate budgets: task-level limits for time, calls, tokens, spend, and review, with the orchestrator's own published ceiling written in beside them. Third, choose rollout stages: offline eval, shadow, advisory, staged, canary, and gradual authority, promoted ring by ring with bake-in between rings.

Fourth, build operational dashboards that track outcomes, policy failures, loops, latency, cost, and unresolved tasks. This is the step most often written as an instruction rather than a specification. A mean is what hides the tail: “If you run a web service with an average latency of 100 ms at 1,000 requests per second, 1% of requests might easily take 5 seconds. If your users depend on several such web services to render their page, the 99th percentile of one backend can easily become the median response of your frontend.” — Rob Ewaschuk, 2016, in Google's Site Reliability Engineering. The prescription is concrete. Collect request counts bucketed by latency, a histogram with roughly exponentially spaced boundaries — 0–10 ms, 10–30 ms, 30–100 ms, 100–300 ms — instead of means. A mean latency panel for an agent is a panel that cannot show you the twelve-minute task.

Fifth, rehearse incidents: test pause, credential revocation, rollback, state repair, notification, and postmortem, against the deadlines the incident actually carries.

FigureProcess · 5 steps
  1. 1

    Define the release artifact

    Version every behavior-changing model, tool, policy, schema, and grader.

  2. 2

    Allocate budgets

    Set task-level limits for time, calls, tokens, spend, and review.

  3. 3

    Choose rollout stages

    Use offline eval, shadow, advisory, staged, canary, and gradual authority.

  4. 4

    Build operational dashboards

    Track outcomes, policy failures, loops, latency, cost, and unresolved tasks.

  5. 5

    Rehearse incidents

    Test pause, credential revocation, rollback, state repair, notification, and postmortem.

A quiet dashboard is not proof the agent works

A production agent should have a cheaper and safer fallback path. If the agent exceeds its budget or confidence boundary, the product still needs a valid way to serve or defer the task.

The operator on call does not take a quiet dashboard as proof that the system is working. The failures that hurt users are the ones nobody is counting. The component holding its 10ms median while 63% of assembled requests run over a second. The accuracy score that is identical at $134.50 and at $2.45. The eighth server that no second technician was required to review. What the operator reports instead is a single figure: cost per successful and policy-compliant task, with the tail and the review burden attached to it.

An agent with nowhere cheaper to fall back on turns its own budget and confidence limits into an outage.

Key takeaways