WebexTools 允许智能体与 Cisco Webex 进行交互,从而能够发送消息和列出房间。

前置条件

以下示例需要 webexpythonsdk 库和一个 Webex 访问令牌,可以通过 Webex 开发者门户 获取。

开始使用 Webex:

  1. 创建 Webex Bot:

    • 前往 开发者门户
    • 导航至 My Webex Apps → Create a Bot
    • 填写机器人详情并点击 Add Bot
  2. 获取您的访问令牌:

    • 复制机器人创建后显示的令牌
    • 或通过 My Webex Apps → Edit Bot 重新生成
    • 将其设置为 WEBEX_ACCESS_TOKEN 环境变量
  3. 将机器人添加到 Webex:

    • 启动 Webex 并将机器人添加到某个空间
    • 使用机器人的电子邮件(例如 test@webex.bot
pip install webexpythonsdk
export WEBEX_ACCESS_TOKEN=your_access_token_here

示例

以下智能体将列出所有空间并使用 Webex 发送消息:

cookbook/tools/webex_tool.py
from agno.agent import Agent
from agno.tools.webex import WebexTools

agent = Agent(tools=[WebexTools()], show_tool_calls=True)

# 列出我们 Webex 中的所有空间
agent.print_response("List all space on our Webex", markdown=True)

# 向 Webex 中的一个空间发送消息
agent.print_response(
    "Send a funny ice-breaking message to the webex Welcome space", markdown=True
)

Toolkit 参数

参数类型默认值描述
access_tokenstrNone用于身份验证的 Webex 访问令牌。如果未提供,则使用 WEBEX_ACCESS_TOKEN 环境变量。
send_messageboolTrue启用向 Webex 空间发送消息。
list_roomsboolTrue启用列出 Webex 空间/房间。

Toolkit 函数

函数描述
send_message向 Webex 房间发送消息。参数:目标房间的 room_id (str),消息的 text (str)。
list_rooms列出所有可用的 Webex 房间/空间及其详细信息,包括 ID、标题、类型和可见性设置。

开发者资源