You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
swarms/examples/aop_examples/README.md

3.6 KiB

AOP Examples

This directory contains runnable examples that demonstrate AOP (Agents over Protocol) patterns in Swarms: spinning up a simple MCP server, discovering available agents/tools, and invoking agent tools from client scripts.

Whats inside

Prerequisites

  • Python environment with project dependencies installed.
  • An MCP server running locally (you can use the provided server example).

Quick start

  1. Start a local MCP server (in a separate terminal):
python examples/aop_examples/server/server.py
  1. Try discovery utilities (adjust the URL if your server uses a different port):
# List exposed tools (defaults to http://0.0.0.0:8000/mcp)
python examples/aop_examples/get_all_agents.py

# Fetch tools and call the first agent-like tool (defaults to http://localhost:8000/mcp)
python examples/aop_examples/list_agents_and_call_them.py

# Rich demo of agent info utilities (expects http://localhost:5932/mcp by default)
python examples/aop_examples/example_new_agent_tools.py
  1. Explore client variants:
python examples/aop_examples/client/aop_cluster_example.py
python examples/aop_examples/client/aop_queue_example.py
python examples/aop_examples/client/aop_raw_task_example.py
python examples/aop_examples/client/aop_raw_client_code.py

Tips

  • Server URL/port: Several examples assume http://localhost:8000/mcp or http://localhost:5932/mcp. If your server runs elsewhere, update the server_path/URL variables at the top of the scripts.
  • Troubleshooting: If a script reports “No tools available”, ensure the MCP server is running and that the endpoint path (/mcp) and port match the script.
  • Next steps: Use these scripts as templates—swap in your own tools/agents, change the search queries, or extend the client calls to fit your workflow.