Table of Contents

Method Contains

Namespace
LMKit.Agents
Assembly
LM-Kit.NET.dll

Contains(string)

Determines whether an agent with the specified name is registered.

public bool Contains(string name)

Parameters

name string

The name to check. Case-sensitive.

Returns

bool

true if 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.