Table of Contents

Property Error

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

Error

Gets the exception that caused execution to fail, if applicable.

public Exception Error { get; }

Property Value

Exception

Examples

Handling execution errors:

using LMKit.Model;
using LMKit.Agents;

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

var result = agent.Run("Process this request.");

if (result.IsFailed) { Console.WriteLine($"Execution failed: {result.Error.Message}");

// Log full exception for debugging
if (result.Error.InnerException != null)
{
    Console.WriteLine($"Inner: {result.Error.InnerException.Message}");
}

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

}

Remarks

Only populated when Status is Failed. Use this to understand what went wrong and implement appropriate error handling.

Share