{"id":53348,"date":"2026-05-28T01:28:41","date_gmt":"2026-05-28T01:28:41","guid":{"rendered":"https:\/\/www.europesays.com\/ai\/53348\/"},"modified":"2026-05-28T01:28:41","modified_gmt":"2026-05-28T01:28:41","slug":"most-ai-agents-fail-in-production-because-theyre-built-backwards","status":"publish","type":"post","link":"https:\/\/www.europesays.com\/ai\/53348\/","title":{"rendered":"Most AI Agents Fail in Production Because They\u2019re Built Backwards"},"content":{"rendered":"<p class=\"wp-block-paragraph\">agent system seriously fail in production, it wasn\u2019t dramatic. There was no crash. No error message. The system just kept running and producing outputs that looked reasonable until someone actually read them carefully enough to notice something was off.<\/p>\n<p class=\"wp-block-paragraph\">When we decided to look into it, it took us two days\u2019 worth of debugging to figure out what was going on. Funny enough, the model wasn\u2019t hallucinating, and the input-output tools were delivering the correct results.<\/p>\n<p class=\"wp-block-paragraph\">The problem, when we finally found it, was architectural. The model and the tools were set up correctly, but the idea was that reasoning would tie the whole thing together, which, as you would guess, obviously failed.<\/p>\n<p class=\"wp-block-paragraph\">Turns out reasoning does not do that sort of thing.<\/p>\n<p class=\"wp-block-paragraph\">That experience is what I keep coming back to when I think about why so many AI agents that work in demos don\u2019t really survive real-world use.<\/p>\n<p class=\"wp-block-paragraph\">It\u2019s not a capability problem. <\/p>\n<p class=\"wp-block-paragraph\">It\u2019s an architectural one.<\/p>\n<p class=\"wp-block-paragraph\">And if you\u2019ve read my previous piece here on TDS, <a href=\"https:\/\/towardsdatascience.com\/why-ai-engineers-are-moving-beyond-langchain-to-native-agent-architectures\/\" rel=\"nofollow noopener\" target=\"_blank\">Why AI Engineers Are Moving Beyond LangChain to Native Agent Architectures<\/a>, the pattern should sound familiar: systems built top-down, from goal to tools to model, with the quiet assumption that intelligent behavior fills in the gaps.<\/p>\n<p class=\"wp-block-paragraph\">That assumption is what \u201cbuilt backwards\u201d means. And it\u2019s more common than most teams realize until something breaks.<\/p>\n<p>Agents Aren\u2019t Entities. They\u2019re Systems.<\/p>\n<p class=\"wp-block-paragraph\">A production AI agent isn\u2019t a single intelligent thing.<\/p>\n<p class=\"wp-block-paragraph\">Rather, there is a set of interacting pieces with different responsibilities, failure modes, and levels of observability.<\/p>\n<p class=\"wp-block-paragraph\">The LLM is one of those components, not the whole system. Just one piece of it.<\/p>\n<p class=\"wp-block-paragraph\">It may sound obvious when you say it out loud. But the \u201cautonomous agent\u201d framing that dominated 2023 and most of 2024 kept pulling engineers toward a different mental model: one entity, one reasoning loop, everything handled by the model.<\/p>\n<p class=\"wp-block-paragraph\">All you need is tools, a good system prompt, and a hope that everything will fall into place.<\/p>\n<p class=\"wp-block-paragraph\">In contrast, engineers who have shipped real AI-based products rarely describe their systems that way. What they actually describe sounds a lot more like distributed systems architecture. <\/p>\n<p class=\"wp-block-paragraph\">Not because they read a book about design patterns, but because they got burned enough times that they started putting structure more seriously in their workflow.<\/p>\n<p class=\"wp-block-paragraph\">Building top-down, starting from \u201cwhat should this agent do\u201d and working backwards into tools and prompts, is quick to get started.<\/p>\n<p class=\"wp-block-paragraph\">It\u2019s also how you end up with a system where the model is responsible for too much, and nothing is individually debuggable.<\/p>\n<p class=\"wp-block-paragraph\">The architecture was decided by the goal, not by the engineering requirements. <\/p>\n<p class=\"wp-block-paragraph\">That\u2019s the backwards part.<\/p>\n<p>So What Really Goes Into a Production System?<\/p>\n<p class=\"wp-block-paragraph\">The abstract version is easy to nod along to. Here\u2019s what it actually looks like.<\/p>\n<p class=\"wp-block-paragraph\">Every production AI system I have seen that works cleanly has something like a decision layer, whether the team named it like this or not. It\u2019s the part where the model lives and does its actual job.<\/p>\n<p class=\"wp-block-paragraph\">The instinct is to push everything into this layer: parsing requests, managing memory, handling retries, resolving tool failures.<\/p>\n<p class=\"wp-block-paragraph\">This is okay if you\u2019re working in a Jupyter notebook. In production, under load, with real users, this becomes the part of your system where everything is everyone\u2019s fault, and most times, nothing can be debugged.<\/p>\n<p class=\"wp-block-paragraph\">The decision layer should do one thing well, and that is deciding what to do next, given a certain context that is already prepared for it.<\/p>\n<p class=\"wp-block-paragraph\">That\u2019s the whole job.<\/p>\n<p class=\"wp-block-paragraph\">Who prepares the context? Something else. Who acts on the decision? Also something else.<\/p>\n<p class=\"wp-block-paragraph\">That \u201csomething else\u201d is the orchestration layer, and in most well-built systems, it\u2019s genuinely just code: conditionals, asynchronous runners, retry handling, queue routing, maybe even a state machine depending on how involved the workflow is.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.europesays.com\/ai\/wp-content\/uploads\/2026\/05\/mermaid-diagram-2026-05-23-171820-1024x490.png\" alt=\"\" class=\"wp-image-661678\"\/>Instead of expecting the model to do everything, treat it like just another component. Here, standard code does the heavy lifting with state and tools, so the LLM only has to worry about making the next decision. Image by author.<\/p>\n<p class=\"wp-block-paragraph\">Many teams reach for frameworks here because bare orchestration code feels too simple, like surely there\u2019s supposed to be more infrastructure.<\/p>\n<p class=\"wp-block-paragraph\">There usually isn\u2019t. <\/p>\n<p class=\"wp-block-paragraph\">The less magic this layer contains, the faster you\u2019ll find bugs when they appear. And they will appear.<\/p>\n<p class=\"wp-block-paragraph\">From experience, I learned this the hard way on a project where the orchestration lived inside a framework\u2019s execution model. Something was retrying tool calls in a way that was corrupting state downstream. <\/p>\n<p class=\"wp-block-paragraph\">We spent two days finding the issue. Two days for a bug that could have been resolved in no time at all if the retry logic had been three lines of Python I wrote myself.<\/p>\n<p class=\"wp-block-paragraph\">This leads us to the tools and execution layer, where all communication happens.<\/p>\n<p class=\"wp-block-paragraph\">Now, the tools and execution layer is where things talk to the outside world. This layer usually has just one job, and that is to take a well-defined input and then produce a predictable output.<\/p>\n<p class=\"wp-block-paragraph\">But the failure I kept seeing, and kept repeating, honestly, was tools that tried to be helpful by doing more than one thing. A single function that calls an API, updates a cache, and does other things. <\/p>\n<p class=\"wp-block-paragraph\">In a setup like that, when it breaks, you don\u2019t know where. Even when you try to replace the API, you\u2019re untangling logic that shouldn\u2019t have been tangled in the first place.<\/p>\n<p class=\"wp-block-paragraph\">Memory and state is where I\u2019d push hardest, because it\u2019s where most teams are most underprepared. <\/p>\n<p class=\"wp-block-paragraph\">Most teams think about memory as \u201cwhat the model knows.\u201d The more important question is what the system knows, and whether that knowledge is current.<\/p>\n<p class=\"wp-block-paragraph\">I remember one day when it took me an afternoon to debug what seemed to be a simple \u201cmodel hallucination.\u201d The model had kept referring to user preferences, which, however, had been updated twenty minutes ago.<\/p>\n<p class=\"wp-block-paragraph\">That\u2019s not a model problem. <\/p>\n<p class=\"wp-block-paragraph\">That\u2019s a systems problem. <\/p>\n<p class=\"wp-block-paragraph\">And it\u2019s surprisingly common.<\/p>\n<p class=\"wp-block-paragraph\">In multi-agent systems, specifically, shared state is where subtle failures breed. One agent updates something. The others don\u2019t know.<\/p>\n<p class=\"wp-block-paragraph\">Everyone proceeds confidently in slightly different directions. The output looks almost right, which is <a href=\"https:\/\/towardsdatascience.com\/the-multi-agent-trap\/\" rel=\"nofollow noopener\" target=\"_blank\">almost worse than looking wrong<\/a>.<\/p>\n<p class=\"wp-block-paragraph\">And then there\u2019s evaluation and observability, which almost everyone always puts off until something goes wrong. I\u2019ve been guilty of this, too.<\/p>\n<p class=\"wp-block-paragraph\">The difference I keep in mind is that logging tells you what happened. Observability tells you <a href=\"https:\/\/www.datadoghq.com\/state-of-ai-engineering\/\" rel=\"nofollow noopener\" target=\"_blank\">whether what happened was correct<\/a>. In a deterministic system, those are close to the same thing.<\/p>\n<p class=\"wp-block-paragraph\">In an AI system, it\u2019s not. You have to be able to follow the specific request from start to finish, including what information the model had to consider, what decision it made, what external API call it invoked, and how it acted upon its response.<\/p>\n<p>Building It the Right Way Around<\/p>\n<p class=\"wp-block-paragraph\">It starts with the top-down approach: I want an agent to do X, so I\u2019ll give it the tools, a nice system prompt, and if the model is smart enough, it will be fine.<\/p>\n<p class=\"wp-block-paragraph\">And this is exactly what people use to make prototypes, and why wouldn\u2019t they? They are not wrong.<\/p>\n<p class=\"wp-block-paragraph\">But here\u2019s the thing: the problem is that it treats the architecture as a consequence of the goal rather than as something you design deliberately.<\/p>\n<p class=\"wp-block-paragraph\">Then the system grows. You know, more tools, more workflows, more edge cases, more users, and suddenly there\u2019s no real foundation underneath any of it.<\/p>\n<p class=\"wp-block-paragraph\">Bottom-up is more time-consuming, but it\u2019s far more comfortable.<\/p>\n<p class=\"wp-block-paragraph\">You start with the basic building blocks and make sure they actually work. Then you figure out what each part should communicate, what data it owns, and what it\u2019s responsible for. <\/p>\n<p class=\"wp-block-paragraph\">Eventually, the system takes shape naturally from the interaction of its parts.<\/p>\n<p class=\"wp-block-paragraph\">This isn\u2019t a \u201creal engineers build everything from scratch\u201d argument. It\u2019s not even about tooling at all, actually. It\u2019s about the mental model you\u2019re building with.<\/p>\n<p class=\"wp-block-paragraph\">I\u2019ve seen engineers use sophisticated frameworks and build clean systems because they understood what each layer needed to do.<\/p>\n<p class=\"wp-block-paragraph\">I have also seen engineers write vanilla Python and build an undebuggable mess because they were still thinking in terms of \u201cthe agent decides everything.\u201d The tools follow from the model in your head, not the other way around.<\/p>\n<p class=\"wp-block-paragraph\">The most robust multi-agent system I have had the opportunity to work with closely had almost no AI-specific infrastructure. When I first saw the repo, I honestly assumed I was looking at the wrong codebase. <\/p>\n<p class=\"wp-block-paragraph\">A message queue, worker processes with distinct scopes, shared state storage with explicit read\/write contracts, and a coordinator making routing decisions. <\/p>\n<p class=\"wp-block-paragraph\">The language model queries were performed by the workers themselves, each receiving a set of context created upstream by a different process.<\/p>\n<p class=\"wp-block-paragraph\">All in all, the whole thing was about a thousand lines of Python. I\u2019ve seen demo agents with more code than that. Every part was traceable.<\/p>\n<p class=\"wp-block-paragraph\">When something behaved unexpectedly, we\u2019d usually find the problem in under an hour because there was no magic to look through. Just code with a clear path through it.<\/p>\n<p class=\"wp-block-paragraph\">That system was built bottom-up. The goal was defined, but the architecture wasn\u2019t derived from it. Components were designed first, evaluated on their own, and then composed in order to implement the desired functionality. The latter is the most important aspect, not the former.<\/p>\n<p>Where I Think This Is Going<\/p>\n<p class=\"wp-block-paragraph\">As far as I can tell, the direction we\u2019re heading in is slowly shifting away from \u201cagent frameworks\u201d and toward proper infrastructure, with systems for evaluation, model routing, fallbacks, and state management.<\/p>\n<p class=\"wp-block-paragraph\">At least some of it already exists out there. The majority is yet to come as people solve hard production problems in this space.<\/p>\n<p class=\"wp-block-paragraph\">The thing I see over and over again is that people building the most reliable systems rarely even use the best models. What they have instead is a clear understanding of everything that happens inside their systems.<\/p>\n<p class=\"wp-block-paragraph\">The model used by such a system can be GPT-4, but it may as well be a small local model. It matters little when everything else works properly.<\/p>\n<p class=\"wp-block-paragraph\">We\u2019re moving from treating the model as the product to treating the system as the product. The model matters, but it\u2019s only one component among many.<\/p>\n<p class=\"wp-block-paragraph\">Most agents don\u2019t fail because the model wasn\u2019t good enough. They fail because the system around the model was designed backwards, starting from what the agent should do and assuming the architecture would sort itself out. <\/p>\n<p class=\"wp-block-paragraph\">It doesn\u2019t. <\/p>\n<p class=\"wp-block-paragraph\">Building it the right way around, components first, behavior second, is what separates the systems that hold up from the ones that look impressive until they don\u2019t.<\/p>\n<p>Before you go!<\/p>\n<p class=\"wp-block-paragraph\">I write more about the real engineering decisions behind AI systems, where abstractions help, where they hurt, and what it takes to build reliably. <\/p>\n<p class=\"wp-block-paragraph\">You can <a href=\"https:\/\/thatcsguy.substack.com\/?r=79lldp&amp;utm_campaign=pub-share-checklist\" rel=\"nofollow noopener\" target=\"_blank\">subscribe to my newsletter<\/a> if you\u2019d like more of that.<\/p>\n<p class=\"wp-block-paragraph\">Connect With\u00a0Me<\/p>\n","protected":false},"excerpt":{"rendered":"agent system seriously fail in production, it wasn\u2019t dramatic. There was no crash. No error message. The system&hellip;\n","protected":false},"author":2,"featured_media":53349,"comment_status":"","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[179,7493,405,25,1085,50,15875],"class_list":["post-53348","post","type-post","status-publish","format-standard","has-post-thumbnail","category-agentic-ai","tag-agentic-ai","tag-agentic-artificial-intelligence","tag-ai-agents","tag-artificial-intelligence","tag-data-science","tag-machine-learning","tag-software-architecture"],"_links":{"self":[{"href":"https:\/\/www.europesays.com\/ai\/wp-json\/wp\/v2\/posts\/53348","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.europesays.com\/ai\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.europesays.com\/ai\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.europesays.com\/ai\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.europesays.com\/ai\/wp-json\/wp\/v2\/comments?post=53348"}],"version-history":[{"count":0,"href":"https:\/\/www.europesays.com\/ai\/wp-json\/wp\/v2\/posts\/53348\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.europesays.com\/ai\/wp-json\/wp\/v2\/media\/53349"}],"wp:attachment":[{"href":"https:\/\/www.europesays.com\/ai\/wp-json\/wp\/v2\/media?parent=53348"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.europesays.com\/ai\/wp-json\/wp\/v2\/categories?post=53348"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.europesays.com\/ai\/wp-json\/wp\/v2\/tags?post=53348"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}