Table of Contents

Property ToolPolicy

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

ToolPolicy

Gets or sets the policy governing tool usage during execution.

public ToolCallPolicy ToolPolicy { get; set; }

Property Value

ToolCallPolicy

Examples

Forcing the agent to always use tools:

using LMKit.Model;
using LMKit.Agents;
using LMKit.Agents.Tools;

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

// Register a tool
agent.EnsureTools().Register(new MySearchTool());

// Require tool usage on every turn
agent.ToolPolicy.Choice = ToolChoice.Required;

Remarks

The tool policy controls how and when the agent uses tools:

  • Auto: Let the model decide when to use tools.
  • Required: Force the model to use at least one tool.
  • None: Disable tool usage entirely.
  • Specific: Force usage of a specific named tool.

If not set, a new ToolCallPolicy with default settings is created on first access.