Feat: Add Agent Engine deployment support#335
Conversation
- Registered double commands 'agent_engine' and 'reasoning_engine' in ADK CLI - Implemented deployToAgentEngine build and Vertex AI reasoning engine registration pipelines - Added exhaustive unit tests to cover 100% of implementation with mocks
| .option( | ||
| '--project [string]', | ||
| 'Optional. Google Cloud project to deploy the agent. If not set, default project from gcloud config is used', | ||
| ) | ||
| .option( | ||
| '--region [string]', | ||
| 'Optional. Google Cloud region to deploy the agent. If not set, default run/region from gcloud config is used', | ||
| ) | ||
| .option( | ||
| '--display_name [string]', | ||
| 'Optional. The display name for the Reasoning Engine. Defaults to agent directory name.', | ||
| ) | ||
| .option( | ||
| '--description [string]', | ||
| 'Optional. The description for the Reasoning Engine.', | ||
| ) | ||
| .option( | ||
| '--temp_folder [string]', | ||
| 'Optional. Temp folder for the generated source files (default: a timestamped folder in the system temp directory).', | ||
| getTempDir('agent_engine_deploy_src'), | ||
| ) | ||
| .option( | ||
| '--adk_version [string]', | ||
| 'Optional. ADK version to use. If not set, default to the latest version available on npm', | ||
| 'latest', | ||
| ) | ||
| .option( | ||
| '--with_ui [boolean]', | ||
| 'Optional. Deploy ADK Web UI if set. (default: deploy ADK API server only)', | ||
| false, | ||
| ) |
There was a problem hiding this comment.
Those are a duplicated options across several cli commands definitions, consider moving as a const and just reuse it everywhere
There was a problem hiding this comment.
I've refactored the option definitions for --project, --region, --adk_version, --with_ui, --display_name, and --description into reusable constants at the file level. Cloud_run, agent_engine, and reasoning_engine all use them now.
There was a problem hiding this comment.
Please create new folder deploy and move this file there file as well as well as existing cli_deploy.ts. Rename cli_deploy.ts to cli_deploy_cloud_run.ts. Move common parts to deploy_utils.ts file and reuse them in this file and cli_deploy_cloud_run.ts.
Thanks
There was a problem hiding this comment.
Refactored the deployment structure:
- Created a new nested dev/src/cli/deploy folder.
- Moved agent engine deployment to it's own file and renamed cli_deploy.ts to cli_deploy_cloud_run.ts
- Put common log into deploy_utils.ts file
- updated tests accordingly
- Moved Cloud Run and Agent Engine deployment pipelines into a nested deploy/ folder - Extracted shared CLI compilation, workspace copying, package validation, and gcloud configuration tasks into deploy_utils.ts - Deduped CLI options (project, region, display name, description, adk version, with ui) as reusable constants inside cli.ts - Renamed and updated corresponding unit test modules under dev/test/cli
… resolve styling violation
Please ensure you have read the contribution guide before creating a pull request.
Link to Issue or Description of Change
Add support for deployment on Agent Engine #85
Closes: #85
Problem:
The ADK CLI for JavaScript/TypeScript (
adk-js) only supports deploying agents to Google Cloud Run. There is no native CLI support to deploy agents directly to the Vertex AI Agent Engine (Reasoning Engine), which is a managed runtime supporting persistent session services (VertexAiSessionService) and native enterprise integrations.Solution:
Implemented a new deployment subcommand
agent_engine(and its aliasreasoning_engine) under the CLIdeploynamespace. This command automates containerization and registration into Vertex AI Agent Engine by performing the following steps:client.agentEnginesInternal.createInternal) to register the agent as aReasoningEnginepointing to the uploaded image.Testing Plan
Unit tests have been introduced to cover container packaging, Cloud Build submission, operation polling, default project/region resolution, package.json verification, and timeout/failure scenarios.
Unit Tests:
npx vitest run dev/test/cli/cli_deploy_agent_engine_test.tsChecklist