Table of Contents

Property MaxIterations

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

MaxIterations

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

public int? MaxIterations { get; set; }

Property Value

int?

Examples

Overriding iteration limits:

using LMKit.Model;
using LMKit.Agents;

using var model = new LM("path/to/model.gguf");
var agent = new Agent(model);
agent.MaxIterations = 10; // Default for the agent

// Override for a specific complex task
var options = new AgentExecutionOptions
{
    MaxIterations = 25
};

var result = await agent.RunAsync("Research and compare 5 cloud providers.", options);

Remarks

Overrides the agent's MaxIterations if set to a positive value. Set to null to use the agent's configured value.

Iterations count tool-call and reasoning cycles. Increase for complex tasks requiring many tool invocations; decrease for simple queries or to limit latency.