Repository navigation
Conversation
The generated Dockerfile hard-coded `FROM python:3.11-slim`, so an agent
whose dependencies need a newer interpreter could not be deployed with
`adk deploy` at all. Every target now takes `--python_version`:
adk deploy cloud_run --python_version=3.12 path/to/my_agent
`agent_engine` also reads `python_version` from `.agent_engine_config.json`,
the key the Agent Engine SDK already defines. The SDK ignores that key when
the image is built from a Dockerfile, which is how ADK deploys, so the value
was previously a silent no-op; ADK now renders it into the Dockerfile and
drops it from the API request. An explicit flag overrides the file, and the
default stays 3.11 when neither is set.
Values are validated against a strict `3.<minor>[.<patch>]` pattern, 3.11
and up, before being interpolated into the Dockerfile, and the flag is
checked before any agent source is staged.
Fixes google#4784
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Please ensure you have read the contribution guide before creating a pull request.
Link to Issue or Description of Change
1. Link to an existing issue (if applicable):
2. Or, if no issue exists, describe the change:
Problem:
_DOCKERFILE_TEMPLATEhard-codesFROM python:3.11-slim, so agents whose dependencies require Python 3.12+ cannot be deployed withadk deploy(cloud_run,docker,gke, oragent_engine). Additionally, setting"python_version"in.agent_engine_config.json(which the Agent Engine SDK accepts) was previously a silent no-op for ADK deployments because ADK builds from a generatedDockerfile(image_spec = {}), where the SDK ignorespython_version.Solution:
--python_version(default3.11) across all fouradk deploytargets (cloud_run,docker,gke,agent_engine) and renderFROM python:{python_version}-slimin_DOCKERFILE_TEMPLATE.python_versionagainst a strict Python 3.11+ pattern (^3\.(1[1-9]|[2-9][0-9])(\.[0-9]+)?$) before interpolating into theDockerfileand fail fast into_agent_enginebefore staging files."python_version"in.agent_engine_config.jsonforadk deploy agent_engine(popped before callingclient.runtimes.update), with precedence: explicit--python_versionCLI flag >.agent_engine_config.json>'3.11'.Testing Plan
Unit Tests:
Also verified
uv run pre-commit run --files ...anduv run mypyon all touched files (no issues found).Manual End-to-End (E2E) Tests:
Checklist
Additional context
google/adk-docsfor the CLI reference and deployment guides once this lands.