AgentMessage
init
AgentCommunicationToolkit
- agents (Optional[Dict[str, ChatAgent]]): Dictionary mapping agent IDs to ChatAgent instances. (default: :obj:
None
) - timeout (Optional[float]): Maximum execution time for operations in seconds. (default: :obj:
None
) - max_message_history (int): Maximum messages to keep per agent. (default: :obj:
100
) - get_response (bool): Whether to get responses from receiving agents by default. (default: :obj:
False
)
init
register_agent
- agent_id (str): Unique identifier for the agent.
- agent (ChatAgent): The ChatAgent instance to register.
_find_agent_id
send_message
receiver_id
of the agent you want to communicate with, you
can use the list_available_agents
tool.
Parameters:
- message (str): The content of the message to send.
- receiver_id (str): The unique identifier of the agent to receive the message. Use
list_available_agents()
to find the ID of the agent you want to talk to. - sender_id (str): The unique identifier of the agent sending the message. This is typically your agent’s ID. (default: :obj:
"system"
) - reply_to (Optional[str]): The ID of a previous message this new message is a reply to. This helps create conversation threads. (default: :obj:
None
) - metadata_json (Optional[str]): A JSON string containing extra information about the message. (default: :obj:
None
)
_deliver_message
broadcast_message
exclude_agents
list.
Parameters:
- message (str): The content of the message to broadcast.
- sender_id (str): The unique identifier of the agent sending the message. This is typically your agent’s ID. (default: :obj:
"system"
) - exclude_agents (Optional[List[str]]): A list of agent IDs to exclude from the broadcast. The sender is automatically excluded. (default: :obj:
None
)
get_message_history
agent_id
for another agent, use the
list_available_agents
tool. You can also use this tool to get
your own message history by providing your agent ID.
Parameters:
- agent_id (str): The unique identifier of the agent whose message history you want to retrieve. Use
list_available_agents()
to find available agent IDs. - limit (Optional[int]): The maximum number of recent messages to return. If not specified, it will return all messages up to the system’s limit. (default: :obj:
None
)
get_conversation_thread
send_message
tool.
Parameters:
- message_id (str): The unique identifier of any message within the conversation thread you want to retrieve.
list_available_agents
remove_agent
- agent_id (str): Unique identifier of the agent to remove.