run method

  1. @override
Stream<Map<String, Object?>> run(
  1. Map<String, Object?> input
)
override

Starts a run with input and streams its events as decoded JSON. The stream closes after RUN_FINISHED or RUN_ERROR. An earlier end or stream error means the run broke.

A connection to an AG-UI server passes agUiRun with input only the decoded frames of this run's request. Cancelling the stream ends the request, even before the response arrives, and waits for its cleanup. The session does not cancel a stopped run: it reads it to the end, to keep the agent's thread consistent.

Implementation

@override
Stream<Map<String, Object?>> run(Map<String, Object?> input) {
  _requests.add(input);
  return _play(_requests.length - 1, input);
}