runTurn abstract method

TurnStream runTurn(
  1. AgentInput input,
  2. AgentInit init, {
  3. CancellationToken? cancel,
  4. Map<String, dynamic>? context,
})

Runs a single turn, returning the streamed chunks plus a future for the final, non-throwing AgentOutput.

context is the ambient request context to run the turn under. It is only meaningful for the in-process transport (which runs the turn under that context, observable as AgentFnOptions.context). A remote agent derives its context server-side from the incoming HTTP request (headers, auth, etc.), so the remote transport rejects a non-empty context with an UnsupportedError rather than silently dropping it.

Implementation

TurnStream runTurn(
  AgentInput input,
  AgentInit init, {
  CancellationToken? cancel,
  Map<String, dynamic>? context,
});