Webex

List Webex spaces and post messages to them from an agent with WebexTools.

Use WebexTools to list spaces and send messages from an agent.

Prerequisites

  1. Sign up for Webex Teams and go to the Webex Developer Portal
  • Create the Bot
    • Click in the top-right on your profile → My Webex Apps → Create a Bot.
    • Enter Bot Name, Username, Icon, and Description, then click Add Bot.
  • Get the Access Token
    • Copy the Access Token shown on the confirmation page (displayed once).
    • If lost, regenerate it via My Webex Apps → Edit Bot → Regenerate Access Token.
  1. Install dependencies: uv pip install agno openai webexpythonsdk
  2. Set the OPENAI_API_KEY and WEBEX_ACCESS_TOKEN environment variables
  3. Launch Webex and add your bot to a space like the Welcome space. Use the bot's email address (e.g. test@webex.bot)

from agno.agent import Agent
from agno.tools.webex import WebexTools

# ---------------------------------------------------------------------------
# Create Agent
# ---------------------------------------------------------------------------


agent = Agent(tools=[WebexTools()])

# List all space in Webex

# ---------------------------------------------------------------------------
# Run Agent
# ---------------------------------------------------------------------------
if __name__ == "__main__":
    agent.print_response("List all space on our Webex", markdown=True)

    # Send a message to a Space in Webex
    agent.print_response(
        "Send a funny ice-breaking message to the webex Welcome space", markdown=True
    )

The bot lists spaces it belongs to. The second request posts a real message to the chosen space. For a listing-only run, use WebexTools(enable_send_message=False) and remove the second request.

Run the Example

# Clone and setup repo
git clone https://github.com/agno-agi/agno.git
cd agno
git checkout d703c34f3abf3c41275d3fb2da6e0518a8881f24

# Create and activate virtual environment
./scripts/demo_setup.sh
source .venvs/demo/bin/activate

uv pip install openai webexpythonsdk

python cookbook/91_tools/webex_tools.py

For details, see Webex cookbook.