Share via


AgentKernelFunctionFactory.CreateFromAgent Method

Definition

Creates a KernelFunction that will invoke the provided Agent.

public static Microsoft.SemanticKernel.KernelFunction CreateFromAgent(Microsoft.SemanticKernel.Agents.Agent agent, string? functionName = default, string? description = default, System.Collections.Generic.IEnumerable<Microsoft.SemanticKernel.KernelParameterMetadata>? parameters = default, Microsoft.Extensions.Logging.ILoggerFactory? loggerFactory = default);
static member CreateFromAgent : Microsoft.SemanticKernel.Agents.Agent * string * string * seq<Microsoft.SemanticKernel.KernelParameterMetadata> * Microsoft.Extensions.Logging.ILoggerFactory -> Microsoft.SemanticKernel.KernelFunction
Public Shared Function CreateFromAgent (agent As Agent, Optional functionName As String = Nothing, Optional description As String = Nothing, Optional parameters As IEnumerable(Of KernelParameterMetadata) = Nothing, Optional loggerFactory As ILoggerFactory = Nothing) As KernelFunction

Parameters

agent
Agent

The Agent to be represented via the created KernelFunction.

functionName
String

The name to use for the function. If null, it will default to the agent name.

description
String

The description to use for the function. If null, it will default to agent description.

parameters
IEnumerable<KernelParameterMetadata>

Optional parameter descriptions. If null, it will default to query and additional instructions parameters.

loggerFactory
ILoggerFactory

The ILoggerFactory to use for logging. If null, no logging will be performed.

Returns

The created KernelFunction for invoking the Agent.

Applies to