runLive

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.

Return

The run's events.

Parameters

userId

The user ID of the session.

sessionId

The session ID, fetched (or created, if the runner creates missing sessions) when collection starts.

liveRequestQueue

The queue for content, media, and activity signals.

runConfig

The run configuration, or null for the RunConfig() defaults.

Throws

from the flow if the session does not exist and the runner does not create missing sessions.

from the flow if another live connection is reading liveRequestQueue, or if a live node of the run starts while another one is connected.