Method Contains
Contains(string)
Determines whether an agent with the specified name is registered.
public bool Contains(string name)
Parameters
namestringThe name to check. Case-sensitive.
Returns
- bool
trueif an agent with the specified name is registered; otherwise,false.
Examples
Example: Checking agent availability before delegation
using LMKit.Agents;
var registry = new AgentRegistry();
// ... agents registered ...
string[] requiredAgents = { "planner", "executor", "reviewer" };
var missing = requiredAgents.Where(name => !registry.Contains(name)).ToList();
if (missing.Count > 0)
{
Console.WriteLine($"Missing required agents: {string.Join(", ", missing)}");
}
else
{
Console.WriteLine("All required agents are available.");
}
Remarks
Returns false for null, empty, or whitespace names without throwing
an exception. This makes it safe to use with untrusted input.