forEachObserver

suspend fun forEachObserver(notify: (observer: GraphObserver, caller: ObservedCaller) -> Unit)

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:

forEachObserver { observer, caller -> (observer as? CacheObserver)?.onCacheHit(caller) }

The rules of GraphObserver hold for what the observers are told. Does nothing outside a running node or condition. In a subgraph, the caller is the node or edge of the subgraph that runs this code.