Table of Contents

Method WithPlanning

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

WithPlanning(PlanningStrategy)

Sets the planning strategy for the agent.

public AgentBuilder WithPlanning(PlanningStrategy strategy)

Parameters

strategy PlanningStrategy

The planning strategy to use.

Returns

AgentBuilder

This builder instance for method chaining.

Examples

Choosing the right planning strategy:

using LMKit.Model;
using LMKit.Agents;

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

// For math problems, use Chain of Thought
var mathAgent = new AgentBuilder()
    .WithModel(model)
    .WithPersona("Math Tutor")
    .WithPlanning(PlanningStrategy.ChainOfThought)
    .Build();

// For tool-using agents, use ReAct
var researchAgent = new AgentBuilder()
    .WithModel(model)
    .WithPersona("Researcher")
    .WithPlanning(PlanningStrategy.ReAct)
    .WithTools(t => t.Register(new SearchTool()))
    .Build();

// For complex projects, use Plan and Execute
var projectAgent = new AgentBuilder()
    .WithModel(model)
    .WithPersona("Project Manager")
    .WithPlanning(PlanningStrategy.PlanAndExecute)
    .Build();

Remarks

The planning strategy determines how the agent reasons through tasks:

  • None: Direct responses, fastest for simple queries.
  • ChainOfThought: Step-by-step reasoning, good for math and logic.
  • ReAct: Interleaved reasoning and actions, ideal for tool use.
  • PlanAndExecute: Plan first then execute, good for complex multi-step tasks.
  • Reflection: Self-evaluate and refine, improves accuracy.