Skip to main content

Module state_executor

Module state_executor 

Source
Expand description

StateGraph executor — walks cyclic graph, evaluates edge conditions, handles interrupts.

Unlike WorkflowDag (which is acyclic and runs levels sequentially), StateGraph supports cyclic edges for iterative agent patterns like ReAct loops. The executor walks the graph from the entry point, executing each node’s action, evaluating outgoing edge conditions to route to the next node, and handling interrupt points where execution can pause for human intervention.

Key features:

  • Walks graph from entry_point through conditional edges
  • Executes 6 NodeAction variants (LlmInfer, ToolCall, Delegate, HumanApproval, ConditionCheck, SwitchParadigm)
  • Evaluates 9 EdgeCondition variants for dynamic routing (including ParadigmEquals, IterationExceeds)
  • Handles interrupt points (nodes with interrupt: true)
  • Bounded by max_iterations to prevent infinite loops
  • Supports {{variable}} template interpolation in tool_name and args_template

§P2-2: GraphActionExecutor bridge

The GraphActionExecutor trait enables AgentLoop integration — when a concrete implementation (from oneai-agent) is provided, LlmInfer and ToolCall nodes delegate to the AgentLoop’s full pipeline (hooks, permission, domain pack, tool definitions). This makes StateGraph execution a first-class execution mode of the AgentLoop, not a separate disconnected system.

The DirectProviderActionExecutor provides backward-compatible behavior (direct provider.infer() + tool.execute() without AgentLoop integration).

Structs§

ActionResult
The result of executing a single node action.
DirectProviderActionExecutor
Backward-compatible GraphActionExecutor that directly calls provider + tools.
NoopDelegateFactory
A no-op delegate factory that returns errors for all requests. Used when no sub-agent delegation is available.
StateGraphExecutor
Executor for StateGraph — walks cyclic graph with conditional routing.

Traits§

DelegateFactory
Trait for executing delegate actions in StateGraph nodes.
GraphActionExecutor
Trait for executing graph node actions with full AgentLoop integration.

Functions§

interpolate_graph_template
Interpolate {{variable}} template patterns for StateGraph execution.

Type Aliases§

CustomConditionFn
User-provided evaluator for an EdgeCondition::Custom { name, .. } variant.