Skip to content
30 November 2026 An independent technology publication
Guide

AI agents in production: 9 Brutal lessons for 2027

AI agents in production fail in predictable ways. 9 lessons on compounding errors, consistency, token costs, evals, guardrails and monitoring, with real numbers.

AI agents in production: hard lessons for 2027, DevQuarry featured image

Running AI agents in production is mostly an operations problem. Getting a demo to work takes an afternoon. Keeping it correct and affordable across thousands of real cases is the hard part. It takes the discipline any production system needs, applied to software that can choose its own next step.

The evidence for that comes from both data and war stories. In Zapier’s September 2026 survey of 513 US enterprise leaders, 71% said they had AI agents in production, yet only 30% said their agents completed more than 60% of assigned tasks without human help. Gartner predicted in 2025 that over 40% of agentic AI projects will be cancelled by the end of 2027. On Reddit and Hacker News, builders keep describing the same failures. Errors go unnoticed and costs run away. An agent that worked on Tuesday fails on Wednesday.

The nine lessons that follow cover making agents work after launch. Each rests on numbers I computed or on sources you can check.

AI agents in production: hard lessons for 2027, DevQuarry featured image

The short version

  • Errors compound. With 95% success per step, a 20-step task succeeds about 36% of the time.
  • One success proves little. At 60% success per attempt, the chance of succeeding on 8 out of 8 tries is under 2%.
  • Agent token use grows roughly with the square of the number of turns when history is re-sent each time.
  • In my simulation, a check after each step plus one retry lifted a 20-step task from 36% to 78% success, even when the check missed one failure in five.
  • Narrow scope and tight permissions matter as much as the model. So do evaluation sets with cost limits, plus full traces.

Why AI agents in production are different from demos

A demo succeeds once on a task chosen to show it off. Production means every case: strange inputs and missing data, APIs that slow down or change, and users who phrase things in ways nobody tested.

DemoProduction
Inputshand-pickedwhatever arrives
Success measureit worked this timeit works on a known share of cases, every week
Failuresrestart and try againsomeone’s order, refund or data is affected
Costignoredtracked per task and per month
Toolsstable during the demoAPIs change or time out
Accountabilitynonelogs with an audit trail

On Reddit, an r/AI_Agents thread from April 2026 titled “Deploying production AI Agents at scale” made the point directly: building agents is no longer the hard part; operating them is. People raised versioning of prompts and tools as one problem. Permissions came up too, as did tracing what happened when several agents worked together.

Lesson 1: errors compound across steps

AI agents in production: task success vs number of steps for different per-step reliability

If an agent must get every step right and each step succeeds independently with probability p, a task of n steps succeeds with probability pⁿ. I computed the grid for typical values:

Per-step success5 steps10 steps20 steps50 steps
99%95.1%90.4%81.8%60.5%
97%85.9%73.7%54.4%21.8%
95%77.4%59.9%35.8%7.7%
90%59.0%34.9%12.2%0.5%

Real steps are not fully independent, and some errors are recoverable, so treat this as a model. It still explains why long autonomous tasks disappoint: a step that works 95% of the time sounds reliable until you chain twenty of them.

What to do about it:

  1. Keep tasks short. Split long jobs into stages with a check between each.
  2. Make each step as reliable as possible with well-designed tools and clear instructions with examples.
  3. Add validation where a step’s output can be checked cheaply (schemas, totals, IDs that must exist).
  4. Let the agent recover: return clear tool errors it can act on, not stack traces.

Lesson 2: measure consistency across runs

AI agents in production: pass@k vs pass^k consistency for a 60% per-attempt success rate

Two metrics answer different questions:

  • pass@k: does the agent succeed at least once in k attempts? Useful for research and for tasks where a human picks the best try.
  • pass^k: does it succeed on all k attempts? This is the production question, because each attempt is a different customer.

For an agent with 60% success per attempt:

kpass@k (at least one success)pass^k (all succeed)
160.0%60.0%
284.0%36.0%
497.4%13.0%
899.9%1.7%

Sierra’s τ-bench, which tests agents serving simulated customers under company policies, popularised pass^k. In its 2024 results, the best agent at the time averaged under 50% success, and its retail score dropped to about 25% at pass^8. Models have improved a great deal since then, but the lesson holds: report how consistently an agent solves the same kind of task, not whether it can.

