Agent Class

Base abstraction for all Semantic Kernel agents. An agent instance may participate in one or more conversations. A conversation may include one or more agents. In addition to identity and descriptive meta-data, an Agent must define its communication protocol, or AgentChannel.

Inheritance

Constructor

Agent(*, id: str = None, description: str | None = None, name: str = None, instructions: str | None = None, kernel: Kernel = None)

Keyword-Only Parameters

Name Description
id
description
name
instructions
kernel

Methods

create_channel

Create a communication channel.

get_channel_keys

Get the channel keys.

create_channel

Create a communication channel.

async create_channel() -> AgentChannel

Returns

Type Description

An instance of the agent's channel.

Exceptions

Type Description

If the channel type is not configured.

get_channel_keys

Get the channel keys.

get_channel_keys() -> Iterable[str]

Returns

Type Description

A list of channel keys.

Exceptions

Type Description

If the channel type is not configured.

Attributes

model_computed_fields

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}

model_config

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'populate_by_name': True, 'validate_assignment': True}

model_fields

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.

This replaces Model.fields from Pydantic V1.

model_fields: ClassVar[Dict[str, FieldInfo]] = {'description': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'id': FieldInfo(annotation=str, required=False, default_factory=<lambda>), 'instructions': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'kernel': FieldInfo(annotation=Kernel, required=False, default_factory=Kernel), 'name': FieldInfo(annotation=str, required=False, default_factory=<lambda>)}

channel_type

channel_type: ClassVar[type[AgentChannel] | None] = None

description

description: str | None

id

id: str

instructions

instructions: str | None

is_experimental

is_experimental = True

kernel

kernel: Kernel

name

name: str