Skip to content

Commit cdd2fee

Browse files
committed
docs: Agent Engine deploy: Add Accelerated deployment section
1 parent 7b2c997 commit cdd2fee

File tree

1 file changed

+75
-45
lines changed

1 file changed

+75
-45
lines changed

docs/deploy/agent-engine.md

Lines changed: 75 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ This section describes how to perform a deployment using the
1717
[Agent Starter Pack](https://github.com/GoogleCloudPlatform/agent-starter-pack)
1818
(ASP) and the ADK command line interface (CLI) tool. This approach uses the ASP
1919
tool to apply a project template to your existing project, add deployment
20-
artifacts, and prepare your agent workflow for deployment. These instructions
20+
artifacts, and prepare your agent project for deployment. These instructions
2121
show you how to use ASP to provision a Google Cloud project with services needed
22-
for deploying your ADK workflow, as follows:
22+
for deploying your ADK project, as follows:
2323

2424
- [Prerequisites](#prerequisites-ad): Setup Google Cloud
2525
account, a project, and install required software.
@@ -50,17 +50,17 @@ You need the following resources configured to use this deployment path:
5050
[Creating and managing projects](https://cloud.google.com/resource-manager/docs/creating-managing-projects).
5151
- **Python Environment**: A Python version between 3.9 and 3.13.
5252
- **UV Tool:** Manage Python development environment and running ASP
53-
tools. For installation details, see [Install
54-
UV](https://docs.astral.sh/uv/getting-started/installation/).
53+
tools. For installation details, see
54+
[Install UV](https://docs.astral.sh/uv/getting-started/installation/).
5555
- **Google Cloud CLI tool**: The gcloud command line interface. For
56-
installation details, see [Google Cloud Command Line
57-
Interface](https://cloud.google.com/cli).
56+
installation details, see
57+
[Google Cloud Command Line Interface](https://cloud.google.com/sdk/docs/install).
5858
- **Make tool**: Build automation tool. This tool is part of most
59-
Unix-based systems, for installation details, see the [Make
60-
tool](https://www.gnu.org/software/make/) documentation.
59+
Unix-based systems, for installation details, see the
60+
[Make tool](https://www.gnu.org/software/make/) documentation.
6161
- **Terraform**: Infrastructure and services deployment on Google Cloud.
62-
For installation details, see [Install
63-
Terraform](https://developer.hashicorp.com/terraform/downloads).
62+
For installation details, see
63+
[Install Terraform](https://developer.hashicorp.com/terraform/downloads).
6464

6565
### Prepare your ADK project {#prepare-ad}
6666

@@ -94,15 +94,22 @@ To prepare your ADK project for deployment to Agent Engine:
9494
```
9595

9696
1. Follow the instructions from the ASP tool. In general, you can accept
97-
the default answers to all questions, except for **GCP region**, which you
98-
should choose based on your location.
97+
the default answers to all questions. However for the **GCP region**,
98+
option, make sure you select one of the
99+
[supported regions for Agent Engine](https://cloud.google.com/vertex-ai/generative-ai/docs/agent-engine/overview#supported-regions).
100+
101+
When you successfully complete this process, the tool shows the following message:
102+
103+
```
104+
> Success! Your agent project is ready.
105+
```
99106

100107
!!! tip "Note"
101108
The ASP tool may show a reminder to connect to Google Cloud while
102109
running, but that connection is *not required* at this stage.
103110

104-
For more information about the changes ASP tool makes to your ADK project, see
105-
[Changes to your ADK project](?tab=t.0#heading=h.sgedwpufmtuo).
111+
For more information about the changes ASP makes to your ADK project, see
112+
[Changes to your ADK project](#adk-asp-changes).
106113

107114
### Connect to your Google Cloud project {#connect-ad}
108115

@@ -123,7 +130,7 @@ To connect to Google Cloud and list your project:
123130
1. Set your target project using the Google Cloud Project ID:
124131

125132
```shell
126-
gcloud config set project $(your-project-id-xxxxx)
133+
gcloud config set project your-project-id-xxxxx
127134
```
128135

129136
1. Verify your Google Cloud target project is set:
@@ -133,14 +140,14 @@ To connect to Google Cloud and list your project:
133140
```
134141

135142
Once you have successfully connected to Google Cloud and set your Cloud Project
136-
ID, you are ready to deploy your ADK project files Agent Engine.
143+
ID, you are ready to deploy your ADK project files to Agent Engine.
137144

138145
### Deploy your ADK project {#deploy-ad}
139146

140147
When using the ASP tool, you deploy in stages. In the first stage, you run a
141-
make command that provisions the services needed to run your ADK workflow on
148+
`make` command that provisions the services needed to run your ADK workflow on
142149
Agent Engine. In the second stage, your project code is uploaded to the Agent
143-
Engine service and the agent workflow is executed.
150+
Engine service and the agent project is executed.
144151

145152
!!! warning "Important"
146153
*Make sure your Google Cloud target deployment project is set as your ***current
@@ -154,8 +161,8 @@ To deploy your ADK project to Agent Engine in your Google Cloud project:
154161
1. In a terminal window of your development environment, navigate to the
155162
root directory of your project, for example:
156163
`cd multi_tool_agent/`
157-
1. Provision a development environment by running the following ASP make
158-
command:
164+
1. Provision a development environment, including logging, services accounts,
165+
storage, and Vertex AI API by running the following ASP make command:
159166

160167
```shell
161168
make setup-dev-env
@@ -177,7 +184,7 @@ the agent running on Google Cloud Agent Engine. For details on testing the
177184
deployed agent, see
178185
[Test deployed agent](#test-deployment).
179186

180-
### Changes to your ADK project
187+
### Changes to your ADK project {#adk-asp-changes}
181188

182189
The ASP tools add more files to your project for deployment. The procedure
183190
below backs up your existing project files before modifying them. This guide
@@ -224,12 +231,8 @@ deployment settings, or are modifying an existing deployment with Agent Engine.
224231
### Prerequisites
225232

226233
These instructions assume you have already defined an ADK project. If you do not
227-
have an ADK project, or want to use a test project, complete the Python
228-
[Quickstart](/adk-docs/get-started/quickstart/) guide,
229-
which creates a
230-
[multi_tool_agent](https://github.com/google/adk-docs/tree/main/examples/python/snippets/get-started/multi_tool_agent)
231-
project. The following instructions use the multi_tool_agent project as an
232-
example.
234+
have an ADK project, see the instructions for creating a test project in
235+
[Define your agent](#define-your-agent).
233236

234237
Before starting deployment procedure, ensure you have the following:
235238

@@ -252,7 +255,7 @@ Before starting deployment procedure, ensure you have the following:
252255
pip install google-cloud-aiplatform[adk,agent_engines]>=1.111
253256
```
254257

255-
### Define your agent
258+
### Define your agent {#define-your-agent}
256259

257260
These instructions assume you have an existing ADK project that you are modifying
258261
for deployment. If you do not have an ADK project, or want to use a test
@@ -276,13 +279,13 @@ from agent import root_agent # modify this if your agent is not in agent.py
276279
277280
# TODO: Fill in these values for your project
278281
PROJECT_ID = "your-gcp-project-id"
279-
LOCATION_ID = "us-central1" # For other options, see https://cloud.google.com/vertex-ai/generative-ai/docs/agent-engine/overview#supported-regions
282+
LOCATION = "us-central1" # For other options, see https://cloud.google.com/vertex-ai/generative-ai/docs/agent-engine/overview#supported-regions
280283
STAGING_BUCKET = "gs://your-gcs-bucket-name"
281284
282285
# Initialize the Vertex AI SDK
283286
vertexai.init(
284287
project=PROJECT_ID,
285-
location=LOCATION_ID,
288+
location=LOCATION,
286289
staging_bucket=STAGING_BUCKET,
287290
)
288291
```
@@ -412,7 +415,7 @@ This process packages your code, builds it into a container, and deploys it to t
412415
413416
print(f"Deployment finished!")
414417
print(f"Resource Name: {remote_app.resource_name}")
415-
# Resource Name: "projects/{PROJECT_NUMBER}/locations/{LOCATION_ID}/reasoningEngines/{RESOURCE_ID}"
418+
# Resource Name: "projects/{PROJECT_NUMBER}/locations/{LOCATION}/reasoningEngines/{RESOURCE_ID}"
416419
# Note: The PROJECT_NUMBER is different than the PROJECT_ID.
417420
```
418421
@@ -439,6 +442,41 @@ target project selected in Google Cloud Console. For more information on
439442
selecting an exising Google Cloud project, see
440443
[Creating and managing projects](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects).
441444
445+
### Find Google Cloud project information
446+
447+
You need the address and resource identification for your project (`PROJECT_ID`,
448+
`LOCATION`, `RESOURCE_ID`) to be able to test your deployment. You can use Cloud
449+
Console or the `gcloud` command line tool to find this information.
450+
451+
To find your project information with Google Cloud Console:
452+
453+
1. In the Google Cloud Console, navigate to the Agent Engine page:
454+
[https://console.cloud.google.com/vertex-ai/agents/agent-engines](https://console.cloud.google.com/vertex-ai/agents/agent-engines)
455+
456+
1. At the top of the page, select **API URLs**, and then copy the **Query
457+
URL** string for your deployed agent, which should be in this format:
458+
459+
https://$(LOCATION_ID)-aiplatform.googleapis.com/v1/projects/$(PROJECT_ID)/locations/$(LOCATION_ID)/reasoningEngines/$(RESOURCE_ID):query
460+
461+
To find your project information with `gloud`:
462+
463+
1. In your development environment, make sure you are authenticated to
464+
Google Cloud and run the following command to list your project:
465+
466+
```shell
467+
gcloud projects list
468+
```
469+
470+
1. Take the Project ID used for deployment and run this command to get
471+
the additional details:
472+
473+
```shell
474+
gcloud asset search-all-resources \
475+
--scope=projects/$(PROJECT_ID) \
476+
--asset-types='aiplatform.googleapis.com/ReasoningEngine' \
477+
--format="table(name,assetType,location,reasoning_engine_id)"
478+
```
479+
442480
### Test using REST calls
443481
444482
A simple way to interact with your deployed agent in Agent Engine is to use REST
@@ -454,21 +492,13 @@ execute the deployed agent, but returns information about the agent.
454492
455493
To send a REST call get a response from deployed agent:
456494
457-
1. Navigate to the Agent Engine page in the Google Cloud Console:
458-
[https://console.cloud.google.com/vertex-ai/agents/agent-engines](https://console.cloud.google.com/vertex-ai/agents/agent-engines)
459-
460-
1. At the top of the page, select **API URLs**, and then copy the **Query
461-
URL** string for your deployed agent, which should be in this format:
462-
463-
https://$(LOCATION_ID)-aiplatform.googleapis.com/v1/projects/$(PROJECT_ID)/locations/$(LOCATION_ID)/reasoningEngines/$(RESOURCE_ID):query
464-
465-
1. In a terminal window of your development environment, build a request
495+
- In a terminal window of your development environment, build a request
466496
and execute it:
467497
468498
```shell
469499
curl -X GET \
470500
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
471-
"https://$(LOCATION_ID)-aiplatform.googleapis.com/v1/projects/$(PROJECT_ID)/locations/$(LOCATION_ID)/reasoningEngines"
501+
"https://$(LOCATION)-aiplatform.googleapis.com/v1/projects/$(PROJECT_ID)/locations/$(LOCATION)/reasoningEngines"
472502
```
473503
474504
If your deployment was successful, this request responds with a list of valid
@@ -481,7 +511,7 @@ requests and expected data formats.
481511
482512
#### Send an agent request
483513
484-
When getting responses from your agent workflow, you must first create a
514+
When getting responses from your agent project, you must first create a
485515
session, receive a Session ID, and then send your requests using that Session
486516
ID. This process is described in the following instructions.
487517
@@ -494,7 +524,7 @@ To test interaction with the deployed agent via REST:
494524
curl \
495525
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
496526
-H "Content-Type: application/json" \
497-
https://$(LOCATION_ID)-aiplatform.googleapis.com/v1/projects/$(PROJECT_ID)/locations/$(LOCATION_ID)/reasoningEngines/$(RESOURCE_ID):query \
527+
https://$(LOCATION)-aiplatform.googleapis.com/v1/projects/$(PROJECT_ID)/locations/$(LOCATION)/reasoningEngines/$(RESOURCE_ID):query \
498528
-d '{"class_method": "async_create_session", "input": {"user_id": "u_123"},}'
499529
```
500530
@@ -522,7 +552,7 @@ To test interaction with the deployed agent via REST:
522552
curl \
523553
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
524554
-H "Content-Type: application/json" \
525-
https://$(LOCATION_ID)-aiplatform.googleapis.com/v1/projects/$(PROJECT_ID)/locations/$(LOCATION_ID)/reasoningEngines/$(RESOURCE_ID):streamQuery?alt=sse -d '{
555+
https://$(LOCATION)-aiplatform.googleapis.com/v1/projects/$(PROJECT_ID)/locations/$(LOCATION)/reasoningEngines/$(RESOURCE_ID):streamQuery?alt=sse -d '{
526556
"class_method": "async_stream_query",
527557
"input": {
528558
"user_id": "u_123",
@@ -630,7 +660,7 @@ async for event in remote_app.async_stream_query(
630660
631661
## Deployment payload {#payload}
632662
633-
When you deploy your ADK agent workflow to Agent Engine,
663+
When you deploy your ADK agent project to Agent Engine,
634664
the following content is uploaded to the service:
635665
636666
- Your ADK agent code

0 commit comments

Comments
 (0)