Harness Engineering

Why AI Agent Demos Fail in Production (and the Harness That Fixes It)

By Expedey Engineering · Updated · 2 min read

Short answer

Demos run on clean inputs, short tasks and happy paths. Production brings messy data, long tasks, failing APIs, loops, rising costs, risky actions and no way to tell whether a change made things better. Each of these has a fix in the harness around the model: evaluations, context management, failure handling, stop conditions, budgets, approvals and tracing.

The demo gap

A demo proves an agent can do a task once. Production asks it to do the task thousands of times, on inputs nobody prepared, while connected to systems that sometimes fail. The model is usually the same in both. What changes is everything around it: the harness.

Seven failure modes and their fixes

Apart from model routing, each fix is implemented in our open-source agent harness template.
What breaksWhyThe harness fix
Real inputs are messier than the demoScanned PDFs, typos, missing fields, mixed languagesAn evaluation set built from real cases, scored on every change
Long tasks lose the plotOld tool output crowds out the instructionsContext management: trim or summarise old steps, keep the instructions
One failed API call ends the runNo retries, no fallback, errors raised as exceptionsRetries with backoff, fallback models, errors returned to the model as messages
The agent loopsNo stop conditionsStep limits, repeated-call detection and a definition of done
Costs climb with usageEvery step uses the biggest model with the full historyBudgets per run, smaller models for simple steps, tracked cost per task
A risky action happens uncheckedBroad permissions; policy only in the promptLeast-privilege tools, approval for writes, policy enforced in the tool
Nobody can say if a change helpedNo traces, no metricsA trace for every run and a pass rate for every release

A demo-to-production checklist

  • 20-50 real cases with expected behaviour, scored automatically.
  • A step limit, a token or cost budget and a time limit on every run.
  • Typed, validated tools; write tools behind approval; rules enforced in the tools.
  • Retries for transient errors and at least one fallback model.
  • Old context trimmed before each model call.
  • A trace per run with tokens, cost, latency and every tool call.
  • A way for the agent to hand off to a person, and a staged rollout: shadow mode, then partial traffic, then full.

Frequently Asked Questions

Is the model the reason agents fail in production?

Usually not. Most production failures come from missing stop conditions, weak tools, unmanaged context, no evaluations or no permission checks. A better model reduces some mistakes but doesn't add any of those safeguards.

How long does it take to take an agent from demo to production?

For one workflow, typically a few weeks for a pilot with evaluations and tracing, and several more for integrations, approvals and a staged rollout. The evaluation results decide when it's ready.

Stuck Between Demo and Production?

Expedey is a team of forward-thinking individuals working and servicing clientele across the globe for their software development requirements.

Our Offices

Contact Us

© 2024 Expedey. All Rights Reserved.