Package-level declarations
Types
The stored checkpoint of threadId could not be read, for example because the file is damaged or was written in a newer format. Checkpointer implementations throw this from Checkpointer.load.
Persists the checkpoints of each thread so a run can pause and resume later, even in a different process.
CompiledGraph.resume was called for threadId, but the checkpointer has no checkpoint for it.
An executable graph produced by StateGraph.compile. It is immutable and can be shared and run concurrently; each run is isolated by GraphConfig.threadId.
A routing function for a conditional edge: it inspects the current state and returns the name of the node to run next, or END to finish.
The condition of the conditional edge from from threw an exception. The original exception is available as cause. Cancellation is handled as for NodeExecutionException.
CompiledGraph.resume was called for threadId, but its last run already completed. Start a new run with CompiledGraph.invoke.
Per-run settings for a CompiledGraph.
A progress event emitted by CompiledGraph.stream and CompiledGraph.streamResume.
Watches the runs of a graph: when a run starts and how it ends, when each node starts and how it ends, when the condition of an edge decides where the run goes, which nodes come next after a step, and when a checkpoint is saved. Use it to send traces and metrics to the tools a team already has, such as OpenTelemetry with telar-otel. Give it to a run with GraphConfig.observers:
The outcome of CompiledGraph.invoke or CompiledGraph.resume.
Runs one thread of a graph for a screen: the run is a StateFlow of GraphSnapshots that a UI draws, and the screen starts, resumes and cancels it with plain function calls. It is the unidirectional data flow of an app (state down, events up) with a graph behind it.
Where the run of a GraphSession stands. A screen draws one of these with a when, and each holds what it needs to.
The structure of a compiled graph: its nodes and the edges between them. Read it from CompiledGraph.topology to draw the graph or to check it in a test.
The graph ran more steps than GraphConfig.maxIterations allows, which usually means a cycle never routes to END.
A Checkpointer that keeps checkpoints in memory. Intended for tests and short-lived processes. Safe to share between coroutines and threads.
A Store that keeps its items in memory, for tests and for apps that remember only while they run. Safe to share between coroutines and threads.
A reducer built with mergeRules could not merge the states of a step: a node changed a property that has no rule, or two nodes changed a property in ways its rule cannot combine. It is the cause of the ReducerException the run fails with.
A Reducer built by mergeRules from one rule for each property. Give it to StateGraph.compile, as rules or as reducer, to merge every node of a step, whatever form it has.
The rules of a mergeRules block.
The work a node performs: a suspending function that takes the current state and returns the updated state.
A node's action threw an exception. The original exception is available as cause.
A reference to a node added with StateGraph.node. Use it with StateGraph.then and StateGraph.conditionalEdge to connect nodes without repeating their names, and read name where a node name is needed (for example in GraphConfig.interruptBefore).
A try of a node took longer than the timeout the node was added with, and was cancelled. It is the cause of the NodeExecutionException the run fails with, and what the retryOn of a Retry gets.
The part of a run whose code is running: a node, or the condition of an edge. A library that reports what happens inside, such as the calls to models of telar-agent, reports it under the caller that forEachObserver gives.
An edge with a condition, which a GraphObserver is told about when the condition runs. It is the same object from the start of the condition to its end.
A node in one step of a run, which a GraphObserver is told about. It is the same object from the start of the node to its end.
A run that a GraphObserver is told about. It is the same object from the start of the run to its end, so an observer can keep what belongs to a run, such as a trace span, in a map with the run as its key.
The Reducer threw an exception while it merged the results of nodes, the nodes of the failed step that each returned a whole state. The original exception is available as cause. Cancellation is handled as for NodeExecutionException.
Says how often a node is tried again after it failed, and how long the engine waits between two tries. Give it to a node as retry:
Builder for a graph of nodes and edges over an immutable State.
Converts a graph state to and from a string so a Checkpointer can persist it.
Keeps what an agent learned between conversations: a preference of a user, a fact, an earlier decision. A Checkpointer saves the state of one thread; a store belongs to no thread, so every run that is given the same store reads what the others wrote.
Where a run stands inside a subgraph that was added with StateGraph.subgraph. It is a Checkpoint without a state: the state of a subgraph is kept in the state of the graph around it.
Base class for every error raised by Telar itself, so callers can catch the whole family with a single catch (e: TelarException). Integration modules and custom Checkpointers may add their own subclasses.
CompiledGraph.fork was asked to start the thread threadId, which already has a checkpoint. A fork starts a thread of its own, so that it cannot overwrite a run. Choose another id, or delete the thread first.
Properties
Functions
Runs block, a side effect such as a payment or an email, once for the step of the node that calls it, and returns its result. When the step runs again, the call returns the result of the first time and block does not run.
Returns the id of the effect with a reconcile whose block or reconcile is running, and null elsewhere. It is the same each time the step of the effect runs again, so it is the idempotency key to pass to a service from code that does not get the id itself, such as a tool of telar-agent.
Calls notify with each observer of the run and the node that runs this code. Does nothing outside a running node, also in the condition of an edge.
Calls notify with each observer of the run and the node or edge that runs this code, so that a library can tell observers of its own kind about what happens inside a node or in the condition of an edge. telar-agent tells its AgentObservers about the calls to models and tools this way:
Returns true when this code runs in a node of a run that is collected with CompiledGraph.stream or CompiledGraph.streamResume, so that what it passes to reportProgress reaches a collector. A node can use it to skip work that only produces progress.
Builds MergeRules from one rule for each property that nodes of the same step may change, in place of a reducer that merges whole states by hand:
Reports value from a running node to whoever collects the run: it arrives as a GraphEvent.NodeProgress in the flow of CompiledGraph.stream or CompiledGraph.streamResume, before the node's GraphEvent.NodeCompleted. Use it for what a node produces while it works, such as the text a model writes or how far a download is.
DSL entry point for building a StateGraph.
Returns the Store of the running graph, which GraphConfig.store gave it. Call it from the action of a node, the work of a node, or a tool that a node runs. The nodes of a subgraph, and so the agents of a team, reach the store of the graph around them.
Returns this history of a thread after checkpoint is saved, for a Checkpointer that keeps a history: the checkpoints with an earlier step, then checkpoint, and of those the last maxHistory.