-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Description
When deploying an ADK agent to Cloud Run using a pyproject.toml (instead of a requirements.txt), dependency resolution fails to install all indirect dependencies.
In particular, langchain_core is not installed even though it is required by langchain-community, resulting in this runtime error:
ModuleNotFoundError: No module named langchain_core
To Reproduce
Create a minimal ADK project with the following pyproject.toml:
`
[project]
name = "zoo-guide-agent"
version = "0.1.0"
description = "Example of deploying an ADK agent on Cloud Run"
requires-python = ">=3.12"
dependencies = [
"google-adk==1.14.0",
"langchain-community==0.3.27",
"wikipedia==1.4.0"
]
`
Deploy directly to Cloud Run:
# Run the deployment command
uvx --from google-adk \
adk deploy cloud_run \
--project=$PROJECT_ID \
--region=europe-west1 \
--service_name=zoo-tour-guide \
--with_ui \
. \
-- \
--labels=dev-tutorial=codelab-adk \
--service-account=$SERVICE_ACCOUNTError:
ModuleNotFoundError: No module named 'langchain_core'
Expected behavior
Cloud Run should correctly resolve and install all dependencies declared in pyproject.toml, including indirect dependencies like langchain_core, without requiring a requirements.txt file or manual additions.
Additional context
The issue is specific to Cloud Run’s buildpack environment.
It does not occur if a requirements.txt is used instead of pyproject.toml.
Manually pinning langchain-core==0.3.27 or deploying with --no-cache-dir temporarily resolves the issue.
This suggests that ADK or the Cloud Build environment might not fully support dependency resolution from pyproject.toml files yet.