Production Agents: From Demo to Deployment

A 9-part series on what breaks when agents hit production. Idempotency, state persistence, cost control, observability, durable execution, security, and evaluation. The stuff tutorials skip.

Your agent works beautifully in development. It demos perfectly. Then you deploy it.

And it:

  • Books the same flight twice when the API times out
  • Loses all progress when a user closes their browser
  • Burns through your monthly API budget in 3 hours
  • Sends 47 follow-up emails because it didn’t know it was waiting
  • Does the wrong thing without crashing — and you don’t find out until a customer complains

You’re not alone. Only 2% of organizations have successfully deployed agentic AI at scale. Gartner predicts 40%+ of agentic AI projects will be canceled by 2027 due to cost overruns and inadequate risk controls.

The problem isn’t your agent’s reasoning. It’s everything around the reasoning that tutorials don’t teach.

So I wrote the series I wished existed when I started shipping agents.

What This Series Covers

9 parts covering what actually breaks in production:

PartTopicWhat You’ll Learn
0OverviewWhy 98% haven’t deployed, the six capabilities tutorials skip
1Idempotency & Safe RetriesThe Stripe pattern, error classification, preventing duplicate bookings
2State PersistenceCheckpointing, crash recovery, resumable workflows
3Human in the LoopApproval gates, escalation patterns, async handoffs
4Cost ControlToken budgets, circuit breakers, preventing runaway loops
5ObservabilitySilent failures, semantic monitoring, the metrics that matter
6Durable ExecutionTemporal, Inngest, Restate — when to use each
7Security & SandboxingTool permissions, prompt injection defense, blast radius
8Testing & EvaluationTask completion metrics, trajectory quality, regression testing

The Tutorial vs Production Gap

What Tutorials Teach vs What Production Needs
┌─────────────────────────────────────────────────────────┐
│                    TUTORIAL VIEW                        │
│                                                         │
│        ┌──────────┐                                     │
│      ┌─▶│ OBSERVE  │◀── environment                     │
│      │ └────┬─────┘                                     │
│      │      │                                           │
│      │      ▼                                           │
│      │ ┌──────────┐                                     │
│      │ │  THINK   │◀── reasoning                        │
│      │ └────┬─────┘                                     │
│      │      │                                           │
│      │      ▼                                           │
│      │ ┌──────────┐                                     │
│      │ │   ACT    │──▶ execute                          │
│      │ └────┬─────┘                                     │
│      │      │                                           │
│      └──────┘                                           │
│       (repeat)                                          │
│                                                         │
│   "Just implement the loop and you are done!"           │
└─────────────────────────────────────────────────────────┘


What Tutorials Teach vs What Production Needs
  ┌─────────────────────────────────────────────────────────┐
  │                     PRODUCTION VIEW                     │
  │                                                         │
  │   ┌──────────┐                                          │
  │   │ OBSERVE  │ ──▶ What if API times out?               │
  │   └────┬─────┘     What if data is stale?               │
  │        │                                                │
  │        ▼                                                │
  │   ┌──────────┐                                          │
  │   │  THINK   │ ──▶ What if reasoning costs $50?         │
  │   └────┬─────┘     What if it loops forever?            │
  │        │                                                │
  │        ▼                                                │
  │   ┌──────────┐                                          │
  │   │   ACT    │ ──▶ What if action is irreversible?      │
  │   └────┬─────┘     What if we crash mid-action?         │
  │                      What if it needs approval?         │
  │                                                         │
  │ Required: Idempotency, Checkpointing, Cost limits,      │
  │            Observability, Human gates, Security         │
  └─────────────────────────────────────────────────────────┘

Why This Structure?

Each part follows a pattern:

  1. What can go wrong — real production failures
  2. Why it happens — the underlying cause
  3. How to prevent it — patterns that work
  4. Implementation — code you can use
  5. Trade-offs — nothing is free

No hand-waving. Just mechanics.

Who This Is For

You should read this if:

  • You’ve built agents that work in demos but fail in production
  • You’re about to deploy your first agent and want to avoid the pitfalls
  • You’re debugging production agent issues and need a framework
  • You’re evaluating whether to build vs buy agent infrastructure

You probably don’t need this if:

  • You’re building simple single-turn LLM applications
  • You’re doing research, not production systems

The Cost of Getting It Wrong

Production Failure Costs
┌─────────────────────────────────────────────────────────┐
│              PRODUCTION FAILURE COSTS                   │
│                                                         │
│  Failure Mode          │ Business Impact                │
│  ──────────────────────┼──────────────────────────────  │
│  Double booking        │ Refunds, angry customers       │
│  Lost progress         │ Users abandon, re-do work      │
│  Cost overrun          │ $10K+ surprise bills           │
│  Silent failure        │ Wrong results shipped          │
│  Security breach       │ Data exposure, compliance      │
│                                                         │
│  68% of teams hit budget overruns in first deployment   │
│  50% cite "runaway loops" as the cause                  │
│  API downtime surged 60% between Q1 2024 and Q1 2025    │
└─────────────────────────────────────────────────────────┘

Start Here

If you’re new to production agents: Start from the overview

If you’re debugging duplicate operations: Idempotency patterns

If you’re dealing with cost issues: Cost control

If you’re evaluating frameworks: Durable execution


This complements the AI Engineering Fundamentals series. That one covers how LLMs work. This one covers how to ship them.

→ Browse the full Production Agents series