WatchPolicy

org.llm4s.agent.graph.WatchPolicy
See theWatchPolicy companion object
final case class WatchPolicy

How a GraphRuntime's subscriptions learn of commits made through another runtime or process sharing its Checkpointer. Commits made through the runtime itself are handed to its subscriptions as they land, whatever this says.

While enabled, each live subscription watches the store on a virtual thread of its own, named llm4s-watch-<threadId>, calling Checkpointer.awaitEventsAfter with pollInterval as the timeout, from the last event it has queued. A store that can be told of commits returns as soon as one lands; one that cannot - the default, and the SQLite store - is read once per pollInterval, so a commit made elsewhere reaches the subscription up to pollInterval after it lands. Only durable events cross runtimes: live progress (StreamEvent.Live) is never stored, so it reaches only the subscriptions of the runtime whose run sent it. When disabled, a subscription sees another runtime's commits only by subscribing again, which replays the log; a runtime that knows it is the only one using its store can disable it to save the watching thread and its reads.

pollInterval must be at least one millisecond - a shorter one would have every subscription read a polled store in a busy loop: apply and the with* setters throw IllegalArgumentException otherwise, and WatchPolicy.of returns a ValidationError.

Attributes

Companion
object
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

def withEnabled(e: Boolean): WatchPolicy
def withPollInterval(i: FiniteDuration): WatchPolicy

Inherited methods

def productElementNames: Iterator[String]

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

Attributes

Inherited from:
Product