Method CreateDelegationManager
CreateDelegationManager()
Creates a DelegationManager for this agent.
public DelegationManager CreateDelegationManager()
Returns
- DelegationManager
A delegation manager, or null if no delegates are configured.
Examples
Using DelegationManager for manual routing:
using LMKit.Model;
using LMKit.Agents;
using var model = new LM("path/to/model.gguf");
var mathAgent = new Agent(
new AgentIdentity("Math Expert", "Solve mathematical problems."),
model
);
var coordinator = new Agent(model);
coordinator.Delegates = new AgentRegistry();
coordinator.Delegates.Register("math", mathAgent);
// Create a delegation manager for manual control
var manager = coordinator.CreateDelegationManager();
if (manager != null)
{
// Manually delegate a task
var delegationResult = await manager.DelegateAsync(
"math",
"Calculate 15% compound interest on $1000 over 5 years."
);
Console.WriteLine(delegationResult.Content);
}
Remarks
The delegation manager provides programmatic control over task delegation, useful when you want to route tasks manually rather than letting the agent decide.