Table of Contents

Method Build

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

Build()

Builds the configured Agent instance.

public Agent Build()

Returns

Agent

A new Agent configured with the builder's settings.

Examples

Building an agent and validating it:

using LMKit.Model;
using LMKit.Agents;

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

var agent = new AgentBuilder() .WithModel(model) .WithPersona("Helper") .WithInstruction("Assist with general questions.") .Build();

// Validate before use if (agent.Validate(out var errors)) { var result = agent.Run("Hello!"); Console.WriteLine(result.Content); } else { Console.WriteLine("Configuration errors:"); foreach (var error in errors) { Console.WriteLine($" - {error}"); } }

Remarks

The builder does not validate configuration. Call Validate(out IReadOnlyList<string>) on the returned agent to check for configuration errors, or use BuildAndValidate(out IReadOnlyList<string>) to get validation results directly.

Share