Table of Contents

Constructor Agent

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

Agent()

Initializes a new instance of the Agent class with default settings.

public Agent()

Examples

Creating an agent and configuring it step by step:

using LMKit.Model;
using LMKit.Agents;

var agent = new Agent();

using var model = new LM("path/to/model.gguf");
agent.Model = model;
agent.Identity = new AgentIdentity("Helper", "Assist with tasks.");
agent.Planning = PlanningStrategy.ChainOfThought;

var result = agent.Run("What is 15% of 200?");
Console.WriteLine(result.Content);

Remarks

Creates an unconfigured agent. You must assign a Model before execution.

Agent(LM)

Initializes a new instance of the Agent class with the specified model.

public Agent(LM model)

Parameters

model LM

The language model to use for inference.

Examples

Creating an agent with a model:

using LMKit.Model;
using LMKit.Agents;

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

// The agent is ready for basic use
var result = agent.Run("Say hello!");
Console.WriteLine(result.Content);

Exceptions

ArgumentNullException

Thrown when model is null.

Agent(AgentIdentity, LM)

Initializes a new instance of the Agent class with the specified identity and model.

public Agent(AgentIdentity identity, LM model)

Parameters

identity AgentIdentity

The agent's identity defining persona and instruction.

model LM

The language model to use for inference.

Examples

Creating a fully configured agent:

using LMKit.Model;
using LMKit.Agents;

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

var identity = new AgentIdentity(
    persona: "Math Tutor",
    instruction: "Explain mathematical concepts step by step. " +
                 "Use examples to illustrate your explanations."
);

var agent = new Agent(identity, model);
var result = agent.Run("Explain the Pythagorean theorem.");
Console.WriteLine(result.Content);

Exceptions

ArgumentNullException

Thrown when model is null.