AgentChannel Class

Defines the communication protocol for a particular Agent type.

An agent provides it own AgentChannel via CreateChannel.

Note: This class is experimental and may change in the future.

Inheritance
AgentChannel

Constructor

AgentChannel()

Methods

get_history

Retrieve the message history specific to this channel.

invoke

Perform a discrete incremental interaction between a single Agent and AgentChat.

invoke_stream

Perform a discrete incremental stream interaction between a single Agent and AgentChat.

receive

Receive the conversation messages.

Used when joining a conversation and also during each agent interaction.

reset

Reset any persistent state associated with the channel.

get_history

Retrieve the message history specific to this channel.

abstract get_history() -> AsyncIterable[ChatMessageContent]

Returns

Type Description

An async iterable of ChatMessageContent.

invoke

Perform a discrete incremental interaction between a single Agent and AgentChat.

abstract invoke(agent: Agent) -> AsyncIterable[tuple[bool, ChatMessageContent]]

Parameters

Name Description
agent
Required

The agent to interact with.

Returns

Type Description

An async iterable of a bool, ChatMessageContent.

invoke_stream

Perform a discrete incremental stream interaction between a single Agent and AgentChat.

abstract invoke_stream(agent: Agent, history: list[ChatMessageContent]) -> AsyncIterable[ChatMessageContent]

Parameters

Name Description
agent
Required

The agent to interact with.

history
Required

The history of messages in the conversation.

Returns

Type Description

An async iterable ChatMessageContent.

receive

Receive the conversation messages.

Used when joining a conversation and also during each agent interaction.

abstract async receive(history: list[ChatMessageContent]) -> None

Parameters

Name Description
history
Required

The history of messages in the conversation.

reset

Reset any persistent state associated with the channel.

abstract async reset() -> None

Attributes

is_experimental

is_experimental = True