Automated Safety Analysis for Agentic Workflows
Organizations: University of California, San Diego · University of California, Los Angeles · City University of Hong Kong · University of California, Santa Barbara
Abstract
LLM applications are increasingly built as agentic workflows: programs that combine model calls, external tools, and control logic to act autonomously on a user's behalf. Because these workflows execute real-world actions, logical flaws in how a workflow is wired can cause severe harm in deployed systems. Unlike prompt injections or malformed API calls, these workflow bugs stem from defects in the workflow's design, yet no existing tool can statically validate workflow logic across frameworks prior to deployment. We present Apsis, a static safety analyzer that detects workflow bugs before deployment. To operate across frameworks, Apsis lifts framework-specific code into a common intermediate representation (IR). This IR models a workflow as a semantic graph of steps, data dependencies, and shared state, while annotating each component with behavioral properties such as whether an input is mandatory or how a shared channel merges concurrent writes. Building on this representation, we introduce a bug description language that formalizes recurring classes of agentic failures as declarative patterns over the IR. By matching these patterns against the IR, Apsis detects structural and behavioral flaws and pinpoints the exact step responsible for each bug. To evaluate Apsis, we construct, to our knowledge, the first corpus of workflow bugs, distilled from real-world reports across 13 widely used frameworks. On a reproducible benchmark suite drawn from this corpus, Apsis detects workflow bugs with 91% precision and 84% recall, and uncovers 36 previously unknown bugs in real-world workflows.
Figures & tables
| Framework | Reports | Workflow | Struct. | Behav. | Stars |
|---|---|---|---|---|---|
| Agent Framework [ 3 ] | 249 | 214 | 16% | 84% | 11.5k |
| Flowise [ 23 ] | 168 | 154 | 25% | 75% | 53.8k |
| LangGraph [ 2 ] | 150 | 136 | 21% | 79% | 35.3k |
| AutoGen [ 5 ] | 73 | 69 | 38% | 62% | 59.1k |
| Langflow [ 24 ] | 60 | 59 | 36% | 64% | 149.9k |
| Haystack [ 4 ] | 44 | 43 | 49% | 51% | 25.6k |
| Category | Primitive | Static signature (buggy vs. fixed) | Repr. report |
|---|---|---|---|
| Stalled & Runaway Workflows | reachability | A required step never becomes ready, or a cycle reaches no terminal, stalling the workflow. | LangGraph loop [ 20 ] |
| Broken Data Handoffs | type checking | A producer’s output type is not assignable to the consumer, or a step writes an undeclared channel. | Agent Framework [ 33 ] |
| Misrouted Dispatch | name resolution | A route names no node, mutually exclusive branches converge, or a branch reaches no terminal. | LangGraph router [ 34 ] |
| Corrupted Shared State | non-interference | Concurrent writes go unreconciled, a read precedes its write, or two steps alias one instance. | LangGraph state [ 16 ] |
| Unwired Subflows | inter-procedural | A subflow’s required input port is left unbound across the call boundary, starving the nested graph. | Agent Framework [ 35 ] |
| Role & Interrupt Violations | role / protocol | A binding exceeds a step’s role capability, or a human-in-the-loop interrupt is mis-ordered. | LangGraph.js [ 17 ] |
| Predicate | Meaning |
|---|---|
| step and its kind | |
| input / output port of | |
| port has type | |
| port defaulted / required | |
| port fillable only by a wired edge | |
| edge of kind ; output wired to input |
| starved-step | ||||
| + deadlocked join | ||||
| runaway-loop | ||||
| Broken Data Handoffs (structural) | ||||
| mistyped-handoff | ||||
| + undeclared channel write | ||||
| + message cannot route | ||||
| Framework | #Bug | #Fix | #Tot | ||||
|---|---|---|---|---|---|---|---|
| Haystack [ 4 ] | 25 | 25 | 50 | 0.92 | 0.88 | 0.90 | 0.08 |
| LangGraph [ 2 ] | 33 | 33 | 66 | 0.96 | 0.76 | 0.85 | 0.03 |
| Flowise [ 23 ] | 24 | 24 | 48 | 0.83 | 0.83 | 0.83 | 0.17 |
| Langflow [ 24 ] | 13 | 13 | 26 | 0.86 | 0.92 | 0.89 | 0.15 |
| AutoGen [ 5 ] | 14 | 14 | 28 | 0.92 | 0.79 | 0.85 | 0.07 |
| Agent Framework [ 3 ] | 26 | 26 | 52 | 0.96 | 0.88 | 0.92 | 0.04 |
| Approach | ||||
|---|---|---|---|---|
| Framework-Native Validator | — | 0.00 | — | 0.00 |
| CodeQL [ 14 ] | 0.71 | 0.07 | 0.13 | 0.03 |
| CodeQL [ 14 ] Extended | 0.74 | 0.17 | 0.28 | 0.06 |
| LLM (GPT-5.5 [ 39 ] ) | 0.60 | 0.80 | 0.68 | 0.54 |
| LLM (GPT-5.5 [ 39 ] ) Strict | 0.44 | 0.43 | 0.44 | 0.54 |
| LLM (Opus-4.8 [ 40 ] ) | 0.61 | 0.77 | 0.68 | 0.49 |
| # | Bug description | Category | Framework | Issue | Status |
|---|---|---|---|---|---|
| 1 | Crew is built from component state reused across requests | Corrupted Shared State | Langflow | langflow #13846 | Fixed |
| 2 | One agent wired into several tasks is mutated in place | Corrupted Shared State | Langflow | langflow #13847 | Fixed |
| 3 | Agent factory passes an unconverted model to the crew agent | Broken Data Handoffs | Langflow | langflow #13848 | Fixed |
| 4 | Agent router returns a label absent from the path map | Misrouted Dispatch | LangChain | langchain #38351 | Fixed |
| 5 | Shared router returns targets absent from the edge’s path map | Misrouted Dispatch | LangGraph | TradingAgents #1088 | Fixed |
| 6 | Resume reuses a checkpoint from a differently shaped graph | Corrupted Shared State | LangGraph | TradingAgents #1089 | Fixed |
| Aspect | Business process | Agentic workflow | Detectors |
|---|---|---|---|
| Control transfer | Transition targets are fixed in the process definition. | The next step can be a name the model returns at run time, which may match no step. | – |
| Termination | A loop exits on a condition the designer wrote over case data. | A loop may exit only on a value the model produces, so a bound has to be added explicitly. | |
| Authority | A person or program performs a task under an assigned role. | The model chooses its own tool calls, so which tools a step holds and where approvals sit become properties of the graph. | , |
| Shared state | A data element holds one value, so concurrent writes conflict. | Each channel has a merge rule (a reducer), so the same concurrent writes either merge or lose an update. |
Agentic Workflows
Agentic workflows coordinate AI agents, tools, and humans across multi-step tasks, emphasizing reliable execution, efficiency, and oversight.
See all 237 papers