docs: Add advanced deployment considerations and lazy initialization pattern for Agent Engine #852
+126
−0
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.
This PR adds documentation for the pickle timing issue when deploying ADK agents to Vertex AI Agent Engine, where environment variables specified in
AdkApp.env_varsare not available during toolset initialisation at import time.Problem
google/adk-python#3208
When deploying agents to Agent Engine, toolsets that read configuration at import time (e.g., using Pydantic
BaseSettings) will use deployment environment values instead of runtime environment values. This causes production agents to fail with incorrect configuration (e.g., connecting to localhost instead of production APIs).Solution Documented
Added comprehensive documentation to
docs/deploy/agent-engine.mdcovering:Changes
Modified Files
docs/deploy/agent-engine.md- Added "Advanced deployment considerations" section (~120 lines)docs/tools/index.md- Added warning callout with link to solutionKey Features
Explains deployment architecture (import time vs runtime)
Provides complete LazyToolsetWrapper pattern implementation
Includes all necessary imports and helper functions
Error handling for missing environment variables
Custom
__reduce__for proper pickle serialisationComplete usage examples for agent definition and deployment
Related
As requested by @surajksharma07 in #3208:
This PR addresses all three points with focused, practical documentation integrated into the existing Agent Engine deployment guide.