Automata from Agent Traces: Failure and Next-Step Prediction
This paper proposes a method to collapse LLM agent execution traces into compact, model-agnostic finite-state machines that effectively capture shared behavioral topology, enabling superior next-step prediction and early failure detection for safety auditing and runtime monitoring.
Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer
Imagine a world where artificial intelligence agents are no longer just chatbots that answer questions, but autonomous workers capable of solving complex problems on their own. These digital employees can browse the web, write and debug computer code, manage customer service inquiries, and even control desktop software. They operate by breaking down a large goal into a long chain of smaller steps, thinking through each one and taking action. However, as these agents become more capable, they also become harder to understand. Their internal decision-making processes are often a black box, and when they fail, it is difficult to tell if they are stuck in a loop, making a simple mistake, or wandering off into a chaotic path that leads nowhere. For companies and researchers deploying these systems, this opacity is a major safety risk. Without a clear map of how these agents behave, it is nearly impossible to catch errors before they cause damage or to predict when an agent is about to fail.
A team of researchers has developed a new way to map the behavior of these autonomous agents, turning their messy, unstructured actions into a clear, compact blueprint. Instead of trying to understand the complex reasoning inside the agent's brain, the researchers focused on the external trail of actions the agent leaves behind. They treated thousands of these action trails as a single dataset and asked a simple question: can we find a hidden structure that explains how these agents move from one step to the next? By analyzing the sequence of actions—such as searching for information, editing a file, or talking to a user—they discovered that despite the apparent randomness of the agents' choices, their behavior follows a surprisingly rigid and predictable pattern. The researchers built a finite-state machine, which is essentially a flowchart that captures every possible path an agent can take. This flowchart is not a guess; it is a mathematical reconstruction of the agent's actual behavior, distilled from real-world data.
The most striking discovery is how small and efficient these flowcharts are. Even for agents that perform thousands of different tasks, the researchers found that their behavior could be compressed into a map with only a handful of states, ranging from seven to forty-three distinct steps. This is a massive reduction in complexity. To put this in perspective, imagine trying to describe the entire layout of a sprawling city by listing every single street and building; the researchers instead found a way to describe the city's traffic flow using just a few major intersections and the rules for how cars move between them. In their tests, these compact maps were able to replay the agents' past actions with an AUC of 0.997. This high level of accuracy suggests that the structure of an agent's work is determined less by the specific language model powering it and more by the tools it is allowed to use and the tasks it is given.
This structural map does more than just describe the past; it serves as a powerful tool for predicting the future. Because the map captures the logical flow of the agent's work, it can be used to spot when an agent is going off the rails. The researchers showed that by watching an agent move through this map, they could predict whether a task would succeed or fail long before the task was finished. In some cases, the system could identify a failing run when the agent was only a quarter of the way through its work, allowing for early intervention. This is a significant improvement over previous methods that often waited until the end to judge success or failure. The map also proved better at predicting the next step an agent would take than other existing techniques, providing a clearer picture of what the agent is likely to do next based on where it currently is in its workflow.
The researchers tested their method on twelve different datasets covering a wide range of activities, from coding and web navigation to customer service and desktop management. In every case, the method produced a compact, reliable map that outperformed other approaches. Unlike older techniques that often created overly complex models with thousands of unnecessary states, or models that were too simple to be useful, this approach found the sweet spot. It created a model that was small enough to be fast and easy to analyze, yet detailed enough to capture the nuances of the agent's behavior. The construction of these maps was incredibly fast, taking only milliseconds to build, which means they could be used in real-time to monitor agents as they work.
The implications of this work extend beyond just making agents safer. By revealing that the behavior of these complex systems is governed by a simple, underlying structure, the researchers have provided a new way to audit and understand artificial intelligence. This structure is not dependent on the specific type of AI model being used; it holds true across different models and different types of tasks. This suggests that the constraints of the environment and the tools available to the agent are the primary drivers of its behavior, rather than the internal logic of the AI itself. For developers and safety auditors, this offers a practical, model-agnostic way to monitor agents, detect failures early, and ensure that these autonomous systems operate within safe and predictable boundaries. The work demonstrates that even the most complex and seemingly chaotic behaviors of modern AI agents can be reduced to a clear, understandable, and manageable set of rules.
Drowning in papers in your field?
Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.