Method Clone
Clone()
Creates a shallow copy of this capabilities instance.
public AgentCapabilities Clone()
Returns
- AgentCapabilities
A new AgentCapabilities instance with the same references.
Examples
Cloning capabilities for a new agent:
using LMKit.Model;
using LMKit.Agents;
using LMKit.Agents.Tools;
using var model = new LM("path/to/model.gguf");
// Configure first agent
var agent1 = new Agent(model);
agent1.Capabilities.EnsureTools().Register(new CalculatorTool());
// Clone capabilities for second agent
var agent2 = new Agent(model);
agent2.Capabilities = agent1.Capabilities.Clone();
// Both agents share the same tool registry
Console.WriteLine(agent1.Capabilities.Tools == agent2.Capabilities.Tools); // True
Remarks
The copy references the same tool registry, skill registry, and memory instances. Changes to the underlying registries will affect both the original and the copy.