Execution Graph
Validated node snapshots, their executions, and exact results.
An Execution Graph is a validated set of nodes owned by one session. Each node is one piece of agent work with explicit dependencies, so independent branches can run concurrently and later nodes receive exact earlier results. Focused review and approved /graph proposals both run as graphs, and an approved expansion appends nodes to a launched one. The Graph Executor runs them.
Connections🔗
flowchart TD
PR[Proposal version] -->|approval| G[Execution Graph]
L[Expansions, withdrawals, cancellations, continuations, budget] -.->|recorded for| G
G -->|contains| N[Node]
N -->|captures| AD[Agent Definition]
N -->|works in| E[Env]
N -->|runs as| T[Task attempt or Run]
N -->|publishes| O[Result version, pinned by dependents]Identity🔗
- A session can hold several graphs. Each may have a purpose label of at most 48 characters, cleaned by
ExecutionGraph::clean_labeland kept on the graph's row beside its snapshots. - Graphs a proposal launched take one ordinal each for the life of the session, from 1 in creation order, canceled ones included.
ExecutionGraph::display_namenames such a graph by its label, with the ordinal beside a label another graph shares, orgraph N. Focused reviews and other graphs no proposal launched take none. - A graph has an instance ID, a nonzero revision, and one owning session; node IDs are unique within it.
Records🔗
- Proposal: a model-authored draft from
/graph. The host captures the request, agent catalog, model, and limits; each version is saved separately. Approving an exact version publishes its resolved snapshot before any node starts. - Graph revision: an immutable snapshot of nodes. Each node captures its agent definition, model selection, objective, request, execution profile, Env reference, dependencies, named inputs and outputs, and an optional parent. The Env is the session worktree or one of the session's task worktrees. Validation rejects missing or duplicate references, incompatible profiles, foreign Envs, invalid parents, and cycles; declaration order is not execution order.
- Hierarchy: a node may name a top-level node of the same graph as its parent, so a graph has at most two levels. A child is a step of its parent's deliverable and shares its Env. It waits for its parent only through an explicit dependency, and a parent never waits for its children.
- Execution link: a node's execution is an existing task attempt or utility run. Linking checks ownership and pins every declared input in one transaction. Graphs add no separate execution status.
- Result version: one immutable body per declared output of an execution, with host-recorded validation and acceptance evidence. Dependents pin the exact version they consumed.
- Expansion: nodes appended as the next revision of a launched graph, idempotent by expansion ID and checked against the expected current revision.
- Withdrawal, cancellation, continuation, and replies: recorded beside the snapshots, so no revision changes. A continuation is a retry, complete clarification answers, or a free-form reply to a settled task turn, against the exact source execution under a new execution ID. A chat reply is saved with the exact proposal or output version it answered.
- Budget ledger: named provider-call limits fixed at first launch, every charge and refund, and explicit extensions.
Guarantees🔗
- A node is admitted once, in the same transaction that checks its revision, gates, Env conflicts, and exact inputs.
- Successful provider execution alone does not satisfy a result gate, accept an output, or complete a task. Acceptance names one exact validated output version.
- A graph completes only when every node of its current revision settled successfully without questions or was withdrawn. Completion accepts no output, and an approved expansion reopens it. A driver that read its graph complete just before an approval reopened it marks itself stopped and reads the graph again, so either the approval starts a driver or the old one keeps driving.
- Restart restores snapshots and results without dispatching work; resume is explicit, by control or by a chat reply saved before the restart.
- Cancellation is terminal for that graph. Canceling one running or queued task node stops its exact execution through ordinary cleanup, leaving its children running; its dependents wait on a failed prerequisite until a retry, and effects already applied stay. A fresh node stops only with its graph. Neither cancel asks for confirmation; callers own that.
- A node that never started can be withdrawn with its unstarted dependents, and a parent with its unstarted children (
ExecutionGraph::withdrawal_closure); a started node in that set refuses the whole withdrawal. Each action ID is recorded once, and canceled, completed, and focused-review graphs refuse it. Progress reports each withdrawn node asWithdrawn, with who withdrew it and the node the withdrawal named, and an output that only withdrawn nodes waited for no longer awaits approval, which the session chat says. - Once executions are linked, a revision only appends nodes, by an explicit, approved expansion, also of a completed graph but never of a canceled one. Existing nodes, their executions, and their pinned inputs never change; appended nodes spend from the existing budgets, so an expansion never adds provider calls, and may not depend on or be children of a withdrawn node.
- Accepted outputs and nodes with started dependents are final. Continuations never rewrite earlier attempts or pinned inputs, and identical delivery never executes twice.
- Provider-call limits are fixed at first launch and spending is recorded, so a restart never replenishes spent calls; a resume starts from the launch limits plus extensions minus spending. Only an explicit extension adds calls, recorded once per action ID and refused for canceled and completed graphs; launch limits stay as approved.
- Deleting the owning session removes its graph records.
Hosts act on these records through SessionService.
See Execution Graphs for the design reasons and the proposal workflow for /graph.