Class AgentTemplate
Base class for agent templates that provide pre-configured agents for common use cases.
public abstract class AgentTemplate
- Inheritance
-
AgentTemplate
- Derived
- Inherited Members
Examples
Building an agent from a derived template (the typical usage):
using LMKit.Model;
using LMKit.Agents;
using LMKit.Agents.Templates;
using var model = LM.LoadFromModelID("qwen3:8b");
var template = new ResearchAgentTemplate
{
Model = model,
AdditionalInstructions = "Always cite sources.",
MaxIterations = 5
};
Agent agent = template.Build();
var result = await agent.RunAsync("Survey recent advances in vector databases.");
Remarks
Templates encapsulate best practices for specific agent patterns, including appropriate system prompts, planning strategies, tool configurations, and execution settings.
Derived templates can be customized before building the final agent.
Properties
- AdditionalInstructions
Gets or sets additional instructions to append to the system prompt.
- MaxIterations
Gets or sets the maximum iterations for execution.
- Model
Gets or sets the model to use.
- TemplateName
Gets the template name.
Methods
- Build()
Builds the configured agent.
- CombinePrompt(string)
Combines the base system prompt with additional instructions.
- ConfigureBuilder(AgentBuilder)
Configures the agent builder with template-specific settings.