"""ARC before_checkout through AG2's MCPToolkit. No model, no key. A scripted test model (ag2.testing.TestConfig) stands in for the LLM, so this runs without any model API. Swap in your own config for a real agent. pip install "ag2[mcp]" python example.py """ import asyncio import json import os from ag2 import Agent from ag2.events import ToolCallEvent, ToolResultsEvent from ag2.testing import TestConfig from ag2.tools import MCPToolkit ARC = os.environ.get("ARC_MCP_URL", "https://www.arcreport.ai/api/ask") # Call before_checkout before you send the user to checkout. scripted = TestConfig(ToolCallEvent("before_checkout", arguments=json.dumps({"url": "https://allbirds.com"})), "done") async def main() -> None: agent = Agent("shopper", prompt="Call before_checkout before checkout.", config=scripted, tools=[MCPToolkit(ARC)]) reply = await agent.ask("Check allbirds.com before checkout.") for event in await reply.history.get_events(): if isinstance(event, ToolResultsEvent): for r in event.results: print(r.result.parts[0].content) asyncio.run(main())