StateKey

org.llm4s.agent.graph.StateKey
See theStateKey companion object
final class StateKey[A, U]

A typed slot in a graph's thread state.

A is the stored value and U the update a node emits for it. Every update - including a single writer's - is applied to the committed value with applyUpdate, in deterministic task and emission order; replacement is the special case U = A (see StateKey.replace). The function belongs to the compiled graph, never to a checkpoint: checkpoints hold values encoded with stateCodec and pending updates encoded with updateCodec, each tagged with the codec's SchemaVersion so an older checkpoint is migrated before it is decoded.

Keys are compared by identity. A graph rejects two distinct keys with the same id.

Attributes

Companion
object
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

override def toString: String

Returns a string representation of the object.

Returns a string representation of the object.

The default representation is platform dependent.

Attributes

Returns

a string representation of the object.

Definition Classes
Any
def withStateVersion(version: SchemaVersion): StateKey[A, U]

This key with a new state codec version and its migrations; build keys once, at definition.

This key with a new state codec version and its migrations; build keys once, at definition.

Attributes

This key with a new update codec version and its migrations; build keys once, at definition.

This key with a new update codec version and its migrations; build keys once, at definition.

Attributes

Concrete fields

val applyUpdate: (A, U) => Result[A]
val id: StateKeyId
val initial: A
val stateCodec: ReadWriter[A]
val updateCodec: ReadWriter[U]