Method EnableDelegation
EnableDelegation()
Creates and registers a DelegateTool for this agent.
public DelegateTool EnableDelegation()
Returns
- DelegateTool
The created tool, or null if no delegates are configured.
Examples
Enabling delegation for a coordinator agent:
using LMKit.Model;
using LMKit.Agents;
using var model = new LM("path/to/model.gguf");
// Create specialist agents
var codeAgent = new Agent(
new AgentIdentity("Coder", "Write clean, efficient code."),
model
);
var reviewAgent = new Agent(
new AgentIdentity("Reviewer", "Review code for bugs and improvements."),
model
);
// Create coordinator with delegation
var coordinator = new Agent(model);
coordinator.Identity = new AgentIdentity(
"Project Lead",
"Coordinate coding and review tasks."
);
coordinator.Delegates = new AgentRegistry();
coordinator.Delegates.Register("coder", codeAgent);
coordinator.Delegates.Register("reviewer", reviewAgent);
// Enable the delegation tool
var delegateTool = coordinator.EnableDelegation();
if (delegateTool != null)
{
Console.WriteLine("Delegation enabled!");
}
// Now the coordinator can delegate tasks
var result = await coordinator.RunAsync(
"Write a function to sort a list, then review it."
);