Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MultiModelWebSurfer fails with default sample #5387

Open
Neeraj-Sr opened this issue Feb 5, 2025 · 2 comments
Open

MultiModelWebSurfer fails with default sample #5387

Neeraj-Sr opened this issue Feb 5, 2025 · 2 comments

Comments

@Neeraj-Sr
Copy link

What happened?

I trying to run this code provided as sample here https://github.com/microsoft/autogen/tree/main/python/packages/autogen-magentic-one .
However the execution fails with the following error.

---------- MagenticOneOrchestrator ----------
Please attempt to access a reputable weather website, such as Weather.com, AccuWeather, or the Bureau of Meteorology (bom.gov.au), to find the UV index in Melbourne today. Provide a summary if successful.
---------- WebSurfer ----------
Web surfing error:

Traceback (most recent call last):
File "c:\Users\neerajsr\Projects\Agents.venv\Lib\site-packages\autogen_ext\agents\web_surfer_multimodal_web_surfer.py", line 408, in on_messages_stream
content = await self._generate_reply(cancellation_token=cancellation_token)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\Users\neerajsr\Projects\Agents.venv\Lib\site-packages\autogen_ext\agents\web_surfer_multimodal_web_surfer.py", line 435, in _generate_reply
await self._lazy_init()
File "c:\Users\neerajsr\Projects\Agents.venv\Lib\site-packages\autogen_ext\agents\web_surfer_multimodal_web_surfer.py", line 285, in _lazy_init
self._playwright = await async_playwright().start()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\Users\neerajsr\Projects\Agents.venv\Lib\site-packages\playwright\async_api_context_manager.py", line 51, in start
return await self.aenter()
^^^^^^^^^^^^^^^^^^^^^^^
File "c:\Users\neerajsr\Projects\Agents.venv\Lib\site-packages\playwright\async_api_context_manager.py", line 46, in aenter
playwright = AsyncPlaywright(next(iter(done)).result())
^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.2544.0_x64__qbz5n2kfra8p0\Lib\asyncio\futures.py", line 203, in result
raise self._exception.with_traceback(self._exception_tb)
File "c:\Users\neerajsr\Projects\Agents.venv\Lib\site-packages\playwright_impl_transport.py", line 120, in connect
self._proc = await asyncio.create_subprocess_exec(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.2544.0_x64__qbz5n2kfra8p0\Lib\asyncio\subprocess.py", line 223, in create_subprocess_exec
transport, protocol = await loop.subprocess_exec(
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.2544.0_x64__qbz5n2kfra8p0\Lib\asyncio\base_events.py", line 1708, in subprocess_exec
transport = await self._make_subprocess_transport(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.2544.0_x64__qbz5n2kfra8p0\Lib\asyncio\base_events.py", line 503, in _make_subprocess_transport
raise NotImplementedError
NotImplementedError

What did you expect to happen?

Expect the code to return response.

How can we reproduce it (as minimally and precisely as possible)?

You can reproduce this on Windows machine with python 3.11.9

AutoGen version

autogen-agentchat==0.4.5 autogen-core==0.4.5 autogen-ext==0.4.5

Which package was this bug in

Core

Model used

gpt-4o

Python version

3.11.9

Operating system

Windows 11 Enterprise

Any additional info you think would be helpful for fixing this bug

No response

@ekzhu
Copy link
Collaborator

ekzhu commented Feb 6, 2025

Looks like some issue with Playwright using an not implemented asyncio event loop on Windows. cc @afourney, not sure if this is an issue with AutoGen.

@Neeraj-Sr can you confirm you have completed the following steps:

  1. create a virtual environment with python 3.10+
  2. activate virtual environment
  3. Run pip install autogen-agentchat autogen-ext[magentic-one,openai]
  4. Run playwright install --with-deps chromium
  5. Run the following script:
import asyncio
from autogen_ext.models.openai import OpenAIChatCompletionClient
from autogen_agentchat.teams import MagenticOneGroupChat
from autogen_agentchat.ui import Console
from autogen_ext.agents.web_surfer import MultimodalWebSurfer


async def main() -> None:
    model_client = OpenAIChatCompletionClient(model="gpt-4o")

    surfer = MultimodalWebSurfer(
        "WebSurfer",
        model_client=model_client,
    )
    team = MagenticOneGroupChat([surfer], model_client=model_client)
    await Console(team.run_stream(task="What is the UV index in Melbourne today?"))


asyncio.run(main())

@afourney
Copy link
Member

afourney commented Feb 6, 2025

This feels like a Playwright issue. We can ask around to see if anyone has seen this before on Windows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants