runAsync
Main entry method to run the agent in this runner.
Flushes sessionService after appending each final response and before emitting it, and when the run completes or fails with an exception, but not when it is canceled (including by a collector that stops early) or fails with an Error. A failed flush is thrown, or attached as suppressed if the run already failed; an end-of-run flush can fail only after the last event was emitted.
Return
The events generated by the agent.
Parameters
The user ID of the session.
The session ID, fetched (or created, if this runner creates missing sessions) when collection starts.
The invocation ID of the session, set this to resume an interrupted invocation.
A new message to append to the session.
Optional state changes to apply to the session.
The run config for the agent.
Throws
from the flow if the session does not exist and this runner does not create missing sessions.