Agent
autogen.Agent #
Bases: Protocol
(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.
description property
#
The description of the agent. Used for the agent's introduction in a group chat setting.
send #
Send a message to another agent.
PARAMETER | DESCRIPTION |
---|---|
message | the message to send. If a dict, it should be a JSON-serializable and follows the OpenAI's ChatCompletion schema. |
recipient | the recipient of the message. TYPE: |
request_reply | whether to request a reply from the recipient. TYPE: |
Source code in autogen/agentchat/agent.py
a_send async
#
(Async) Send a message to another agent.
PARAMETER | DESCRIPTION |
---|---|
message | the message to send. If a dict, it should be a JSON-serializable and follows the OpenAI's ChatCompletion schema. |
recipient | the recipient of the message. TYPE: |
request_reply | whether to request a reply from the recipient. TYPE: |
Source code in autogen/agentchat/agent.py
receive #
Receive a message from another agent.
PARAMETER | DESCRIPTION |
---|---|
message | the message received. If a dict, it should be a JSON-serializable and follows the OpenAI's ChatCompletion schema. |
sender | the sender of the message. TYPE: |
request_reply | whether the sender requests a reply. TYPE: |
Source code in autogen/agentchat/agent.py
a_receive async
#
(Async) Receive a message from another agent.
PARAMETER | DESCRIPTION |
---|---|
message | the message received. If a dict, it should be a JSON-serializable and follows the OpenAI's ChatCompletion schema. |
sender | the sender of the message. TYPE: |
request_reply | whether the sender requests a reply. TYPE: |
Source code in autogen/agentchat/agent.py
generate_reply #
Generate a reply based on the received messages.
PARAMETER | 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. |
sender | sender of an Agent instance. |
**kwargs | Additional keyword arguments. TYPE: |
RETURNS | DESCRIPTION |
---|---|
Union[str, dict[str, Any], None] | str or dict or None: the generated reply. If None, no reply is generated. |
Source code in autogen/agentchat/agent.py
a_generate_reply async
#
(Async) Generate a reply based on the received messages.
PARAMETER | 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. |
sender | sender of an Agent instance. |
**kwargs | Additional keyword arguments. TYPE: |
RETURNS | DESCRIPTION |
---|---|
Union[str, dict[str, Any], None] | str or dict or None: the generated reply. If None, no reply is generated. |