From Agent Loops to Structured Graphs:A Scheduler-Theoretic Framework for LLM Agent Execution
Abstract
The dominant paradigm for building LLM based agents is the Agent Loop, an iterative cycle where a single language model decides what to do next by reading an ever growing context window. This paradigm has three structural weaknesses: implicit dependencies between steps, unbounded recovery loops, and mutable execution history that complicates debugging. We characterize the Agent Loop as a single ready unit scheduler: at any moment, at most one executable unit is active, and the choice of which unit to activate comes from opaque LLM inference rather than an inspectable policy. This perspective places Agent Loops and graph based execution engines on a single semantic continuum. We propose SGH, Structured Graph Harness, which lifts control flow from implicit context into an explicit static DAG. SGH makes three commitments: execution plans are immutable within a plan version, planning execution and recovery are separated into three layers, and recovery follows a strict escalation protocol. These choices trade some expressiveness for controllability, verifiability, and implementability. Our contributions are fourfold: a scheduler unified framework that applies classical scheduling theory to LLM agent execution and identifies challenges introduced by non deterministic LLM nodes; a trade off analysis of controllability, expressiveness, and implementability across 70 surveyed systems; a formal specification including a node state machine with termination and soundness guarantees; and an attributable experimental framework with a seven group design for future validation. This is a position paper and design proposal. We provide a theoretical framework, design analysis, and experimental protocol, not a production implementation or empirical results.
Figures & tables
| Symbol | Definition |
|---|---|
| Execution system tuple (Def. 3.1 ) | |
| Ready set at state | |
| Ready-set cardinality | |
| Execution plan (Def. 5.1 ) | |
| Node configuration mapping | |
| Plan-level output contract |
| Dimension | LangGraph | Graph Harness |
|---|---|---|
| Plan mutability | Mutable at runtime (add/remove nodes and edges) | Immutable per plan version |
| Recovery | Retry + conditional routing | Three-level escalation protocol |
| Routing policy | LLM-driven conditional edges | Deterministic topology-based |
| Failure attribution | State-channel snapshots | Plan-version-audited traces |
| Expressiveness target | Maximum flexibility | Maximum controllability |
| Production maturity | Widely deployed; community-validated | Design only; no empirical validation |
| Classical concept | LLM agent challenge | Graph Harness mechanism |
|---|---|---|
| Deterministic node output | Same input may yield different outputs; hallucination | Contract validation + validation gap analysis |
| Infrastructure failures | Reasoning errors, hallucinations, misinterpretation | Three-level recovery distinguishing error types |
| Scheduling = optimization | Scheduling involves side-effect safety | Side-effect classification (Principle 4) |
| Context = task parameters | Context includes reasoning history that may corrupt subsequent steps | Execution/diagnostic context separation |
| Retry = idempotent | Retry may produce different results; non-idempotent side effects | Bounded retry + side-effect-aware scheduling |
| Dimension | Airflow / Luigi / Prefect | Graph Harness |
|---|---|---|
| Node behavior | Deterministic (Python code) | Non-deterministic (LLM inference) |
| Node output | Predictable, type-checked | Unpredictable, contract-validated |
| Failure causes | Primarily infrastructural | Primarily reasoning errors, hallucinations |
| Recovery | Manual / simple retry | Three-level escalation protocol |
| Context management | Task-scoped variables | Execution/diagnostic context separation |
| Plan evolution | Redeploy new DAG version | Plan-version immutability within execution |
| System | Multi- | Det. | Bounded | Immut. | Recovery | Contract | Target |
|---|---|---|---|---|---|---|---|
| Ready | Policy | Recovery | Plan | Protocol | Valid. | Domain | |
| Agent Loop ( Yao et al., 2023 ) | No | No | No | No | Ad-hoc LLM | None | General |
| AutoGPT | No | No | No | No | Ad-hoc LLM | None | General |
| CrewAI | No | No | No | No | Ad-hoc LLM | None | General |
| Plan-and-Act ( Erdogan and others, 2025 ) | No | No | No | Partial | Re-plan | Optional | Web nav |
| TDP ( Li et al., 2026 ) | No | No | No | Mutable | Node-local | Optional | General |
| Approach | Execution commitment | Recovery | Scheduler type | LLM-aware? |
|---|---|---|---|---|
| Agent Loop ( Yao et al., 2023 ) | None | Unbounded LLM decision | Single-ready-unit | Implicit |
| Plan-and-Act ( Erdogan and others, 2025 ) | Plan as prompt | Re-plan | Single-ready-unit | Partial |
| TDP ( Li et al., 2026 ) | Mutable DAG sub-tasks | Node-local replan | Single-ready-unit | Partial |
| LangGraph ( Team, 2024 ) | Mutable runtime graph | Retry + conditional routing | Multi-ready-unit | Partial |
| GPTSwarm ( Zhuge et al., 2024 ) | Optimizable graph | Edge reconnection | Multi-ready-unit | No |
| DynTaskMAS ( Yu et al., 2025 ) | Dynamic DAG | Dynamic reschedule | Multi-ready-unit | No |
| Category | Expressiveness | Controllability | Implementability |
|---|---|---|---|
| Agent Loop (60%) | Low | Low | High |
| Event-driven (15%) | Low | Medium | High |
| State-machine (10%) | Medium | High | Medium |
| Graph/flow orchestration (5%) | High | Low | Low |
| Hybrid (10%) | Medium | Medium | Medium |
| Principle | Sacrificed | Gained |
|---|---|---|
| Controllability first | Competitive parallelism, recursive expansion, parent-chain rollback | Predictable execution, verifiable traces |
| Stable commitment | Dynamic plan modification | Auditable plan history, reliable attribution |
| Bounded recovery | Ad-hoc LLM-driven recovery | Deterministic escalation, failure-loop prevention |
| Side-effect classification | Unrestricted parallel dispatch | Safety guarantees, risk-bounded scheduling |
| Topology | Expressiveness | Predictability | Verifiability |
|---|---|---|---|
| Static DAG (chosen) | Medium | High | High |
| Recursive expansion graph | High | Low | Low |
| Parent-chain rollback graph | High | Low | Low |
| Dynamic topology graph | High | Low | Low |
| Level | Trigger | Scope |
|---|---|---|
| local_retry | Transient errors (network, timeout) | Current node only; plan structure unchanged |
| local_patch | Contract violation, auth error | Current node’s configuration; plan structure unchanged |
| request_replan | Missing dependency, invalid plan structure | Entire plan version; new generated |
| Capability | Graph Harness | Full dynamic graph |
|---|---|---|
| Sequential execution | ✓ | ✓ |
| Parallel execution | ✓ | ✓ |
| Alternative paths | ✓ | ✓ |
| Competitive parallelism | — | ✓ |
| Recursive sub-graph expansion | — | ✓ |
| Dynamic topology change | — | ✓ |
| Group | Scheduler type | Structure | Recovery |
|---|---|---|---|
| G0: SOTA Loop | Single-ready-unit | Planner prompt + reflection | Inline replan |
| G1: Naive Loop | Single-ready-unit | None | Context continuation |
| G2: Planner Loop | Single-ready-unit | None | Context + replan |
| G3: Structured Loop | Single-ready-unit | Scaffold | Scaffold recovery |
| G4: GH-Core | Multi-ready-unit | Static DAG | Retry only |
| G5: GH+Patch | Multi-ready-unit | Static DAG | Retry + local patch |
| Tier | Characteristics | Expected result |
|---|---|---|
| Simple (1–3 steps) | Linear chain; no branching dependencies; all_of joins only | SGH may show fixed overhead (no parallelism to exploit) |
| Medium (4–8 steps) | 2–3 branches; both all_of and any_of joins; recovery opportunities | Primary evaluation tier (parallelism and recovery benefits emerge) |
| Complex (9+ steps) | Nested branches; deep dependency chains; multiple recovery paths | SGH advantage should widen (structure provides maximal value) |
| Excluded capability | Reason | Task impact |
|---|---|---|
| first_of competitive parallelism | Non-deterministic ready set; requires compensation protocol | Cannot express “try all, take first” |
| Recursive sub-graph expansion | Unbounded ; unpredictable ready set | Cannot express dynamic decomposition |
| Parent-chain rollback | Plan invariant violation | Cannot express deep hierarchical recovery |
| Dynamic topology modification | Plan invariant violation | Cannot adapt structure mid-execution |
Appendix figures & tables2 assets
Supplementary material from the paper’s appendix.
Appendix
| From | To | Trigger | Condition |
|---|---|---|---|
| pending | ready | Dependencies satisfied | |
| ready | running | Scheduler dispatch | Selected by |
| ready | blocked | Dependency lost | A predecessor left terminal-success state |
| ready | skipped | Sibling completed | any_of join; another candidate executed |
| running | executed | Action success | Output contract satisfied |
| running | failed_retryable | Transient error | Network, timeout; retry budget |
| Project | Category | Key innovation | Rating |
|---|---|---|---|
| ironclaw | Agent Loop | LoopDelegate trait, three-phase tool execution | 5.0 |
| openclaw | Agent Loop | Three-tier degradation, Auth Profile rotation | 4.5 |
| clawdroid | Event-driven | OODA loop, MessageBus architecture | 4.85 |
| openhands | Event-driven | EventStream controller, sandboxed execution | 4.2 |
| vtcode | State-machine | Four-layer Phase FSM, compile-time exhaustiveness | 5.0 |
| codex | State-machine | SQ/EQ dual-queue protocol | 5.0 |
LLM Agent Orchestration
Large language model agent orchestration coordinates models, tools, and workflows to complete complex tasks reliably and efficiently.
See all 446 papers