Fix MCP example in readme (#6919)

This commit is contained in:
Eric Zhu
2025-08-11 11:21:53 -04:00
committed by GitHub
parent 6874ff7091
commit e0d6cc80a9

View File

@@ -59,8 +59,6 @@ Create a web browsing assistant agent that uses the Playwright MCP server.
# First run `npm install -g @playwright/mcp@latest` to install the MCP server.
import asyncio
from autogen_agentchat.agents import AssistantAgent
from autogen_agentchat.teams import RoundRobinGroupChat
from autogen_agentchat.conditions import TextMessageTermination
from autogen_agentchat.ui import Console
from autogen_ext.models.openai import OpenAIChatCompletionClient
from autogen_ext.tools.mcp import McpWorkbench, StdioServerParams
@@ -83,11 +81,7 @@ async def main() -> None:
model_client_stream=True,
max_tool_iterations=10,
)
team = RoundRobinGroupChat(
[agent],
termination_condition=TextMessageTermination(source="web_browsing_assistant"),
)
await Console(team.run_stream(task="Find out how many contributors for the microsoft/autogen repository"))
await Console(agent.run_stream(task="Find out how many contributors for the microsoft/autogen repository"))
asyncio.run(main())