Lesson 3: agent costs grow faster than you expect

AI agents in production: input tokens grow with the square of the number of turns

Most agent loops send the whole conversation, including every earlier tool result, back to the model on each step. If an agent starts with 2,000 tokens of instructions and tool schemas and adds 800 tokens per turn, the input it pays for grows much faster than the content:

TurnsInput tokens billed, history re-sent each turnTokens of actual content
522,0006,000
1064,00010,000
20208,00018,000
40736,00034,000

Doubling the turns from 20 to 40 more than triples the input bill. Prompt caching from model providers reduces the price of repeated prefixes, and summarising old turns shrinks the history, but both need deliberate design.

Cost surprises are common in community discussion. In an Ask HN thread on bringing agentic applications to production, one team described an outage that turned out to be exhausted API credits; procurement started scrutinising token use afterwards. In May 2026, coding-agent subreddits filled with complaints about usage limits being hit by small tasks, and a popular r/codex tip was to reserve the expensive agent for architecture and high-risk work.

Practical cost controls:

  • a hard cap per task on steps and on spend
  • alerts on cost per task as well as monthly totals
  • cheaper models for routine steps and stronger models only where they change the outcome
  • trimming tool outputs before they enter the context (return the 5 relevant fields, not the whole record)
  • caching repeated instructions and tool definitions

Lesson 4: checkpoints beat bigger models

AI agents in production: success rate of a 20-step task with and without validation and retries

A better model raises per-step reliability a little. A checkpoint can raise task reliability a lot. I simulated a 20-step task with 95% per-step success over 100,000 runs:

DesignTasks completed successfully
No checks35.7%
Validate each step, retry once (validator catches 80% of failures)78.4%
Validate each step, retry once (validator catches every failure)95.1%

Even an imperfect validator more than doubled the success rate. The catch is that you need something to validate against: a schema, an invariant, a test, a second model acting as a grader, or a human.

A small guard around every tool call goes a long way. This pattern caps steps and spend, and uses an idempotency key so a retried action never runs twice:

class Budget:
    def __init__(self, max_steps=15, max_usd=0.50):
        self.steps, self.usd, self.max_steps, self.max_usd = 0, 0.0, max_steps, max_usd

    def charge(self, usd):
        self.steps += 1
        self.usd += usd
        if self.steps > self.max_steps or self.usd > self.max_usd:
            raise RuntimeError(f"Budget exceeded after {self.steps} steps (${self.usd:.2f})")

def run_tool(tool, args, task_id, step, done_keys):
    key = f"{task_id}:{step}:{tool.__name__}"      # same task, step and tool = same action
    if key in done_keys:                           # a retry must not refund or email twice
        return done_keys[key]
    result = tool(**args)
    done_keys[key] = result
    return result

Lesson 5: shared state breaks silently

The most instructive war story in the Ask HN thread came from a team running two agents against a shared plan file. One agent updated the plan mid-run while the other kept working from its original copy. Both produced plausible output without raising an error. The problem surfaced only in review, after hours of wasted generation. Their fix was cheap: stamp a version on every shared artifact and re-check the version before acting on it.

Agents fail quietly far more often than ordinary code. Watch for:

  • stale reads: acting on data another agent or process has since changed
  • partial actions: a tool that times out after doing half its work
  • duplicate actions: a retry that sends a second email or a second refund
  • drift: tools, prompts or models updated underneath a running agent

Versioned shared state and idempotent tools are standard distributed-systems practice, and agents need them just as much.

Lesson 6: evaluation sets for AI agents in production

AI agents in production: the evaluation and monitoring loop

An agent without an evaluation set has no definition of “working”. Build one before you widen access:

  1. Collect 50 to 200 real past cases, including the awkward ones.
  2. Write down the correct outcome for each, or a rubric if outcomes vary.
  3. Run the agent on every case several times. Record the pass rate and the cost.
  4. Re-run the set on every change to prompts, tools, models or framework versions.
  5. Add every production failure to the set once it is understood.

Combine checks of different strengths: exact checks where outcomes are fixed (the right order ID, the right category), model-graded checks for open-ended text with a clear rubric, and human review on a sample. Track pass^k next to cost per task and escalation rate, because improving one often worsens another.

Lesson 7: narrow scope and least privilege

