Expand description
Durable graph executor — the node-visiting drive loop.
Ports the semantics of the greentic-designer spike
(src/orchestrate/agent_graph/executor.rs, origin/spike/agent-graph-engine-slice)
with the following adaptations:
- Uses
GraphConfig/GraphRunState/CheckpointStorefrom this crate rather than the designer’s SQLite-backed checkpoint module. - Effect closures are
Arc<dyn Fn(…) -> BoxFut<…>>(shared, cloneable) instead of ownedBox<dyn Fn…>. start/resumereturnResult<GraphRunOutcome, GraphExecError>(notResult<()>), carrying the final reply and visit trail.
§Record-then-checkpoint ordering (replayable resume)
Each side-effect node (Agent, Tool) follows a strict two-write ordering:
the effect’s result is recorded into the node-visit store
(CheckpointStore::record_node_visit) immediately after the effect
returns and before the checkpoint update. The checkpoint update then
commits the new cursor, state, and per-node visits counts atomically.
On resume at cursor node N, the next attempt is visits[N] + 1. If a
(run, N, attempt) visit row already exists, the effect ran but the
process crashed before the checkpoint committed — so the recorded result
is replayed instead of re-invoking the effect.
Structs§
- Agent
Turn Request - Request payload delivered to an injected agent-turn closure.
- Agent
Turn Result - Result returned by an injected agent-turn closure.
- Approval
Request - Request payload delivered to an injected approval closure.
- Graph
Executor - Drives agent-graph runs to completion, persisting checkpoints after every node so that a killed process can resume mid-loop.
- Graph
RunOutcome - The final result of a drive-loop execution.
- Supervisor
Request - Request payload delivered to an injected supervisor closure.
- Supervisor
Result - Result returned by an injected supervisor closure.
- Tool
Call Request - Request payload delivered to an injected tool closure.
Enums§
- Approval
Outcome - Result returned by an injected approval closure.
- Graph
Exec Error - Errors that may surface from
GraphExecutor::startorGraphExecutor::resume.
Constants§
- MAX_
NODE_ VISITS - Hard upper bound on node visits per
drivecall, independent of the per-routermaxIterationscap. Prevents infinite loops on malformed graphs.
Type Aliases§
- Agent
Turn Fn - One agent turn: the host wires this to
AgentRuntime::step. - Approval
Fn - One approval-gate check: the host wires this to its approval-request
transport (e.g. the
greentic.approval.request.v1/.response.v1NATS subjects) and reports whether a decision has arrived yet. - BoxFut
- Owned heap-allocated future,
Send + 'static. - Supervisor
Fn - One supervisor routing decision: the host wires this to
AgentRuntime::stepwith a generated routing prompt containing the route menu. - ToolFn
- One deterministic tool call.