Table of Contents

Property Timeout

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

Timeout

Gets or sets the maximum time allowed for execution.

public TimeSpan? Timeout { get; set; }

Property Value

TimeSpan?

Examples

Setting execution timeouts:

using LMKit.Model;
using LMKit.Agents;

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

// Short timeout for chat interactions var chatOptions = new AgentExecutionOptions { Timeout = TimeSpan.FromSeconds(30) };

var result = await agent.RunAsync("Quick question: what is 2+2?", chatOptions);

if (result.IsCancelled) { Console.WriteLine("Response took too long."); }

Remarks

When exceeded, the execution is cancelled and returns with Cancelled. Set to null (default) for no timeout.

Timeouts are essential for user-facing applications to ensure responsive behavior.

Share