mcp-agent implements OpenAI's Swarm pattern for multi-agent workflows, but in a way that can be used with any model provider.
This example is taken from the Swarm repo, and shown to work with MCP servers and Anthropic models (and can of course also work with OpenAI models).
This example demonstrates a multi-agent setup for handling different customer service requests in an airline context using the Swarm framework. The agents can triage requests, handle flight modifications, cancellations, and lost baggage cases.
https://github.com/user-attachments/assets/b314d75d-7945-4de6-965b-7f21eb14a8bd
1
App set upFirst, clone the repo and navigate to the workflow swarm example:
git clone https://github.com/lastmile-ai/mcp-agent.git
cd mcp-agent/examples/workflows/workflow_swarm
Install uv
(if you don’t have it):
pip install uv
Sync mcp-agent
project dependencies:
uv sync
Install requirements specific to this example:
uv pip install -r requirements.txt
2
Set up environment variablesCopy and configure your secrets and env variables:
cp mcp_agent.secrets.yaml.example mcp_agent.secrets.yaml
Then open mcp_agent.secrets.yaml
and add your api key for your preferred LLM.
3
Run locallyRun your MCP Agent app:
uv run main.py
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。