GoogleCloudPlatform / GoogleCloudPlatform/agentsmithy
fix: ContextBasedToolset missing BaseToolset init and undeclared subagent dependencies
- Dominant language
- Python
- Stars
- 121
- Forks
- 28
- PR merge metrics
- No merged PRs in 30d
Description
### Description
When deploying or running agents locally and on Cloud Run, two runtime issues occur:
1. **Uninitialized `BaseToolset`:**
`ContextBasedToolset` in `agent_bar_v2/tools/context_based_toolset.py` overrides `__init__` without calling `super().__init__()`, causing base toolset lifecycle and internal state initialization in Google ADK to be bypassed.
2. **Missing Runtime Dependencies:**
Several subagents and the Cloud Run entrypoint directly import packages that are missing from root `pyproject.toml`, resulting in `ModuleNotFoundError` during container startup and tool execution:
- `google-api-python-client` & `google-auth-oauthlib`: used by Drive Agent tools (`agent_bar_v2/subagents/cross_industry/drive_agent/tools.py`).
- `langchain-community` & `langchain-core`: used by Knowledge Graph Builder tools (`agent_bar_v2/subagents/cross_industry/knowledge_graph_builder/tools.py`).
- `python-dotenv`: used across multiple subagent configurations and `agent_engine_app.py`.
- `pyyaml`: used by Patient Handover and SQL translation tools.
- `sqlparse`: used by Knowledge Graph Builder.
- `aiosqlite`: required by `google.adk.cli.fast_api.get_fast_api_app` session service backend (`sqlite+aiosqlite:///./sessions.db` in `deployment/cloud_run/main.py`).
- `pydantic`: directly imported across multiple tools and typing utilities.
### Proposed Solution
- Add `super().__init__()` call in `ContextBasedToolset.__init__`.
- Declare the missing direct runtime dependencies in `pyproject.toml`.
Contributor guide
Research direction
Start with agent_bar_v2/tools/context_based_toolset.py and deployment/cloud_run/main.py, then inspect the listed Drive Agent, Knowledge Graph Builder, Patient Handover, and SQL translation imports. Update pyproject.toml for the missing runtime dependencies and verify that tool execution and Cloud Run startup no longer fail with initialization or ModuleNotFoundError errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- google-cloud, python
- Domain
- backend, build-system, cloud
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 74/100