Table of Contents

Class AgentRuntimeExtensions

Namespace
Microsoft.AutoGen.Contracts
Assembly
Microsoft.AutoGen.Core.dll

Provides extension methods for managing and registering agents within an IAgentRuntime.

public static class AgentRuntimeExtensions
Inheritance
AgentRuntimeExtensions
Inherited Members

Methods

RegisterAgentTypeAsync(IAgentRuntime, AgentType, Type, IServiceProvider, params IEnumerable<object>)

public static ValueTask<AgentType> RegisterAgentTypeAsync(this IAgentRuntime runtime, AgentType type, Type runtimeType, IServiceProvider serviceProvider, params IEnumerable<object> additionalArguments)

Parameters

runtime IAgentRuntime
type AgentType
runtimeType Type
serviceProvider IServiceProvider
additionalArguments IEnumerable<object>

Returns

ValueTask<AgentType>

RegisterAgentTypeAsync<TAgent>(IAgentRuntime, AgentType, IServiceProvider, params IEnumerable<object>)

Registers an agent type with the runtime, providing a factory function to create instances of the agent.

public static ValueTask<AgentType> RegisterAgentTypeAsync<TAgent>(this IAgentRuntime runtime, AgentType type, IServiceProvider serviceProvider, params IEnumerable<object> additionalArguments) where TAgent : IHostableAgent

Parameters

runtime IAgentRuntime

The IAgentRuntime where the agent will be registered.

type AgentType

The AgentType representing the type of agent.

serviceProvider IServiceProvider

The service provider used for dependency injection.

additionalArguments IEnumerable<object>

Additional arguments to pass to the agent's constructor.

Returns

ValueTask<AgentType>

A ValueTask<TResult> representing the asynchronous operation of registering the agent.

Type Parameters

TAgent

The type of agent being registered. Must implement IHostableAgent.

RegisterImplicitAgentSubscriptionsAsync(IAgentRuntime, AgentType, Type, bool, bool)

public static ValueTask RegisterImplicitAgentSubscriptionsAsync(this IAgentRuntime runtime, AgentType type, Type runtimeType, bool skipClassSubscriptions = false, bool skipDirectMessageSubscription = false)

Parameters

runtime IAgentRuntime
type AgentType
runtimeType Type
skipClassSubscriptions bool
skipDirectMessageSubscription bool

Returns

ValueTask

RegisterImplicitAgentSubscriptionsAsync<TAgent>(IAgentRuntime, AgentType, bool, bool)

public static ValueTask RegisterImplicitAgentSubscriptionsAsync<TAgent>(this IAgentRuntime runtime, AgentType type, bool skipClassSubscriptions = false, bool skipDirectMessageSubscription = false) where TAgent : IHostableAgent

Parameters

runtime IAgentRuntime
type AgentType
skipClassSubscriptions bool
skipDirectMessageSubscription bool

Returns

ValueTask

Type Parameters

TAgent