Keeping LLM Agents on Procedure: Executable Finite-State Control for Long-Horizon Instruction Fidelity
On the map: LLM agents and tool use → Software engineering coding agents also fits: Tool learning and function calling
Abstract (arXiv)
Much of the automation handed to language-model agents is procedural: each step needs little intelligence, but a long unattended run must follow a skill or SOP stated once at the start. We show that agents drift from such procedures over long runs, and that restating the instructions or resuming a stopped agent only moves the drift to another shortcut. We study an executable finite-state machine (FSM) that keeps the workflow state outside the model's context and enforces it at three points: tool calls, state transitions and the end of the agent's turn. In a pre-registered experiment on 200-account SOP-Bench batches, Claude Haiku 4.5 with the FSM decided on average 139 accounts correctly and by the procedure, against 48 for the strongest baseline (95% CI of the difference [46, 130]), and kept this rate to the end; across three models, the gain tracked how much the plain agent drifted. Because the runtime, not the model, supplies this long-horizon reliability, the FSM can let small models carry procedural work: Haiku 4.5 with it averaged more such decisions than plain Claude Sonnet 4.6 at 38% of the cost. Analyses on SWE-bench Verified, τ2-bench, and staged and cross-context workflows further suggest that reliable long-horizon automation can come from stronger execution control, not only stronger models.
Key facts. No citing papers in the map yet (data through 24 Nov 2026). Placed in Software engineering coding agents, one of 16 directions in LLM agents and tool use. Builds on 39 of its 62 references that are in the map. Submitted 7 Nov 2026.
Builds on
39 of 62 references.
Closest ancestors · 4
Same direction, newest first
- 2025AlphaEvolve: A coding agent for scientific and algorithmic discovery16 Jun
- 2024AppWorld: A Controllable World of Apps and People for Benchmarking Interactive Coding Agents26 Jul
- 2024OpenHands: An Open Platform for AI Software Developers as Generalist Agents23 Jul
- 2024SWE-agent: Agent-Computer Interfaces Enable Automated Software Engineering6 May
Other references · 35
- 2022ReAct: Synergizing Reasoning and Acting in Language Modelscited by 9,589
- 2023Let's Verify Step by Stepcited by 4,259
- 2023SWE-bench: Can Language Models Resolve Real-World GitHub Issues?cited by 3,871
- 2023Lost in the Middle: How Language Models Use Long Contextscited by 3,765
- 2023WebArena: A Realistic Web Environment for Building Autonomous Agentscited by 2,232
- 2024τ-bench: A Benchmark for Tool-Agent-User Interaction in Real-World Domainscited by 1,713
- 2023MemGPT: Towards LLMs as Operating Systemscited by 1,655
- 2024RULER: What's the Real Context Size of Your Long-Context Language Models?cited by 1,559
- 2024OSWorld: Benchmarking Multimodal Agents for Open-Ended Tasks in Real Computer Environmentscited by 1,383
- 2023Llama Guard: LLM-based Input-Output Safeguard for Human-AI Conversationscited by 1,337
- 2024The AI Scientist: Towards Fully Automated Open-Ended Scientific Discoverycited by 1,249
- 2023GAIA: a benchmark for General AI Assistantscited by 1,237
23 more
- 2023DSPy: Compiling Declarative Language Model Calls into Self-Improving Pipelinescited by 908
- 2025τ2-Bench: Evaluating Conversational Agents in a Dual-Control Environmentcited by 797
- 2025LLMs Get Lost In Multi-Turn Conversationcited by 501
- 2024TravelPlanner: A Benchmark for Real-World Planning with Language Agentscited by 412
- 2024WorkArena: How Capable Are Web Agents at Solving Common Knowledge Work Tasks?cited by 407
- 2023NeMo Guardrails: A Toolkit for Controllable and Safe LLM Applications with Programmable Railscited by 397
- 2025AgentSpec: Customizable Runtime Enforcement for Safe and Reliable LLM Agentscited by 276
- 2023Grammar-Constrained Decoding for Structured NLP Tasks without Finetuningcited by 229
- 2023Self-Taught Optimizer (STOP): Recursively Self-Improving Code Generationcited by 213
- 2025Progent: Securing AI Agents with Privilege Controlcited by 189
- 2024ST-WebAgentBench: A Benchmark for Evaluating Safety and Trustworthiness in Web Agentscited by 158
- 2024GuardAgent: Safeguard LLM Agents by a Guard Agent via Knowledge-Enabled Reasoningcited by 152
- 2023Agents: An Open-source Framework for Autonomous Language Agentscited by 119
- 2024StateFlow: Enhancing LLM Task-Solving through State-Driven Workflowscited by 74
- 2026τ-Knowledge: Evaluating Conversational Agents over Unstructured Knowledgecited by 67
- 2024Measuring and Controlling Instruction (In)Stability in Language Model Dialogscited by 62
- 2026Long-Horizon-Terminal-Bench: Testing the Limits of Agents on Long-Horizon Terminal Tasks with Dense Reward-Based Gradingcited by 45
- 2024SysBench: Can Large Language Models Follow System Messages?cited by 34
- 2021Preregistering NLP Researchcited by 31
- 2026Agent Skills Can Be Harmful: An Empirical Study of Skill-Induced Failures in LLM Agentscited by 21
- 2026Formal Skill: Programmable Runtime Skills for Efficient and Accurate LLM Agentscited by 7
- 2026From History to State: Constant-Context Skill Learning for LLM Agentscited by 6
- 2026SKILL.state: Scalable Long-Horizon Agent Skillscited by 3
Built on by
Not cited yet.
Similar, not cited
Close in wording, no citation either way
- 2025The Illusion of Procedural Reasoning: Measuring Long-Horizon FSM Execution in LLMs
- 2026Compile, Then Page: Executable SOP Programs and a Capability-Gated Runtime for Procedural LLM Agents
- 2026LLM-as-Code: Agentic Programming for Agent Harness
- 2026Staying on Task: Testing the Foundations of Long-Horizon Agent Reliability
- 2026Harnessing LLMs as Agents: What Does It Cost?
- 2026Long-Horizon State Tracking in LLMs: Executing MD5 through a Deep Sequence of Dependent Tool Calls
- 2026Push Your Agent: Measuring and Enforcing Quantitative Goal Persistence in Long-Horizon LLM Agents
- 2025Dynamic System Instructions and Tool Exposure for Efficient Agentic LLMs