Add real-time local restaurant data to any AutoGen agent. mcp_server_tools fetches all four Loop tools automatically — no manual tool definitions. Works with single agents and multi-agent teams via RoundRobinGroupChat. No API key required on the free tier.
Three packages required. The mcp extra adds StreamableHttpServerParams and mcp_server_tools; the openai extra adds OpenAIChatCompletionClient.
pip install -U "autogen-agentchat" "autogen-ext[mcp,openai]"
mcp_server_toolsCall mcp_server_tools(server_params) once and pass the returned list to AssistantAgent(tools=...). AutoGen discovers all four Loop tools — search, get_details, verify, and report — from the MCP server automatically.
import asyncio from autogen_agentchat.agents import AssistantAgent from autogen_agentchat.ui import Console from autogen_core import CancellationToken from autogen_ext.models.openai import OpenAIChatCompletionClient from autogen_ext.tools.mcp import StreamableHttpServerParams, mcp_server_tools async def main() -> None: server_params = StreamableHttpServerParams( url="https://stayinloop.dev/mcp" ) # Fetches all 4 Loop tools: search, get_details, verify, report tools = await mcp_server_tools(server_params) model_client = OpenAIChatCompletionClient(model="gpt-4o") agent = AssistantAgent( name="local_business_agent", model_client=model_client, tools=tools, system_message=( "You help users find and verify real local restaurants. " "Always call verify() before recommending a place." ), ) await Console( agent.run_stream( task="Find a vegan restaurant with outdoor seating in Kreuzberg, Berlin.", cancellation_token=CancellationToken(), ) ) asyncio.run(main())
RoundRobinGroupChatFetch tools once, share them across multiple agents, and assemble a team with RoundRobinGroupChat. A finder agent calls search() and get_details(); a verifier agent calls verify() and report(). MaxMessageTermination stops the team after N turns.
import asyncio from autogen_agentchat.agents import AssistantAgent from autogen_agentchat.conditions import MaxMessageTermination from autogen_agentchat.teams import RoundRobinGroupChat from autogen_agentchat.ui import Console from autogen_core import CancellationToken from autogen_ext.models.openai import OpenAIChatCompletionClient from autogen_ext.tools.mcp import StreamableHttpServerParams, mcp_server_tools async def main() -> None: server_params = StreamableHttpServerParams(url="https://stayinloop.dev/mcp") tools = await mcp_server_tools(server_params) model_client = OpenAIChatCompletionClient(model="gpt-4o") # Agent 1: searches for candidates and fetches details finder = AssistantAgent( name="finder", model_client=model_client, tools=tools, system_message=( "Search for restaurants with search() and retrieve full details " "with get_details(). Pass result_id and result_token to the verifier." ), ) # Agent 2: verifies availability and closes the loop verifier = AssistantAgent( name="verifier", model_client=model_client, tools=tools, system_message=( "Verify restaurant availability with verify() and report outcomes " "with report(result_token, outcome). " "Outcome is one of: correct, wrong, booked, closed, other." ), ) team = RoundRobinGroupChat( [finder, verifier], termination_condition=MaxMessageTermination(6), ) await Console( team.run_stream( task="Find and verify a quiet Italian restaurant in Kreuzberg, Berlin.", cancellation_token=CancellationToken(), ) ) asyncio.run(main())
The free tier requires no authentication. For higher-volume projects, apply for an API key and pass it in StreamableHttpServerParams(headers={"Authorization": "Bearer ..."}).
import asyncio from autogen_agentchat.agents import AssistantAgent from autogen_agentchat.ui import Console from autogen_core import CancellationToken from autogen_ext.models.openai import OpenAIChatCompletionClient from autogen_ext.tools.mcp import StreamableHttpServerParams, mcp_server_tools async def main() -> None: # Pass your Loop API key in the Authorization header server_params = StreamableHttpServerParams( url="https://stayinloop.dev/mcp", headers={"Authorization": "Bearer YOUR_API_KEY"}, ) tools = await mcp_server_tools(server_params) model_client = OpenAIChatCompletionClient(model="gpt-4o") agent = AssistantAgent( name="local_business_agent", model_client=model_client, tools=tools, ) await Console( agent.run_stream( task="Find an Italian restaurant in Kreuzberg, Berlin.", cancellation_token=CancellationToken(), ) ) asyncio.run(main())
| Tool | When to call | Key output |
|---|---|---|
search() | User asks for a restaurant | Up to 8 ranked records |
get_details() | User selects a result | Full record + result_token |
verify() | Before committing to a recommendation | Live observation + confidence |
report() | After user acts on result | Mutates record confidence |
Full schema: api.stayinloop.dev/v1/openapi.json
| Symbol | Package | Import |
|---|---|---|
AssistantAgent | autogen-agentchat | from autogen_agentchat.agents import AssistantAgent |
RoundRobinGroupChat | autogen-agentchat | from autogen_agentchat.teams import RoundRobinGroupChat |
MaxMessageTermination | autogen-agentchat | from autogen_agentchat.conditions import MaxMessageTermination |
Console | autogen-agentchat | from autogen_agentchat.ui import Console |
OpenAIChatCompletionClient | autogen-ext[openai] | from autogen_ext.models.openai import OpenAIChatCompletionClient |
StreamableHttpServerParams, mcp_server_tools | autogen-ext[mcp] | from autogen_ext.tools.mcp import StreamableHttpServerParams, mcp_server_tools |
CancellationToken | autogen-core | from autogen_core import CancellationToken |
Create StreamableHttpServerParams(url="https://stayinloop.dev/mcp") and call tools = await mcp_server_tools(server_params). Pass the list to AssistantAgent(tools=tools). All four Loop tools are discovered automatically. Requires pip install "autogen-ext[mcp]".
A list of AutoGen-compatible tool adapters — one per tool exposed by the MCP server. For Loop it returns four adapters: search, get_details, verify, and report. Pass the list directly to tools= on any AssistantAgent.
Fetch tools once, create two AssistantAgents with different system messages (e.g. a finder and a verifier), and wrap them in RoundRobinGroupChat with a MaxMessageTermination condition. Both agents share the same Loop tools list.
No. The free tier accepts unauthenticated connections to https://stayinloop.dev/mcp. For higher-volume projects, apply for a key at stayinloop.dev/#pricing and pass it via StreamableHttpServerParams(headers={"Authorization": "Bearer <key>"}).