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_pointthrough 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_iterationsto 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§
- Action
Result - The result of executing a single node action.
- Direct
Provider Action Executor - Backward-compatible GraphActionExecutor that directly calls provider + tools.
- Noop
Delegate Factory - A no-op delegate factory that returns errors for all requests. Used when no sub-agent delegation is available.
- State
Graph Executor - Executor for StateGraph — walks cyclic graph with conditional routing.
Traits§
- Delegate
Factory - Trait for executing delegate actions in StateGraph nodes.
- Graph
Action Executor - Trait for executing graph node actions with full AgentLoop integration.
Functions§
- interpolate_
graph_ template - Interpolate
{{variable}}template patterns for StateGraph execution.
Type Aliases§
- Custom
Condition Fn - User-provided evaluator for an
EdgeCondition::Custom { name, .. }variant.