Method Execute
Execute(Agent, string, CancellationToken)
Executes a single task synchronously with the specified agent.
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 (e.g., missing required model).