Method ExecuteAsync
- Namespace
- LMKit.Agents.Resilience
- Assembly
- LM-Kit.NET.dll
ExecuteAsync(Agent, string, CancellationToken)
Executes a single task 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>
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).
ExecuteAsync(Agent, string, AgentExecutionOptions, CancellationToken)
Executes with additional options.
public Task<AgentExecutionResult> ExecuteAsync(Agent agent, string input, AgentExecutionOptions options, CancellationToken cancellationToken = default)
Parameters
agentAgentinputstringoptionsAgentExecutionOptionscancellationTokenCancellationToken