autogen
autogen.Agent
Agent
(In preview) A protocol for Agent.
An agent can communicate with other agents and perform actions.
Different agents can differ in what actions they perform in the receive
method.
Name | Description |
---|---|
*args | |
**kwargs |
Instance Attributes
description
The description of the agent. Used for the agent’s introduction in a group chat setting.
name
The name of the agent.
Instance Methods
a_generate_reply
(Async) Generate a reply based on the received messages.
Parameters:Name | Description |
---|---|
messages | a list of messages received from other agents. The messages are dictionaries that are JSON-serializable and follows the OpenAI’s ChatCompletion schema. Type: list[dict[str, typing.Any]] | None Default: None |
sender | sender of an Agent instance. Type: ForwardRef('Agent') | None Default: None |
**kwargs | Type: Any |
Type | Description |
---|---|
str | dict[str, typing.Any] | None | str or dict or None: the generated reply. If None, no reply is generated. |
a_receive
(Async) Receive a message from another agent.
Parameters:Name | Description |
---|---|
message | the message received. If a dict, it should be a JSON-serializable and follows the OpenAI’s ChatCompletion schema. Type: dict[str, typing.Any] | str |
sender | the sender of the message. Type: Agent |
request_reply | whether the sender requests a reply. Type: bool | None Default: None |
a_send
(Async) Send a message to another agent.
Parameters:Name | Description |
---|---|
message | the message to send. If a dict, it should be a JSON-serializable and follows the OpenAI’s ChatCompletion schema. Type: dict[str, typing.Any] | str |
recipient | the recipient of the message. Type: Agent |
request_reply | whether to request a reply from the recipient. Type: bool | None Default: None |
generate_reply
Generate a reply based on the received messages.
Parameters:Name | Description |
---|---|
messages | a list of messages received from other agents. The messages are dictionaries that are JSON-serializable and follows the OpenAI’s ChatCompletion schema. Type: list[dict[str, typing.Any]] | None Default: None |
sender | sender of an Agent instance. Type: ForwardRef('Agent') | None Default: None |
**kwargs | Type: Any |
Type | Description |
---|---|
str | dict[str, typing.Any] | None | str or dict or None: the generated reply. If None, no reply is generated. |
receive
Receive a message from another agent.
Parameters:Name | Description |
---|---|
message | the message received. If a dict, it should be a JSON-serializable and follows the OpenAI’s ChatCompletion schema. Type: dict[str, typing.Any] | str |
sender | the sender of the message. Type: Agent |
request_reply | whether the sender requests a reply. Type: bool | None Default: None |
send
Send a message to another agent.
Parameters:Name | Description |
---|---|
message | the message to send. If a dict, it should be a JSON-serializable and follows the OpenAI’s ChatCompletion schema. Type: dict[str, typing.Any] | str |
recipient | the recipient of the message. Type: Agent |
request_reply | whether to request a reply from the recipient. Type: bool | None Default: None |