From c05ba005f61a75d1ca3d9bfd41485e1798c73bee Mon Sep 17 00:00:00 2001 From: Samuel ROZE Date: Thu, 10 Apr 2025 12:19:23 +0200 Subject: [PATCH] fix: add missing `__all__` in init file Without it the user will see the following error: ``` 2025-04-10 12:13:29,627 - ERROR - fast_api.py:616 - Error in event_generator: module 'multi_tool_agent.agent' has no attribute 'root_agent' Traceback (most recent call last): File "/Users/sroze/git/adk-agent-test/.venv/lib/python3.13/site-packages/google/adk/cli/fast_api.py", line 604, in event_generator runner = _get_runner(req.app_name) File "/Users/sroze/git/adk-agent-test/.venv/lib/python3.13/site-packages/google/adk/cli/fast_api.py", line 756, in _get_runner root_agent = _get_root_agent(app_name) File "/Users/sroze/git/adk-agent-test/.venv/lib/python3.13/site-packages/google/adk/cli/fast_api.py", line 748, in _get_root_agent root_agent: Agent = agent_module.agent.root_agent ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ``` --- docs/get-started/quickstart.md | 2 +- .../python/snippets/get-started/multi_tool_agent/__init__.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/get-started/quickstart.md b/docs/get-started/quickstart.md index 4c7e25a137..70d87d1bfc 100644 --- a/docs/get-started/quickstart.md +++ b/docs/get-started/quickstart.md @@ -53,7 +53,7 @@ mkdir multi_tool_agent/ Now create an `__init__.py` file in the folder: ```shell -echo "from . import agent" > multi_tool_agent/__init__.py +echo "from . import agent\n\n__all__ = [\"agent\"]" > multi_tool_agent/__init__.py ``` Your `__init__.py` should now look like this: diff --git a/examples/python/snippets/get-started/multi_tool_agent/__init__.py b/examples/python/snippets/get-started/multi_tool_agent/__init__.py index 02c597e11e..9659561f05 100644 --- a/examples/python/snippets/get-started/multi_tool_agent/__init__.py +++ b/examples/python/snippets/get-started/multi_tool_agent/__init__.py @@ -1 +1,3 @@ from . import agent + +__all__ = ["agent"]