AI agents fail in predictable ways. They hallucinate mid-task, lose track of where they are in a multi-step workflow, and get confused when a conversation branches in an unexpected direction. Ben Cochran, a veteran engineer with stints at NVIDIA and AMD and most recently a Distinguished Engineer role, has been working on a structural fix for this. The result is now open-source.
The project is called Statewright. The core idea is to use visual state machines to control how an AI agent moves through a workflow. A state machine is a concept from classical computer science: you define the possible states a system can be in - "waiting for user input", "fetching data", "sending confirmation" - and the explicit rules for moving between them. It's how traffic lights work, how embedded systems have been built for decades, and how many UI frameworks manage complex interface logic.
Where Agents Break Today
Most agent frameworks leave the language model responsible for tracking its own progress. The model uses its context window - the working memory it holds during a task, roughly equivalent to a few thousand words - to remember which steps are complete and what comes next. For simple tasks that works adequately. For anything involving branching logic, error recovery, or multi-step workflows that call external APIs, it's where things fall apart unpredictably.
Cochran's diagnosis in the project announcement is blunt: agentic AI in its current form creates as many problems as it solves. His fix is to externalize the workflow structure into a state machine the developer controls, rather than leaving it implicit inside the model's context. The model's job gets narrower: handle the current step correctly. Managing the overall flow becomes a separate, explicit concern.
Statewright adds a visual builder on top of this, which could make designing complex agent workflows more accessible than writing graph configurations by hand in code. The project is on GitHub.
This is a developer tool. The obvious comparison is LangGraph, which also uses graph-based control flow for similar reliability reasons. Statewright's visual layer is the differentiator - whether it holds up for genuinely complex production workflows, or simplifies only the straightforward cases, is the thing to watch.