Table of Contents

Property IsCancelled

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

IsCancelled

Gets a value indicating whether the execution was cancelled.

public bool IsCancelled { get; }

Property Value

bool

Examples

Handling cancellation:

using LMKit.Model;
using LMKit.Agents;

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

using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(5));

var result = await agent.RunAsync("Write a long essay.", cts.Token);

if (result.IsCancelled) { Console.WriteLine("Task was cancelled (timeout or user request).");

// Partial content might be available
if (!string.IsNullOrEmpty(result.Content))
{
    Console.WriteLine($"Partial result: {result.Content}");
}

}

Share