Runner

interface Runner : AutoCloseable

The Runner interface defines the contract for running agents.

Inheritors

Properties

Link copied to clipboard
abstract val agent: BaseAgent

The agent this runner runs. For a node-rooted runner this is a NodeViewAgent over the running node.

Link copied to clipboard
abstract val appName: String
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open val node: Node?

The node this runner runs, set when rooted on a node graph. The go-forward field; once agent is removed it holds the running unit for every runner.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
abstract override fun close()

Releases resources held by this runner, such as its plugins and the toolsets its agents own.

Link copied to clipboard
open suspend fun rewindAsync(userId: String, sessionId: String, rewindBeforeInvocationId: String)

Rewinds the session to before the specified invocation.

Link copied to clipboard
abstract fun run(userId: String, sessionId: String, newMessage: Content, runConfig: RunConfig? = null): Iterator<Event>

Sync interface for local testing and convenience purpose.

Link copied to clipboard
abstract fun runAsync(userId: String, sessionId: String, invocationId: String? = null, newMessage: Content? = null, stateDelta: Map<String, Any>? = null, runConfig: RunConfig? = null): Flow<Event>

Main entry method to run the agent in this runner asynchronously.

Link copied to clipboard
open fun runLive(userId: String, sessionId: String, liveRequestQueue: LiveRequestQueue, runConfig: RunConfig? = null): Flow<Event>

Runs the root agent or node, such as a workflow, live and returns a cold Flow of the run's Events, delivering a live agent's inline audio, video, and image data to the caller without storing it in the session. An agent talks over a live (bidirectional streaming) connection until the caller closes liveRequestQueue or the model ends the session, with no RunConfig.maxLlmCalls limit; a node starts with no input and runs until it ends. The returned flow fails with UnsupportedOperationException for a task agent inside a node root that delegates to task sub-agents (before anything connects when the root's graph holds it, otherwise when it starts), for a graph agent node's transfer unless the node is single-turn, and for a Runner that does not override this.