-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Description
Describe the Bug:
beautifulsoup4 is required by the built-in load_web_page tool However it's not listed as a requirement of google-adk package. Therefore it's not installed and using the load_wweb_page tool causes a ModuleNotFound exception
Steps to Reproduce:
Please provide a numbered list of steps to reproduce the behavior:
- Install standard google-adk
- Create an agent using the load_web_page tool
- Run. See below for repro code
Expected Behavior:
Agent should run and execute tool
Observed Behavior:
ModuleNotFoundError
lib/python3.12/site-packages/google/adk/tools/load_web_page.py", line 31, in load_web_page
| from bs4 import BeautifulSoup
| ModuleNotFoundError: No module named 'bs4'
Environment Details:
- ADK Library Version (pip show google-adk): 1.27.1
- Desktop OS:** Mac Sequoia 15.7.4
- Python Version (python -V): 3.12.9
Model Information:
- Are you using LiteLLM: YNo
- Which model is being used: gemini-2.5-flash
🟡 Optional Information
Providing this information greatly speeds up the resolution process.
Regression:
Did this work in a previous version of ADK? If so, which one? N/A
Logs:
Please attach relevant logs. Wrap them in code blocks (```) or attach a
text file.
[logging_plugin] Tool Name: load_web_page
[logging_plugin] Agent: downloader_<redacted>
[logging_plugin] Function Call ID: adk-57876c25-6260-421b-be7b-340462270142
[logging_plugin] Arguments: {'url': 'https://www.<redacted>/investor-centre'}
[logging_plugin] Error: No module named 'bs4'
+ Exception Group Traceback (most recent call last):
| File "/Users/<redacted>/Code/<redacted>/sandbox/agents/google-adk/download/agent.py", line 97, in <module>
| asyncio.run(main())
| File "/Users/<redacted>/.pyenv/versions/3.12.9/lib/python3.12/asyncio/runners.py", line 195, in run
| return runner.run(main)
| ^^^^^^^^^^^^^^^^
| File "/Users/<redacted>/.pyenv/versions/3.12.9/lib/python3.12/asyncio/runners.py", line 118, in run
| return self._loop.run_until_complete(task)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Users/<redacted>/.pyenv/versions/3.12.9/lib/python3.12/asyncio/base_events.py", line 691, in run_until_complete
| return future.result()
| ^^^^^^^^^^^^^^^
| File "/Users/<redacted>/Code/<redacted>/sandbox/agents/google-adk/download/agent.py", line 88, in main
| async for event in runner.run_async(
| File "/Users/<redacted>/Code/<redacted>/sandbox/.venv/lib/python3.12/site-packages/google/adk/runners.py", line 632, in run_async
| async for event in agen:
| File "/Users/<redacted>/Code/<redacted>/sandbox/.venv/lib/python3.12/site-packages/google/adk/runners.py", line 617, in _run_with_trace
| async for event in agen:
| File "/Users/<redacted>/Code/<redacted>/sandbox/.venv/lib/python3.12/site-packages/google/adk/runners.py", line 853, in _exec_with_plugin
| async for event in agen:
| File "/Users/<redacted>/Code/<redacted>/sandbox/.venv/lib/python3.12/site-packages/google/adk/runners.py", line 606, in execute
| async for event in agen:
| File "/Users/<redacted>/Code/<redacted>/sandbox/.venv/lib/python3.12/site-packages/google/adk/agents/base_agent.py", line 297, in run_async
| async for event in agen:
| File "/Users/<redacted>/Code/<redacted>/sandbox/.venv/lib/python3.12/site-packages/google/adk/agents/parallel_agent.py", line 192, in _run_async_impl
| async for event in agen:
| File "/Users/<redacted>/Code/<redacted>/sandbox/.venv/lib/python3.12/site-packages/google/adk/agents/parallel_agent.py", line 71, in _merge_agent_run
| async with asyncio.TaskGroup() as tg:
| ^^^^^^^^^^^^^^^^^^^
| File "/Users/<redacted>/.pyenv/versions/3.12.9/lib/python3.12/asyncio/taskgroups.py", line 71, in __aexit__
| return await self._aexit(et, exc)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Users/<redacted>/.pyenv/versions/3.12.9/lib/python3.12/asyncio/taskgroups.py", line 164, in _aexit
| raise BaseExceptionGroup(
| ExceptionGroup: unhandled errors in a TaskGroup (1 sub-exception)
+-+---------------- 1 ----------------
| Traceback (most recent call last):
| File "/Users/<redacted>/Code/<redacted>/sandbox/.venv/lib/python3.12/site-packages/google/adk/agents/parallel_agent.py", line 62, in process_an_agent
| async for event in events_for_one_agent:
| File "/Users/<redacted>/Code/<redacted>/sandbox/.venv/lib/python3.12/site-packages/google/adk/agents/base_agent.py", line 297, in run_async
| async for event in agen:
| File "/Users/<redacted>/Code/<redacted>/sandbox/.venv/lib/python3.12/site-packages/google/adk/agents/llm_agent.py", line 479, in _run_async_impl
| async for event in agen:
| File "/Users/<redacted>/Code/<redacted>/sandbox/.venv/lib/python3.12/site-packages/google/adk/flows/llm_flows/base_llm_flow.py", line 758, in run_async
| async for event in agen:
| File "/Users/<redacted>/Code/<redacted>/sandbox/.venv/lib/python3.12/site-packages/google/adk/flows/llm_flows/base_llm_flow.py", line 845, in _run_one_step_async
| async for event in agen:
| File "/Users/<redacted>/Code/<redacted>/sandbox/.venv/lib/python3.12/site-packages/google/adk/flows/llm_flows/base_llm_flow.py", line 938, in _postprocess_async
| async for event in agen:
| File "/Users/<redacted>/Code/<redacted>/sandbox/.venv/lib/python3.12/site-packages/google/adk/flows/llm_flows/base_llm_flow.py", line 1056, in _postprocess_handle_function_calls_async
| if function_response_event := await functions.handle_function_calls_async(
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Users/<redacted>/Code/<redacted>/sandbox/.venv/lib/python3.12/site-packages/google/adk/flows/llm_flows/functions.py", line 358, in handle_function_calls_async
| return await handle_function_call_list_async(
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Users/<redacted>/Code/<redacted>/sandbox/.venv/lib/python3.12/site-packages/google/adk/flows/llm_flows/functions.py", line 404, in handle_function_call_list_async
| function_response_events = await asyncio.gather(*tasks)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Users/<redacted>/Code/<redacted>/sandbox/.venv/lib/python3.12/site-packages/google/adk/flows/llm_flows/functions.py", line 592, in _execute_single_function_call_async
| function_response_event = await _run_with_trace()
| ^^^^^^^^^^^^^^^^^^^^^^^
| File "/Users/<redacted>/Code/<redacted>/sandbox/.venv/lib/python3.12/site-packages/google/adk/flows/llm_flows/functions.py", line 539, in _run_with_trace
| raise tool_error
| File "/Users/<redacted>/Code/<redacted>/sandbox/.venv/lib/python3.12/site-packages/google/adk/flows/llm_flows/functions.py", line 526, in _run_with_trace
| function_response = await __call_tool_async(
| ^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Users/<redacted>/Code/<redacted>/sandbox/.venv/lib/python3.12/site-packages/google/adk/flows/llm_flows/functions.py", line 1111, in __call_tool_async
| return await tool.run_async(args=args, tool_context=tool_context)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Users/<redacted>/Code/<redacted>/sandbox/.venv/lib/python3.12/site-packages/google/adk/tools/function_tool.py", line 221, in run_async
| return await self._invoke_callable(self.func, args_to_call)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Users/<redacted>/Code/<redacted>/sandbox/.venv/lib/python3.12/site-packages/google/adk/tools/function_tool.py", line 238, in _invoke_callable
| return target(**args_to_call)
| ^^^^^^^^^^^^^^^^^^^^^^
| File "/Users/<redacted>/Code/<redacted>/sandbox/.venv/lib/python3.12/site-packages/google/adk/tools/load_web_page.py", line 31, in load_web_page
| from bs4 import BeautifulSoup
| ModuleNotFoundError: No module named 'bs4'
+------------------------------------
Screenshots / Video:
If applicable, add screenshots or screen recordings to help explain
your problem.
Additional Context:
Add any other context about the problem here.
Minimal Reproduction Code:
Please provide a code snippet or a link to a Gist/repo that isolates the issue.
e.g.from google.adk.tools.load_web_page import load_web_page
web_page_loader_tool = FunctionTool(func=load_web_page)
browser_agent = Agent(
name="web_browser_agent",
model=DEFAULT_LLM,
instruction="You are an assistant that can fetch content from web pages using the provided tool and then answer questions about it or summarize it.",
tools=[web_page_loader_tool]
)
How often has this issue occurred?:
- Always (100%)
Workaround is of course to installed bs4 so this is more a "Focus on the user and all else will follow" issue