Method StreamContentAsync
StreamContentAsync(Agent, string, AgentExecutionOptions, CancellationToken)
Streams only content text (filters out thinking, tool calls, etc.).
public static IAsyncEnumerable<string> StreamContentAsync(this Agent agent, string input, AgentExecutionOptions options = null, CancellationToken cancellationToken = default)
Parameters
agentAgentThe agent to execute.
inputstringThe input prompt.
optionsAgentExecutionOptionsOptional execution options.
cancellationTokenCancellationTokenCancellation token.
Returns
- IAsyncEnumerable<string>
An async enumerable of content text strings.
Examples
await foreach (var text in agent.StreamContentAsync("Hello"))
{
Console.Write(text);
}