Practitioners describing working enterprise agents in 2026 kept naming the same kinds of work, such as IT help desks and claims intake, always with human review. That matches Zapier’s survey, where document work topped the list of uses two years running, and where agents embedded in broader automated workflows were far more autonomous (77% of leaders reported high autonomy) than standalone ones (8%).

Scope and permissions are how you get there:

ControlExample
One job per agent“triage IT tickets” instead of “help IT”
Read-only by defaultlookups need no approval; writes do
Approval for irreversible actionsrefunds, deletions, payments, external emails
Scoped credentialsa token for one mailbox, not the whole tenant
Separate identitieseach agent gets its own identity and audit trail
Isolationcode execution in a sandbox, not on a shared server

The industry is building these controls into platforms. In November 2026, Microsoft launched a Copilot agent with its own Entra identity, LangChain released sandboxes that run agent code in isolated microVMs, and OpenAI added app allowlists and approval steps to ChatGPT for Healthcare. If you connect tools through the Model Context Protocol, our MCP guide covers tool annotations and the security checklist, and our prompt injection guide covers the attack that permissions are there to contain.

Lesson 8: observability for AI agents in production

AI agents in production: reference architecture with gateway, policies, tools, tracing and human review

When an agent misbehaves, you need to replay exactly what it saw and did. Log, for every run:

  • the input, plus the model version and prompt version
  • every model call with its token count
  • every tool call with its arguments and result, or the error it raised
  • every approval or human edit
  • the final outcome, and whether someone corrected it later

Then watch a small set of signals:

SignalWhat a change tells you
Task success rate (from sampled reviews or automatic checks)quality drifting
Escalation rate to humansthe agent meeting cases it cannot handle
Steps per taskloops, confusion or tool failures
Cost per taskcontext bloat or model changes
Tool error rate by toolan API change or outage
Latency at the 95th percentileslow tools or long loops

Many teams underestimate this work. A comment in the Ask HN thread summed it up: nobody warns you how much time the “boring infra stuff” around agents consumes.

Lesson 9: roll out like a risky feature

Treat an agent launch like any change that can hurt customers:

  1. Shadow mode: the agent proposes, humans act, you compare against the evaluation set and real outcomes.
  2. Assisted mode: the agent acts on low-risk cases, humans approve the rest.
  3. Limited autonomy: the agent handles a defined slice of traffic on its own, with sampled reviews plus a rollback switch.
  4. Wider autonomy: expand one permission or one case type at a time, only while the metrics hold.

Keep a kill switch that routes everything back to the previous process, and plan for the model provider being slow or down. One practitioner’s review of agent frameworks recalled a production agent that went down during a provider outage because nothing handled the failure. A fallback model, or a queue that waits for a human, is cheap insurance.

AI agents in production: what the 2026 data says

Several large surveys in 2026 measured how far companies have taken agents. Read together, they show experimentation everywhere with narrower success.

SourceSampleWhat it found about AI agents in production
McKinsey, State of AI (Aug 2026)1,719 respondents40% of companies with over $1 billion revenue are scaling agents, up from 27% a year earlier; smaller firms held at 22%
Zapier AI agents survey (Sep 2026, vendor)513 US enterprise leadersproduction use rose from 40% to 71% in a year; 46% say their most mature agent has paid for itself or will within 12 months
Zapier, same surveytop barriers: privacy and compliance concerns (27%), then accuracy (24%)
Gartner prediction (Jun 2025)analyst forecastover 40% of agentic AI projects cancelled by the end of 2027

Two caveats apply. Zapier sells agent tooling and surveyed large US companies already using AI, so its numbers lean optimistic. McKinsey’s figure counts organisations scaling agents somewhere, not the share of work agents do. Neither contradicts the practitioner picture: AI agents in production are common in a few well-bounded functions and rare as general-purpose workers.

Build, buy or configure?

Teams putting AI agents in production in 2026 had three broad routes, each with a different split of effort.

RouteWhat you doGood fitWatch out for
Buy a vertical agentadopt a product built for one job (support, coding, sales research)common processes with a mature productdata access, lock-in, per-seat or per-task pricing
Configure on a platformbuild agents in an automation or agent platform (n8n, Zapier or Microsoft Copilot Studio, for example)internal operations, small teamsplatform limits, billing per step or per run
Build with a frameworkwrite the agent with a library such as LangGraph or Pydantic AIcore products, unusual workflowsyou own evaluation plus hosting

