Table of Contents

Class DelegationManager

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

Manages programmatic delegation between agents with configurable routing and execution policies.

Provides an imperative API (DelegateAsync(DelegationRequest, CancellationToken)) for routing tasks to registered agents with custom routing, timeout handling, and event notifications.

public sealed class DelegationManager
Inheritance
DelegationManager
Inherited Members

Remarks

Scope
DelegationManager is a standalone programmatic API. It is independent of SupervisorOrchestrator, which handles delegation through the delegate_to_agent tool driven by the supervisor model.

Events do not observe orchestration
Subscribing to BeforeDelegation or AfterDelegation on a DelegationManager instance will not fire when a SupervisorOrchestrator delegates to its workers, because the orchestrator does not route through DelegationManager. To observe orchestrator-driven delegation, subscribe to the corresponding events on SupervisorOrchestrator instead.

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 programmatic delegation completes. Does not fire for delegations driven by SupervisorOrchestrator.

BeforeDelegation

Fired before each programmatic delegation executed through DelegateAsync(DelegationRequest, CancellationToken). Does not fire for delegations driven by SupervisorOrchestrator.

Share