fix(deploy): add --agent_module flag to adk deploy agent_engine#5227
fix(deploy): add --agent_module flag to adk deploy agent_engine#5227RudrenduPaul wants to merge 5 commits intogoogle:mainfrom
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
|
Response from ADK Triaging Agent Hello @RudrenduPaul, thank you for your contribution! It looks like the Contributor License Agreement (CLA) check has failed. Before we can proceed with reviewing this PR, could you please sign the CLA? You can find more information and sign it at https://cla.developers.google.com/. Thanks! |
|
I have read the CLA Document, and I hereby sign the CLA. |
|
I have read the CLA Document and I hereby sign the CLA. |
The generated agent_engine_app.py hardcoded `from .agent import ...`, breaking deployments where the entry point is not named agent.py (e.g. core.py, adk_agent.py). Fixes google#5192. Changes: - Add `agent_module` param to `to_agent_engine()` (default: 'agent') - Add `--agent_module` CLI option to `adk deploy agent_engine` - Pass `agent_module` through to the app template and import validation - Update error message in `_validate_agent_import` to reference the configurable module name and suggest --agent_module on failure Built by Rudrendu Paul, developed with Claude Code
a1a6dee to
d742c9e
Compare
…n type - Add missing agent_module key to test_agent_engine_app_template_compiles_with_windows_paths so the template.format() call includes all required variables - Add -> None return annotation to cli_deploy_agent_engine to satisfy mypy strict [untyped-decorator] check Built by Rudrendu Paul, developed with Claude Code
|
I have read the CLA document and signed it. It's shown as covered in the previous message. |
Fixes #5192
adk deploy agent_engineauto-generatesagent_engine_app.pywith a hardcodedfrom .agent import <object>. This assumes the user's entry point is always namedagent.py. Any other filename (e.g.core.py,adk_agent.py) causes aModuleNotFoundErrorat deployment time — silently, in the container build on Vertex AI, where it is hard to debug.Changes
cli_deploy.py— Addagent_module: Optional[str] = Noneparameter toto_agent_engine(). Defaults to'agent'for backward compatibility. Pass it through to_AGENT_ENGINE_APP_TEMPLATEand_validate_agent_import.cli_deploy.py— Update_validate_agent_importto check{agent_module}.pyinstead of hardcodedagent.py, and improve the error message to reference--agent_module.cli_tools_click.py— Add--agent_moduleCLI option toadk deploy agent_engine. Pass it through toto_agent_engine().Usage
Backward compatibility
Default is
agent, so all existing deployments continue to work without any changes.Testing
Verified the generated
agent_engine_app.pycontainsfrom .core import root_agentwhen--agent_module=coreis passed, andfrom .agent import root_agentwhen the flag is omitted.