Method ExecuteAsync
ExecuteAsync(Agent, string, CancellationToken)
Executes a task asynchronously with the specified agent.
public Task<AgentExecutionResult> ExecuteAsync(Agent agent, string input, CancellationToken cancellationToken = default)
Parameters
agentAgentThe agent to execute.
inputstringThe user input or task prompt.
cancellationTokenCancellationTokenA token to cancel the operation.
Returns
- Task<AgentExecutionResult>
A task that resolves to the execution result.
Exceptions
- ArgumentNullException
Thrown when
agentorinputisnull.- InvalidOperationException
Thrown when the agent is not properly configured.
- ObjectDisposedException
Thrown when this executor has been disposed.
ExecuteAsync(Agent, string, AgentExecutionOptions, CancellationToken)
Executes a task asynchronously with the specified agent and options.
public Task<AgentExecutionResult> ExecuteAsync(Agent agent, string input, AgentExecutionOptions options, CancellationToken cancellationToken = default)
Parameters
agentAgentThe agent to execute.
inputstringThe user input or task prompt.
optionsAgentExecutionOptionsExecution options, or
nullto use defaults.cancellationTokenCancellationTokenA token to cancel the operation.
Returns
- Task<AgentExecutionResult>
A task that resolves to the execution result.
Exceptions
- ArgumentNullException
Thrown when
agentorinputisnull.- InvalidOperationException
Thrown when the agent is not properly configured.
- ObjectDisposedException
Thrown when this executor has been disposed.