import asyncio
import os
from agno.agent import Agent
from agno.tools.mcp import MultiMCPTools
async def run_agent(message: str) -> None:
"""使用给定的消息运行 Airbnb 和 Google Maps 代理。"""
env = {
**os.environ,
"GOOGLE_MAPS_API_KEY": os.getenv("GOOGLE_MAPS_API_KEY"),
}
async with MultiMCPTools(
[
"npx -y @openbnb/mcp-server-airbnb --ignore-robots-txt",
"npx -y @modelcontextprotocol/server-google-maps",
],
env=env,
) as mcp_tools:
agent = Agent(
tools=[mcp_tools],
markdown=True,
show_tool_calls=True,
)
await agent.aprint_response(message, stream=True)
# 示例用法
if __name__ == "__main__":
# Pull request 示例
asyncio.run(
run_agent(
"What listings are available in Cape Town for 2 people for 3 nights from 1 to 4 August 2025?"
)
)