Method StreamAsync
StreamAsync(Agent, string, AgentStreamResult, AgentExecutionOptions, CancellationToken)
Streams agent output as an async enumerable.
public IAsyncEnumerable<AgentStreamToken> StreamAsync(Agent agent, string input, AgentStreamResult resultAccumulator = null, AgentExecutionOptions options = null, CancellationToken cancellationToken = default)
Parameters
agentAgentThe agent to execute.
inputstringThe input prompt.
resultAccumulatorAgentStreamResultOptional handler to accumulate the result.
optionsAgentExecutionOptionsOptional execution options.
cancellationTokenCancellationTokenCancellation token.
Returns
- IAsyncEnumerable<AgentStreamToken>
An async enumerable of streaming tokens.