Table of Contents

Class AgentExecutionOptions

Namespace
LMKit.Agents
Assembly
LM-Kit.NET.dll

Configuration options for agent execution, providing fine-grained control over context sizing, iteration limits, timeouts, and output constraints.

public sealed class AgentExecutionOptions
Inheritance
AgentExecutionOptions
Inherited Members

Examples

Using execution options for different scenarios:

using LMKit.Model;
using LMKit.Agents;

using var model = new LM("path/to/model.gguf");
var agent = new Agent(model);

// Quick response with timeout
var quickOptions = new AgentExecutionOptions
{
    Timeout = TimeSpan.FromSeconds(10),
    MaxCompletionTokens = 200
};
var quickResult = agent.Run("Give a one-sentence summary of AI.", quickOptions);

// Deep research with more iterations
var researchOptions = new AgentExecutionOptions
{
    MaxIterations = 20,
    Timeout = TimeSpan.FromMinutes(5)
};
var researchResult = agent.Run("Analyze the pros and cons of microservices.", researchOptions);

Remarks

Execution options allow you to customize how an agent processes a specific task without modifying the agent's base configuration. Options can override agent defaults for individual executions.

Common Use Cases

  • Set timeouts for user-facing applications.
  • Limit token output for summary tasks.
  • Increase iterations for complex research tasks.
  • Clear history for stateless interactions.

Properties

ClearHistoryBeforeExecution

Gets or sets a value indicating whether to clear conversation history before execution.

ContextSize

Gets or sets the context size for the conversation.

Default

Gets the default execution options.

MaxCompletionTokens

Gets or sets the maximum number of tokens for completion per turn.

MaxIterations

Gets or sets the maximum number of iterations allowed during execution.

Timeout

Gets or sets the maximum time allowed for execution.

Methods

Clone()

Creates a copy of this options instance.