← Lab
Field note·Agentic Systems & Orchestration·6 min read

AI Agents in Production — What Actually Breaks

An agent that works in a demo and an agent that works in production are two different systems. The gap is almost never the prompt.

AI Agents in Production — What Actually Breaks

Demo agents are judged on whether they can do the task once. Production agents are judged on what happens the other times — when a tool times out, when the model loops, when someone asks for a refund it should not grant. Treating the agent as an execution system rather than a chat interface is what closes that gap.

Start narrower than feels useful

The most common structural mistake is one large agent that does everything. It cannot be tested, because there is no defined success condition. It cannot be debugged, because every failure has a dozen possible causes. Scope can always be widened later; a monolith cannot be un-tangled under pressure.

Start here
  • One use case
  • A small tool set
  • A measurable success condition
  • Support triage, document extraction
Not here
  • A full autonomous workflow
  • Dozens of tools
  • Vague goals
  • “handle everything”

State belongs outside the conversation

If the only record of what an agent has done lives in its message history, a restart loses everything and the agent repeats work it already completed. Persist state externally, keyed by a run id, and let the conversation be a view of that state rather than the state itself.

Errors are information, not crashes

A failed tool call should return a structured error the agent can reason about — retry, try a different tool, or escalate. Raising an exception ends the run and throws away everything learned up to that point.

The eight failure modes worth designing against

01Weak orchestrationOne agent doing everything. Fix: one use case, a small tool set, a measurable outcome.
02Weak state handlingState lives in the transcript. Fix: persist outside the model, keyed by run id.
03No termination conditionNothing tells the loop it is stuck. Fix: max iterations, wall-clock timeout, graceful partial result.
04Unbounded tool accessEvery agent can call every tool. Fix: per-agent allow-lists and confirmation rules held as data.
05No observabilityFailures are read from raw logs. Fix: a span per tool call, correlated by one run id.
06Errors as exceptionsOne failure kills the run. Fix: structured errors the agent can act on.
07No evaluationChanges ship on impression. Fix: a fixed question set scored on every change.
08Context sprawlEverything known gets stuffed in. Fix: give each step only what that decision needs.
What to take away
  • Scope one use case with a measurable success condition before widening.
  • Persist agent state outside the conversation, keyed by a run id.
  • Return structured errors so a failed tool call is recoverable.
  • Put permissions and limits in code, never only in the prompt.

Field notes on building production AI systems — collected, verified and written up so they are useful to anyone working on the same problems.

smoke
“Innovation distinguishes between a leader and a follower.”

Need an AI system that holds up in production? Tell me what breaks today and I'll tell you what I'd build.

Call Me now !

mail

abdelmajidzaddi088@gmail.com

address

Mohammedia, Morocco

phone

+212 695 557 631