The lessons in this article apply to all three. A bought agent still needs an evaluation set drawn from your own cases, and a configured one still needs cost limits. Our n8n vs Zapier vs Make comparison shows how the billing model of a platform changes the cost of the same agent workflow.

Who owns AI agents in production?

Ownership is the question teams most often skip. A demo belongs to whoever built it, while AI agents in production need someone on the hook when a case goes wrong at 2 a.m. In the threads I read, the arrangements that worked looked like ordinary service ownership:

  • One named team owns the agent, its evaluation set and its budget.
  • The business owner of the process signs off on what “correct” means and reviews a sample of outcomes each week.
  • Whoever runs the systems the agent touches decides which permissions it gets.
  • An on-call rotation knows how to pause the agent and fall back to the manual process.

When no single team owns an agent, failures tend to be found late and fixed by nobody. Writing the owner into the launch checklist costs nothing.

Signs an agent is not ready for production

Before launch, look for these warning signs in testing:

  1. Success on the evaluation set changes noticeably between runs of the same cases.
  2. Nobody can say what “correct” means for a third of the cases.
  3. Cost per task varies by a factor of ten or more between cases.
  4. The agent needs write access to systems it only reads in practice.
  5. Failures are discovered by users, not by checks.
  6. The prompt has grown into a long list of special cases.

Any one of these is a reason to narrow the scope or add checkpoints before widening access. The last sign deserves attention: when instructions keep growing to patch failures, the job is usually too broad for one agent, or parts of it belong in a fixed workflow.

A checklist for AI agents in production

AreaBefore launch
Scopeone clearly defined job, with written success criteria
Evaluation50+ real cases with expected outcomes, run several times each
Reliabilityvalidation at checkpoints, retries with idempotency keys, clear tool errors
Costper-task limits on steps and spend; cost alerts
Securityleast-privilege credentials, approval for irreversible actions, sandboxed code execution
Stateversioned shared artifacts, no hidden shared files
Observabilityfull traces of model calls and tool calls, with approvals
Rolloutshadow mode first, kill switch, provider fallback
Ownershipa named owner who reviews failures weekly

If you are still choosing tools, our comparison of AI agent frameworks covers which libraries provide durable state and approvals out of the box, and our guide to agentic AI explains when a plain workflow is the better choice.

FAQ

Why do AI agents fail in production?

Mostly because small error rates compound over many steps, and because one success hides inconsistency across many cases. Real inputs are also messier than test data. Without checkpoints or clear success criteria, these failures stay hidden.

How do you evaluate an AI agent?

Build a set of real past cases with known correct outcomes, run the agent on each case several times, and measure how often it succeeds on every attempt (pass^k) alongside cost per task. Re-run the set after every change to prompts, tools or models.

How much do AI agents cost to run?

It depends on the model and on how much context each step carries. Because many agents re-send their history each turn, input tokens grow roughly with the square of the number of turns: a 40-turn run in my model billed about 736,000 input tokens for 34,000 tokens of content. Step limits and smaller tool outputs keep costs down. Caching helps too, as do cheaper models for routine steps.

What is a human in the loop for AI agents?

It means a person reviews, approves or corrects agent actions at defined points, such as before refunds, deletions or external messages. Teams running AI agents in production commonly keep human review for anything irreversible.

Should AI agents run fully autonomously?

Rarely, at first. In Zapier’s survey only 30% of companies said their agents completed most tasks unaided, so fully autonomous AI agents in production are still the exception. Start in shadow mode, move to assisted mode, then widen autonomy one case type or permission at a time while the metrics hold. Keep a kill switch and a fallback when the model provider is unavailable.

What keeps AI agents in production running

The agents that survive production are narrow and measured, and boring in the right ways. Each has one job with clear success criteria. It runs inside a budget with least-privilege permissions and leaves a full trace. The model matters, and it keeps improving, but none of these lessons go away with a better model. They are what turns a clever demo into software people can depend on.

About the author Aradhya Chaudhary

Data Scientist | Freelancer | Speaker & Writer skilled in programming, development and building AI/ML backed systems.

More from Aradhya
Keep reading

More in AI & ML

All of AI & ML →