org.llm4s.agent.graph.spi

Members list

Type members

Classlikes

@Experimental
final class CheckpointStore extends AutoCloseable

An open checkpoint store, as a CheckpointerBackend returns it: the Checkpointer to build a GraphRuntime over, the store's RunQueue when it has one, and the means to close what the backend opened for them (a file, a connection pool).

An open checkpoint store, as a CheckpointerBackend returns it: the Checkpointer to build a GraphRuntime over, the store's RunQueue when it has one, and the means to close what the backend opened for them (a file, a connection pool).

The queue lives in the same database as the checkpoints and shares the checkpointer's connection pool (design 4.55), so a queue opened from application.conf repeats no store setting under llm4s.agent.queue: open the store with CheckpointerConfigLoader.open() and take runQueue from it. The built-in memory, sqlite and postgres stores all have one.

Close it when the application stops, after every runtime and worker over it has finished: close() releases the backend's resources once, and later calls do nothing. Calls to the checkpointer or the queue after close fail as the store documents.

Value parameters

kind

the llm4s.agent.checkpointer.kind the store was opened for

Attributes

Companion
object
Supertypes
trait AutoCloseable
class Object
trait Matchable
class Any

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
@Experimental

A checkpoint store's contribution to CheckpointerConfigLoader.open (design 4.54): how a CheckpointerSettings block becomes an open CheckpointStore.

A checkpoint store's contribution to CheckpointerConfigLoader.open (design 4.54): how a CheckpointerSettings block becomes an open CheckpointStore.

llm4s.agent.checkpointer.kind names the store an application runs on, and the loader hands the backend registered for that kind its own block, llm4s.agent.checkpointer.<kind>, flattened to strings. llm4s-agent builds the memory store itself; every other store module registers its backend, so choosing a store is adding its dependency and setting kind, with no code:

kind module
memory llm4s-agent (built in)
sqlite llm4s-agent-checkpoint-sqlite
postgres llm4s-agent-checkpoint-postgres

Implementations must be a plain class with a public no-arg constructor, '''not''' a Scala object: java.util.ServiceLoader instantiates the named class. Declare it in META-INF/services/org.llm4s.agent.graph.spi.CheckpointerBackend, and ship the block's defaults and its ${?VAR} bindings in the module's own reference.conf. A backend can also be registered explicitly with CheckpointerBackends.of or CheckpointerBackends.withBackend, which is the answer for a shaded jar whose services files did not survive.

final class MyStoreBackend extends CheckpointerBackend:
 val kind = "mystore"
 def open(settings: CheckpointerSettings): Result[CheckpointStore] =
   for
     url     <- settings.string("url")
     timeout <- settings.duration("callTimeout", 5.seconds)
     store   <- MyStore.open(url, timeout)
   yield CheckpointStore(kind, store, () => store.close()).withRunQueue(store.runQueue) // if it has one

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
@Experimental
final class CheckpointerBackends

The checkpoint store backends CheckpointerConfigLoader.open can dispatch to, keyed by kind.

The checkpoint store backends CheckpointerConfigLoader.open can dispatch to, keyed by kind.

Usually obtained from CheckpointerBackends.discover, which reads META-INF/services/org.llm4s.agent.graph.spi.CheckpointerBackend entries off the classpath. The memory kind is always available, an InMemoryCheckpointer on the system clock, unless a registered backend claims it. When two backends claim one kind the later registration wins, so an explicit withBackend replaces a discovered one.

Value parameters

discovered

whether this set came from classpath discovery rather than explicit registration

failures

one line per service entry that could not be loaded, for diagnosing a missing backend; empty when discovery was clean or did not run

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
@Experimental
final class CheckpointerSettings

What a CheckpointerBackend opens its store from: the selected kind and that kind's own block, llm4s.agent.checkpointer.<kind>, flattened to strings keyed by their path inside the block (busyTimeout, pool.size).

What a CheckpointerBackend opens its store from: the selected kind and that kind's own block, llm4s.agent.checkpointer.<kind>, flattened to strings keyed by their path inside the block (busyTimeout, pool.size).

The typed readers turn a missing or malformed value into a ConfigurationError that names the full key, never the value, which may be a password. toString lists only the keys, for the same reason.

Value parameters

extras

the kind's block; empty when the configuration has none

kind

the selected kind, lower-cased

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type