Constructor DelegateStreamHandler
DelegateStreamHandler(Func<AgentStreamToken, CancellationToken, Task>, Func<Agent, string, CancellationToken, Task>, Func<AgentExecutionResult, CancellationToken, Task>, Func<Exception, CancellationToken, Task>)
Initializes a new instance with async callbacks.
public DelegateStreamHandler(Func<AgentStreamToken, CancellationToken, Task> onTokenAsync = null, Func<Agent, string, CancellationToken, Task> onStartAsync = null, Func<AgentExecutionResult, CancellationToken, Task> onCompleteAsync = null, Func<Exception, CancellationToken, Task> onErrorAsync = null)
Parameters
onTokenAsyncFunc<AgentStreamToken, CancellationToken, Task>Called for each token.
onStartAsyncFunc<Agent, string, CancellationToken, Task>Called when streaming starts.
onCompleteAsyncFunc<AgentExecutionResult, CancellationToken, Task>Called when streaming completes.
onErrorAsyncFunc<Exception, CancellationToken, Task>Called on error.
DelegateStreamHandler(Action<AgentStreamToken>, Action<Agent, string>, Action<AgentExecutionResult>, Action<Exception>)
Initializes a new instance with synchronous callbacks.
public DelegateStreamHandler(Action<AgentStreamToken> onToken = null, Action<Agent, string> onStart = null, Action<AgentExecutionResult> onComplete = null, Action<Exception> onError = null)
Parameters
onTokenAction<AgentStreamToken>Called for each token.
onStartAction<Agent, string>Called when streaming starts.
onCompleteAction<AgentExecutionResult>Called when streaming completes.
onErrorAction<Exception>Called on error.