GraphRuntime

org.llm4s.agent.graph.GraphRuntime
final class GraphRuntime(checkpointer: Checkpointer, clock: Clock)

Runs compiled graphs on durable threads.

start begins a run: on a new thread from the graph's entry, on a thread whose latest run completed by applying the input to its committed state. It refuses a thread with an incomplete execution (GraphError.IncompleteRun). recover continues an incomplete execution from its latest checkpoint without new input: tasks with a pending write are not run again, and failed or unstarted tasks run once more (per-node retry policy is Stage 1).

subscribe replays a thread's committed events after a sequence number and then delivers new ones as their commits succeed, in ascending order with no gaps or duplicates, followed by live progress as it happens. Events are delivered on the committing thread; a dedicated ordered dispatcher with bounded queues is part of the run API (#1271).

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

def recover[I, O](graph: CompiledGraph[I, O], threadId: ThreadId, runId: RunId, durability: Durability): Result[RunResult[O]]

Continues the incomplete execution on threadId; see the class description.

Continues the incomplete execution on threadId; see the class description.

Attributes

def start[I, O](threadId: ThreadId, graph: CompiledGraph[I, O], input: I, runId: RunId, durability: Durability): Result[RunResult[O]]

Starts a run on threadId with input; see the class description.

Starts a run on threadId with input; see the class description.

Attributes

def subscribe(threadId: ThreadId, afterSeq: Long)(listener: StreamEvent => Unit): Result[Subscription]

Replays events with seq > afterSeq, then delivers new events until cancelled.

Replays events with seq > afterSeq, then delivers new events until cancelled.

Attributes