Injected dependencies shared across all runs handled by this instance.
Execute the graph to completion and return the final artifacts payload.
This is a convenience wrapper around stream() that discards intermediate events
and awaits the terminal run_end event.
Compiled execution graph to run.
Initial user-provided input; frozen into GraphState.input.
The GraphState.artifacts value after the last node completes.
The error of a checkpoint save the store refuses, or of a conditional edge's function that throws, as () throws it.
Execute the graph while yielding GraphEvent values at each significant step.
Events are emitted in strict causal order:
run_start → (node_start → node_end → edge_transition?)+ → run_end
The events of a parallel batch are yielded once every node of it has run, in the order the nodes are declared. When a node of the batch interrupts or fails, the nodes of the batch that completed come first and the halting node last.
Checkpoints are saved according to both the graph-wide checkpointPolicy and
per-node checkpoint settings. An interrupt event causes immediate suspension
followed by a terminal run_end. When a node interrupts or fails, the checkpoint
the run resumes from is saved before any event that reports the node's result is
yielded, so a consumer may stop iterating at interrupt or error and still
resume the run. The checkpoint_saved event for that checkpoint comes after
interrupt or error, so such a consumer resumes by the runId of run_start.
A checkpoint save the store refuses (its save() rejects) or a function on a
conditional edge that throws ends the run: the generator throws that error where
the runtime asked for the checkpoint or evaluated the edge. The checkpoint of a
node that interrupts or fails is saved before the node's events, so when the
store refuses it the error comes before them. In a parallel batch, every other
node of the batch runs to the end first, none of the batch's events is yielded,
and the error is the first in the order the nodes are declared; a node of the
batch counts as completed only once its edges are decided, so a node whose edges
threw is in no checkpoint as completed. The checkpoint saved before an expansion
does not list the node the expansion came after as completed either (see
GraphExpansionContext.checkpointIdBefore). A resume by the runId of
run_start continues from the last checkpoint the store saved.
Compiled execution graph to run.
Initial user-provided input; frozen into GraphState.input.
Runtime events in causal order.
The error of a checkpoint save the store refuses, or of a conditional edge's function that throws.
Resume a previously interrupted run from its latest persisted checkpoint.
The runtime restores GraphState from the checkpoint and re-executes any nodes
that had not yet completed when the run was suspended. A node the checkpoint
records as write, external, or human effect-class (the node that
interrupted the run) is replayed from its stored output to avoid duplicate
side-effects; all other nodes are re-executed. A replayed node's edges are
evaluated on the restored state with the node's visit recorded
(currentNodeId names the node and visitedNodes lists it), as a node's
are after it runs, so the run follows the targets they pick and skips the
others; a replayed node that picked its target itself, as the exit of a voice
node does, goes to the target its recorded result names. A node that failed
recorded no result and wrote nothing, so it runs again, from the state it ran on.
The same compiled graph that was originally invoked.
Either the original run id or an exact checkpoint id.
The final GraphState.artifacts value after resumption completes.
When no checkpoint exists for the given identifier.
The error of a checkpoint save the store refuses, or of a conditional edge's function that throws, as () throws it.
Resume a previously interrupted run and stream runtime events from the restore point.
Accepts either the original run id or an exact checkpoint id. The resolved checkpoint
is used to reconstruct GraphState, then execution continues through the same event
stream contract as ().
Compiled execution graph to resume.
Either the original run id or an exact checkpoint id.
Runtime events in causal order from the checkpoint onward.
When no checkpoint exists for the given identifier.
The error of a checkpoint save the store refuses, or of a conditional edge's function that throws, as () throws it.
Main execution engine for compiled AgentOS graphs.
Instantiate once and reuse across multiple runs — the runtime itself is stateless between calls. Each
invoke()/stream()/resume()call creates isolated local state tracked via closures.Example