You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fromautogen_agentchat.agentsimportAssistantAgentfromautogen_agentchat.messagesimportTextMessagefromautogen_ext.models.openaiimportOpenAIChatCompletionClientfromautogen_ext.tools.mcpimportMcpWorkbench, StdioServerParams# Get the fetch tool from mcp-server-fetch.fetch_mcp_server=StdioServerParams(command="uvx", args=["mcp-server-fetch"])
# Create an MCP workbench which provides a session to the mcp server.asyncwithMcpWorkbench(fetch_mcp_server) asworkbench: # type: ignore# Create an agent that can use the fetch tool.model_client=OpenAIChatCompletionClient(model="gpt-4.1-nano")
fetch_agent=AssistantAgent(
name="fetcher", model_client=model_client, workbench=workbench, reflect_on_tool_use=True
)
# Let the agent fetch the content of a URL and summarize it.result=awaitfetch_agent.run(task="Summarize the content of https://en.wikipedia.org/wiki/Seattle")
assertisinstance(result.messages[-1], TextMessage)
print(result.messages[-1].content)
# Close the connection to the model client.awaitmodel_client.close()
The cell goes in a never ending loop in Jupyter Notebook. It being tested on a Windows Machine. UV is installed globally as well as in the python virtual environment. Running the uvx mcp-server-fetch command works - i.e. the server starts but there is (I believe as expected) no logs.
I think, it's same as this issue #5069
Yes, It from asyncio is not implement _make_subprocess_transport at windows.
When you take a look without jupyter notebook you can see it will be run.
fromautogen_agentchat.agentsimportAssistantAgentfromautogen_agentchat.messagesimportTextMessagefromautogen_ext.models.openaiimportOpenAIChatCompletionClientfromautogen_ext.tools.mcpimportMcpWorkbench, StdioServerParamsfromautogen_agentchat.uiimportConsoleimportasyncioasyncdeftest():
# Get the fetch tool from mcp-server-fetch.fetch_mcp_server=StdioServerParams(command="uvx", args=["mcp-server-fetch"])
# Create an MCP workbench which provides a session to the mcp server.# async with McpWorkbench(fetch_mcp_server) as workbench: # type: ignoreworkbench=McpWorkbench(fetch_mcp_server)
print("hello1")
awaitworkbench.start()
print("hello2")
# Create an agent that can use the fetch tool.print(awaitworkbench.list_tools())
model_client=OpenAIChatCompletionClient(model="gpt-4.1-nano", )
fetch_agent=AssistantAgent(
name="fetcher", model_client=model_client, workbench=workbench, reflect_on_tool_use=True
)
# Let the agent fetch the content of a URL and summarize it.# result = await fetch_agent.run(task="Summarize the content of https://en.wikipedia.org/wiki/Seattle")# assert isinstance(result.messages[-1], TextMessage)# print(result.messages[-1].content)awaitConsole(fetch_agent.run_stream(task="Summarize the content of https://en.wikipedia.org/wiki/Seattle"))
# Close the connection to the model client.awaitmodel_client.close()
asyncio.run(test())
Uh oh!
There was an error while loading. Please reload this page.
What happened?
Describe the bug
When running this example:
The cell goes in a never ending loop in Jupyter Notebook. It being tested on a Windows Machine. UV is installed globally as well as in the python virtual environment. Running the
uvx mcp-server-fetch
command works - i.e. the server starts but there is (I believe as expected) no logs.What I've also tried
I tried replacing the command as such:
command=r"C:\Users\...\AppData\Local\Microsoft\WinGet\Packages\astral-sh.uv_Microsoft.Winget.Source_8wekyb3d8bbwe\uvx.exe"
Which packages was the bug in?
Python AgentChat (autogen-agentchat>=0.4.0), Python Extensions (autogen-ext)
AutoGen library version.
Python 0.5.7
Other library version.
No response
Model used
gpt-4.1
Model provider
Azure OpenAI
Other model provider
No response
Python version
3.13
.NET version
None
Operating system
Windows
The text was updated successfully, but these errors were encountered: