Table of Contents

Class DelegationManager

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

Manages delegation between agents with configurable routing and execution policies.

Provides a centralized way to handle agent-to-agent task delegation with support for custom routing, timeout handling, and event notifications.

public sealed class DelegationManager
Inheritance
DelegationManager
Inherited Members

Constructors

DelegationManager(AgentRegistry, IDelegationRouter)

Initializes a new instance of the DelegationManager class.

Properties

DefaultTimeout

Gets or sets the default timeout for delegated executions.

Set to null (default) for no timeout.

MaxDelegationDepth

Gets or sets the maximum delegation depth to prevent infinite recursion.

Default is 5. Set to 0 to disable depth checking.

Methods

AutoDelegateAsync(string, string, CancellationToken)

Attempts to automatically route a task to the best available agent.

CreateTool(Agent)

Creates a DelegateTool that uses this manager's registry.

DelegateAsync(DelegationRequest, CancellationToken)

Delegates a task using a delegation request.

DelegateAsync(string, string, string, CancellationToken)

Delegates a task to an agent by name.

FromAgent(Agent)

Creates a delegation manager from an agent's delegates.

GetAvailableAgents()

Gets the names of all available delegate agents.

Events

AfterDelegation

Fired after each delegation completes.

BeforeDelegation

Fired before each delegation execution.