Table of Contents

Method WithInstruction

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

WithInstruction(string)

Sets the agent's base instruction.

public AgentBuilder WithInstruction(string instruction)

Parameters

instruction string

The instruction text defining the agent's behavior.

Returns

AgentBuilder

This builder instance for method chaining.

Examples

Setting detailed instructions:

using LMKit.Model;
using LMKit.Agents;

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

var agent = new AgentBuilder()
    .WithModel(model)
    .WithPersona("Code Reviewer")
    .WithInstruction(
        "Review code for bugs, security issues, and best practices. " +
        "Provide specific line-by-line feedback. " +
        "Suggest concrete improvements with code examples. " +
        "Be constructive and explain the reasoning behind each suggestion."
    )
    .Build();

Remarks

Instructions define the operational framework: what tasks the agent handles, constraints it observes, and approaches it should take.

Tips for effective instructions:

  • Be specific about the agent's responsibilities.
  • Include any constraints or boundaries.
  • Specify the desired output format if relevant.