Pedro Olivares

Why AI Agents Break in Production

var(--variable-VtZ0WKehP)

Prototypes fool you. You run a demo, the agent calls the right tools, the output looks reasonable, and everyone in the room is nodding. Then you put it in front of real users and something breaks every third request. The error messages are cryptic. The retries make it worse. And nobody is sure whether the problem is the model, the prompt, the tool, or something in between.

This is not an edge case. It is the normal experience of shipping AI agents built on frameworks that were designed for experimentation, not production.

Here is what actually breaks, and why.

Agents fail when there is no contract between steps

Most agent frameworks let each step do whatever it wants. One tool returns a dictionary. The next one expects a string. The LLM fills in the gap with something plausible, and your application silently accepts the wrong answer. In a demo, this usually does not matter because you wrote the demo yourself and you know what the tool returns. In production, you are running someone else’s data, someone else’s edge case, and the LLM’s improvisation is no longer reliable.

The fix is schema validation at every boundary. Every input and output should be typed. Pydantic, or an equivalent, should reject bad data before it becomes a prompt. This is not novel software engineering; it is the same discipline applied to any API-driven system. What is novel is that agent frameworks have historically skipped it.

Non-determinism is a feature of models, not a feature of your system

The model being probabilistic does not mean your orchestration has to be. The parts of your system that you control (tool selection logic, error handling, retry behavior, branching conditions) should be deterministic. Reproducible. Testable. If you cannot write a unit test for a step in your workflow, that step is a risk.

When a workflow is deterministic in its structure, debugging becomes possible. You know which step failed. You know what input it received. You can replay it. When the orchestration is as fuzzy as the model, you cannot isolate failures and you cannot fix them systematically.

Observability is not optional at scale

You cannot debug what you cannot see. The minimum viable observability for an AI agent in production is: which tools were called, in what order, with what inputs, producing what outputs, at what latency, with what token cost. If you are looking at logs that just say “agent run failed”, you are debugging in the dark.

The deeper issue is that most developers add observability after something goes wrong. By then, you are reconstructing the failure from incomplete evidence. Observability needs to be there from the first deployment, capturing every run in a structured format you can query.

What a deterministic runtime actually changes

At Timbal, the agent and workflow layer is built around a runtime that treats determinism as a first-class concern. Workflows are defined explicitly. Steps are typed. Tool calls validate their inputs and outputs against a schema before the model ever sees the result. Every run produces a full execution trace.

This does not make agents easier to build in a demo. It makes them possible to maintain in production. Those are different problems, and most frameworks only solve the first one.

If you are evaluating AI infrastructure for a production deployment, the questions to ask are: can I write a test for this? can I replay a failed run? do I have a structured trace of every execution? If the answer to any of those is no, you are building on sand.