Method Execute
Execute(Agent, string, CancellationToken)
Executes a task synchronously with the specified agent.
public AgentExecutionResult Execute(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
- AgentExecutionResult
The execution result containing the agent's response and metadata.
Exceptions
- ArgumentNullException
Thrown when
agentorinputisnull.- InvalidOperationException
Thrown when the agent is not properly configured.
- ObjectDisposedException
Thrown when this executor has been disposed.
Execute(Agent, string, AgentExecutionOptions, CancellationToken)
Executes a task synchronously with the specified agent and options.
public AgentExecutionResult Execute(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
- AgentExecutionResult
The execution result containing the agent's response and metadata.