agent-starter-pack 0.4.0__py3-none-any.whl → 0.4.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {agent_starter_pack-0.4.0.dist-info → agent_starter_pack-0.4.2.dist-info}/METADATA +8 -9
- {agent_starter_pack-0.4.0.dist-info → agent_starter_pack-0.4.2.dist-info}/RECORD +10 -10
- agents/adk_base/notebooks/adk_app_testing.ipynb +99 -67
- agents/agentic_rag/notebooks/adk_app_testing.ipynb +99 -67
- src/base_template/Makefile +2 -2
- src/cli/commands/setup_cicd.py +12 -38
- src/cli/utils/cicd.py +1 -46
- {agent_starter_pack-0.4.0.dist-info → agent_starter_pack-0.4.2.dist-info}/WHEEL +0 -0
- {agent_starter_pack-0.4.0.dist-info → agent_starter_pack-0.4.2.dist-info}/entry_points.txt +0 -0
- {agent_starter_pack-0.4.0.dist-info → agent_starter_pack-0.4.2.dist-info}/licenses/LICENSE +0 -0
@@ -1,7 +1,7 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: agent-starter-pack
|
3
|
-
Version: 0.4.
|
4
|
-
Summary: CLI
|
3
|
+
Version: 0.4.2
|
4
|
+
Summary: CLI to bootstrap production-ready Google Cloud GenAI agent projects from templates.
|
5
5
|
Author-email: Google LLC <agent-starter-pack@google.com>
|
6
6
|
License: Apache-2.0
|
7
7
|
License-File: LICENSE
|
@@ -38,7 +38,7 @@ Description-Content-Type: text/markdown
|
|
38
38
|
alt="Try in Firebase Studio"
|
39
39
|
src="https://cdn.firebasestudio.dev/btn/try_blue_20.svg">
|
40
40
|
</picture>
|
41
|
-
</a> 
|
41
|
+
</a> [](https://shell.cloud.google.com/cloudshell/editor?cloudshell_git_repo=https%3A%2F%2Fgithub.com%2Feliasecchig%2Fasp-open-in-cloud-shell&cloudshell_print=open-in-cs) 
|
42
42
|
|
43
43
|
|
44
44
|
The `agent-starter-pack` is a collection of production-ready Generative AI Agent templates built for Google Cloud. <br>
|
@@ -66,7 +66,7 @@ agent-starter-pack create my-awesome-agent
|
|
66
66
|
```
|
67
67
|
|
68
68
|
**That's it!** You now have a fully functional agent project—complete with backend, frontend, and deployment infrastructure—ready for you to explore and customize.
|
69
|
-
|
69
|
+
See [Installation Guide](https://googlecloudplatform.github.io/agent-starter-pack/guide/installation) for more options, or try with zero setup in [Firebase Studio](https://studio.firebase.google.com/new?template=https%3A%2F%2Fgithub.com%2FGoogleCloudPlatform%2Fagent-starter-pack%2Ftree%2Fmain%2Fsrc%2Fresources%2Fidx) or [Cloud Shell](https://shell.cloud.google.com/cloudshell/editor?cloudshell_git_repo=https%3A%2F%2Fgithub.com%2Feliasecchig%2Fasp-open-in-cloud-shell&cloudshell_print=open-in-cs).
|
70
70
|
|
71
71
|
---
|
72
72
|
|
@@ -129,13 +129,12 @@ Visit our [documentation site](https://googlecloudplatform.github.io/agent-start
|
|
129
129
|
|
130
130
|
### Video Walkthrough:
|
131
131
|
|
132
|
-
|
132
|
+
- **[Exploring the Agent Starter Pack](https://www.youtube.com/watch?v=9zqwym-N3lg)**: A comprehensive tutorial demonstrating how to rapidly deploy AI Agents using the Agent Starter Pack, covering architecture, templates, and step-by-step deployment.
|
133
133
|
|
134
|
-
- **
|
135
|
-
|
136
|
-
- **
|
134
|
+
- **[6-minute introduction](https://www.youtube.com/live/eZ-8UQ_t4YM?feature=shared&t=2791)** (April 2024): Explaining the Agent Starter Pack and demonstrating its key features. Part of the Kaggle GenAI intensive course.
|
135
|
+
|
136
|
+
- **[120-minute livestream demo](https://www.youtube.com/watch?v=yIRIT_EtALs&t=235s)** (March 6, 2025): Watch us build 3 Agents in under 30 minutes using the `agent-starter-pack`!
|
137
137
|
|
138
|
-
## Explore More Generative AI Resources
|
139
138
|
|
140
139
|
Looking for more examples and resources for Generative AI on Google Cloud? Check out the [GoogleCloudPlatform/generative-ai](https://github.com/GoogleCloudPlatform/generative-ai) repository for notebooks, code samples, and more!
|
141
140
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
agents/adk_base/README.md,sha256=eLf-F9Z4u_mQOchAnUaSrOAHXRSx8wUQN29kkwz1SF4,894
|
2
2
|
agents/adk_base/app/agent.py,sha256=Kt-0TQM4g9NLs7Q2KmRWPfPWWgyQEODVo0uCepLkqDw,2182
|
3
|
-
agents/adk_base/notebooks/adk_app_testing.ipynb,sha256=
|
3
|
+
agents/adk_base/notebooks/adk_app_testing.ipynb,sha256=WTxrxu-bMfjqR8SvwZxNuR2_4Qo20QUZ7F3aBCRxtA0,9613
|
4
4
|
agents/adk_base/notebooks/evaluating_adk_agent.ipynb,sha256=OMTiT3gAFWPvE9pPL8z7tsDwOU-l8wem5wH-OXPPlvk,56805
|
5
5
|
agents/adk_base/template/.templateconfig.yaml,sha256=x3mXlO-JkgXEOpbLoreJzOp78LQfhIWlV9rKAjHPwfU,893
|
6
6
|
agents/adk_base/tests/integration/test_agent.py,sha256=1VyshBu44p_PUAQQxV0QROmv6OUGt_m0nDLyaTI77po,1964
|
@@ -8,7 +8,7 @@ agents/agentic_rag/README.md,sha256=mxMLkq6tAghFaDmc2sc2sEQ5vn9kGWdiRxfTykwpLz0,
|
|
8
8
|
agents/agentic_rag/app/agent.py,sha256=thaU0njJ3W90DI54EVrFe4lwx9yMWZT4jSGRMnUSdY8,3987
|
9
9
|
agents/agentic_rag/app/retrievers.py,sha256=qfxwSEixMddvAu4FvUTZAFh1Gdp3RPY65s0Wp6gEFVk,4561
|
10
10
|
agents/agentic_rag/app/templates.py,sha256=8N_uRchwiN7hlH9Y8rdJ1CAtOhpHUWZkXZZ7IU-YJJk,867
|
11
|
-
agents/agentic_rag/notebooks/adk_app_testing.ipynb,sha256=
|
11
|
+
agents/agentic_rag/notebooks/adk_app_testing.ipynb,sha256=WTxrxu-bMfjqR8SvwZxNuR2_4Qo20QUZ7F3aBCRxtA0,9613
|
12
12
|
agents/agentic_rag/notebooks/evaluating_adk_agent.ipynb,sha256=OMTiT3gAFWPvE9pPL8z7tsDwOU-l8wem5wH-OXPPlvk,56805
|
13
13
|
agents/agentic_rag/template/.templateconfig.yaml,sha256=33QMS3Vi_gpYLCqxm2idbv_mZ8EMqruezzw0G-a7oyg,1223
|
14
14
|
agents/agentic_rag/tests/integration/test_agent.py,sha256=HbEv2gzC77jrse3RZ0ra_Bcu6zW_7YlrxYWcYfei63M,2107
|
@@ -34,7 +34,7 @@ agents/live_api/tests/integration/test_server_e2e.py,sha256=D2VETDIyTD2fQyQ6DXwL
|
|
34
34
|
agents/live_api/tests/load_test/load_test.py,sha256=HHZyfC4gqiQtZVF_CbbxENGgWQccMLpwMv0IdoQ6cbQ,1275
|
35
35
|
agents/live_api/tests/unit/test_server.py,sha256=_TjlgQgNkjerIaBGnu8P8_KB8ZlSolDcivALpUOn_Rw,4786
|
36
36
|
src/base_template/.gitignore,sha256=mJKTZIcVdAFiIUQicRfPNGUg6WvwcfTEC2xbmAaU34g,2579
|
37
|
-
src/base_template/Makefile,sha256=
|
37
|
+
src/base_template/Makefile,sha256=lvcSmYD0S8dcQNOTKk3ZZG6_92bx8aWWDYStI4bZ8J8,4518
|
38
38
|
src/base_template/README.md,sha256=ocMt-AFgd4vJda7ABIiR4ajhf4RxTg1jV4k7Lwq8-No,10143
|
39
39
|
src/base_template/pyproject.toml,sha256=V2Df010o_Q8smOaS1K9fx-pVe9X4_KZT4vpIRaB0aFs,2959
|
40
40
|
src/base_template/app/__init__.py,sha256=UyAgc2l8nkVIUPUzL9hKR7EgzCsc2jSYcOcjHNNmpMU,59
|
@@ -64,9 +64,9 @@ src/base_template/deployment/terraform/vars/env.tfvars,sha256=Nze8q1x2Aj6ZUeWC2h
|
|
64
64
|
src/base_template/tests/unit/test_dummy.py,sha256=2exfCH8qhkZrLWvK04ZxNTO9MV3fdTbZkJN3uK6zvok,850
|
65
65
|
src/cli/main.py,sha256=pMsSlNwkrFqHUHHA5U-WMZ4QRquaI_F7OXQt6yxuugE,1688
|
66
66
|
src/cli/commands/create.py,sha256=2dvvkvwLAJDi1gG7SA3LXfriTY7T6fyWKeuBHHwxLIU,24117
|
67
|
-
src/cli/commands/setup_cicd.py,sha256=
|
67
|
+
src/cli/commands/setup_cicd.py,sha256=Lr0wLeKlRxROsRVFLAI3ygfIh_sTavvgQckDkzFEKMQ,31705
|
68
68
|
src/cli/utils/__init__.py,sha256=_cTmsXGPqOtK0q8UW5164QTltbJRJFR_Efxq_BRL1-o,1311
|
69
|
-
src/cli/utils/cicd.py,sha256=
|
69
|
+
src/cli/utils/cicd.py,sha256=m2BxwV39323rVzJCjJjB37IPdSNQdxVgXGrgnhdbb84,26040
|
70
70
|
src/cli/utils/datastores.py,sha256=gv1V6eDcOEKx4MRNG5C3Y-VfixYq1AzQuaYMLp8QRNo,1058
|
71
71
|
src/cli/utils/gcp.py,sha256=cnuCyN144eiyYc9aJNEK9JnyWN66rdevugoMdDYC1UU,4032
|
72
72
|
src/cli/utils/logging.py,sha256=0lHe4EPi1A8sOx9xkA7gS4UNl0GsIyp2ahydkkuCzLY,1570
|
@@ -169,8 +169,8 @@ src/resources/setup_cicd/providers.tf,sha256=Km4z6IJt7x7PLaa0kyZbBrO2m3lpuIJZFD5
|
|
169
169
|
src/utils/generate_locks.py,sha256=6V1B8V2BEuevWnXUsxZVTrLjXwFRII8UfsIGrQqZxVs,4320
|
170
170
|
src/utils/lock_utils.py,sha256=RSE6n3hBkH64xNm3Q5wrR0Pqbeo-oc7xaTOhA9yzHjk,2275
|
171
171
|
src/utils/watch_and_rebuild.py,sha256=vP4yIiA7E_lj5sfQdJUl8TXas6V7msDg8XWUutAC05Q,6679
|
172
|
-
agent_starter_pack-0.4.
|
173
|
-
agent_starter_pack-0.4.
|
174
|
-
agent_starter_pack-0.4.
|
175
|
-
agent_starter_pack-0.4.
|
176
|
-
agent_starter_pack-0.4.
|
172
|
+
agent_starter_pack-0.4.2.dist-info/METADATA,sha256=hI-T9Fi9ih7Cl32r5ng0SpqlDSH_LnBef6kYZIlDC1M,10452
|
173
|
+
agent_starter_pack-0.4.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
174
|
+
agent_starter_pack-0.4.2.dist-info/entry_points.txt,sha256=U7uCxR7YulIhZ0L8R8Hui0Bsy6J7oyESBeDYJYMrQjA,56
|
175
|
+
agent_starter_pack-0.4.2.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
176
|
+
agent_starter_pack-0.4.2.dist-info/RECORD,,
|
@@ -16,58 +16,43 @@
|
|
16
16
|
"cell_type": "markdown",
|
17
17
|
"metadata": {},
|
18
18
|
"source": [
|
19
|
-
"
|
19
|
+
"## Install dependencies"
|
20
20
|
]
|
21
21
|
},
|
22
22
|
{
|
23
23
|
"cell_type": "code",
|
24
|
-
"execution_count":
|
24
|
+
"execution_count": null,
|
25
25
|
"metadata": {},
|
26
26
|
"outputs": [],
|
27
27
|
"source": [
|
28
|
-
"
|
29
|
-
"\n",
|
30
|
-
"import requests\n",
|
31
|
-
"import vertexai.agent_engines"
|
28
|
+
"!pip install google-cloud-aiplatform --upgrade"
|
32
29
|
]
|
33
30
|
},
|
34
31
|
{
|
35
32
|
"cell_type": "markdown",
|
36
33
|
"metadata": {},
|
37
34
|
"source": [
|
38
|
-
"
|
39
|
-
"See more documentation at [Agent Engine Overview](https://cloud.google.com/vertex-ai/generative-ai/docs/agent-engine/overview)"
|
40
|
-
]
|
41
|
-
},
|
42
|
-
{
|
43
|
-
"cell_type": "markdown",
|
44
|
-
"metadata": {},
|
45
|
-
"source": [
|
46
|
-
"### Local Testing\n",
|
47
|
-
"\n",
|
48
|
-
"You can import directly the AgentEngineApp class within your environment. "
|
35
|
+
"### Import libraries"
|
49
36
|
]
|
50
37
|
},
|
51
38
|
{
|
52
39
|
"cell_type": "code",
|
53
|
-
"execution_count":
|
40
|
+
"execution_count": 1,
|
54
41
|
"metadata": {},
|
55
42
|
"outputs": [],
|
56
43
|
"source": [
|
57
|
-
"
|
58
|
-
"from app.agent_engine_app import AgentEngineApp\n",
|
44
|
+
"import json\n",
|
59
45
|
"\n",
|
60
|
-
"
|
46
|
+
"import requests\n",
|
47
|
+
"import vertexai.agent_engines"
|
61
48
|
]
|
62
49
|
},
|
63
50
|
{
|
64
|
-
"cell_type": "
|
65
|
-
"execution_count": null,
|
51
|
+
"cell_type": "markdown",
|
66
52
|
"metadata": {},
|
67
|
-
"outputs": [],
|
68
53
|
"source": [
|
69
|
-
"
|
70
|
-
"
|
54
|
+
"## If you are using Agent Engine\n",
|
55
|
+
"See more documentation at [Agent Engine Overview](https://cloud.google.com/vertex-ai/generative-ai/docs/agent-engine/overview)"
|
71
56
|
]
|
72
57
|
},
|
73
58
|
{
|
@@ -122,6 +107,53 @@
|
|
122
107
|
")"
|
123
108
|
]
|
124
109
|
},
|
110
|
+
{
|
111
|
+
"cell_type": "markdown",
|
112
|
+
"metadata": {},
|
113
|
+
"source": [
|
114
|
+
"### Local Testing\n",
|
115
|
+
"\n",
|
116
|
+
"You can import directly the AgentEngineApp class within your environment. \n",
|
117
|
+
"To run the agent locally, follow these steps:\n",
|
118
|
+
"1. Make sure all required packages are installed in your environment\n",
|
119
|
+
"2. The recommended approach is to use the same virtual environment created by the 'uv' tool\n",
|
120
|
+
"3. You can set up this environment by running 'make install' from your agent's root directory\n",
|
121
|
+
"4. Then select this kernel (.venv folder in your project) in your Jupyter notebook to ensure all dependencies are available"
|
122
|
+
]
|
123
|
+
},
|
124
|
+
{
|
125
|
+
"cell_type": "code",
|
126
|
+
"execution_count": 2,
|
127
|
+
"metadata": {},
|
128
|
+
"outputs": [],
|
129
|
+
"source": [
|
130
|
+
"# Uncomment the following lines if you're not using the virtual environment created by uv\n",
|
131
|
+
"# import sys\n",
|
132
|
+
"# sys.path.append(\"../\")"
|
133
|
+
]
|
134
|
+
},
|
135
|
+
{
|
136
|
+
"cell_type": "code",
|
137
|
+
"execution_count": null,
|
138
|
+
"metadata": {},
|
139
|
+
"outputs": [],
|
140
|
+
"source": [
|
141
|
+
"from app.agent import root_agent\n",
|
142
|
+
"from app.agent_engine_app import AgentEngineApp\n",
|
143
|
+
"\n",
|
144
|
+
"agent_engine = AgentEngineApp(agent=root_agent)"
|
145
|
+
]
|
146
|
+
},
|
147
|
+
{
|
148
|
+
"cell_type": "code",
|
149
|
+
"execution_count": null,
|
150
|
+
"metadata": {},
|
151
|
+
"outputs": [],
|
152
|
+
"source": [
|
153
|
+
"for event in agent_engine.stream_query(message=\"hi!\", user_id=\"test\"):\n",
|
154
|
+
" print(event)"
|
155
|
+
]
|
156
|
+
},
|
125
157
|
{
|
126
158
|
"cell_type": "markdown",
|
127
159
|
"metadata": {},
|
@@ -133,17 +165,39 @@
|
|
133
165
|
"cell_type": "markdown",
|
134
166
|
"metadata": {},
|
135
167
|
"source": [
|
136
|
-
"
|
168
|
+
"#### Remote Testing\n",
|
137
169
|
"\n",
|
138
|
-
"
|
170
|
+
"For more information about authenticating HTTPS requests to Cloud Run services, see:\n",
|
171
|
+
"[Cloud Run Authentication Documentation](https://cloud.google.com/run/docs/triggering/https-request)\n",
|
172
|
+
"\n",
|
173
|
+
"Remote testing involves using a deployed service URL instead of localhost.\n",
|
174
|
+
"\n",
|
175
|
+
"Authentication is handled using GCP identity tokens instead of local credentials."
|
176
|
+
]
|
177
|
+
},
|
178
|
+
{
|
179
|
+
"cell_type": "code",
|
180
|
+
"execution_count": 20,
|
181
|
+
"metadata": {},
|
182
|
+
"outputs": [],
|
183
|
+
"source": [
|
184
|
+
"ID_TOKEN = get_ipython().getoutput(\"gcloud auth print-identity-token -q\")[0]"
|
185
|
+
]
|
186
|
+
},
|
187
|
+
{
|
188
|
+
"cell_type": "code",
|
189
|
+
"execution_count": null,
|
190
|
+
"metadata": {},
|
191
|
+
"outputs": [],
|
192
|
+
"source": [
|
193
|
+
"SERVICE_URL = \"YOUR_SERVICE_URL_HERE\" # Replace with your Cloud Run service URL"
|
139
194
|
]
|
140
195
|
},
|
141
196
|
{
|
142
197
|
"cell_type": "markdown",
|
143
198
|
"metadata": {},
|
144
199
|
"source": [
|
145
|
-
"
|
146
|
-
" Create a new session with user preferences and state information\n"
|
200
|
+
"You'll need to first create a Session"
|
147
201
|
]
|
148
202
|
},
|
149
203
|
{
|
@@ -156,8 +210,8 @@
|
|
156
210
|
"session_id = \"test_session_456\"\n",
|
157
211
|
"session_data = {\"state\": {\"preferred_language\": \"English\", \"visit_count\": 1}}\n",
|
158
212
|
"\n",
|
159
|
-
"session_url = f\"
|
160
|
-
"headers = {\"Content-Type\": \"application/json\"}\n",
|
213
|
+
"session_url = f\"{SERVICE_URL}/apps/app/users/{user_id}/sessions/{session_id}\"\n",
|
214
|
+
"headers = {\"Content-Type\": \"application/json\", \"Authorization\": f\"Bearer {ID_TOKEN}\"}\n",
|
161
215
|
"\n",
|
162
216
|
"session_response = requests.post(session_url, headers=headers, json=session_data)\n",
|
163
217
|
"print(f\"Session creation status code: {session_response.status_code}\")"
|
@@ -167,8 +221,7 @@
|
|
167
221
|
"cell_type": "markdown",
|
168
222
|
"metadata": {},
|
169
223
|
"source": [
|
170
|
-
"
|
171
|
-
"Send a message to the backend service and receive a streaming response\n"
|
224
|
+
"Then you will be able to send a message"
|
172
225
|
]
|
173
226
|
},
|
174
227
|
{
|
@@ -185,7 +238,7 @@
|
|
185
238
|
" \"streaming\": True,\n",
|
186
239
|
"}\n",
|
187
240
|
"\n",
|
188
|
-
"message_url = \"
|
241
|
+
"message_url = f\"{SERVICE_URL}/run_sse\"\n",
|
189
242
|
"message_response = requests.post(\n",
|
190
243
|
" message_url, headers=headers, json=message_data, stream=True\n",
|
191
244
|
")\n",
|
@@ -206,39 +259,17 @@
|
|
206
259
|
"cell_type": "markdown",
|
207
260
|
"metadata": {},
|
208
261
|
"source": [
|
209
|
-
"
|
210
|
-
"\n",
|
211
|
-
"For more information about authenticating HTTPS requests to Cloud Run services, see:\n",
|
212
|
-
"[Cloud Run Authentication Documentation](https://cloud.google.com/run/docs/triggering/https-request)\n",
|
213
|
-
"\n",
|
214
|
-
"Remote testing involves using a deployed service URL instead of localhost.\n",
|
262
|
+
"### Local Testing\n",
|
215
263
|
"\n",
|
216
|
-
"
|
217
|
-
]
|
218
|
-
},
|
219
|
-
{
|
220
|
-
"cell_type": "code",
|
221
|
-
"execution_count": 20,
|
222
|
-
"metadata": {},
|
223
|
-
"outputs": [],
|
224
|
-
"source": [
|
225
|
-
"ID_TOKEN = get_ipython().getoutput(\"gcloud auth print-identity-token -q\")[0]"
|
226
|
-
]
|
227
|
-
},
|
228
|
-
{
|
229
|
-
"cell_type": "code",
|
230
|
-
"execution_count": null,
|
231
|
-
"metadata": {},
|
232
|
-
"outputs": [],
|
233
|
-
"source": [
|
234
|
-
"SERVICE_URL = \"YOUR_SERVICE_URL_HERE\" # Replace with your Cloud Run service URL"
|
264
|
+
"> You can run the application locally via the `make backend` command."
|
235
265
|
]
|
236
266
|
},
|
237
267
|
{
|
238
268
|
"cell_type": "markdown",
|
239
269
|
"metadata": {},
|
240
270
|
"source": [
|
241
|
-
"
|
271
|
+
"#### Create a session\n",
|
272
|
+
" Create a new session with user preferences and state information\n"
|
242
273
|
]
|
243
274
|
},
|
244
275
|
{
|
@@ -251,8 +282,8 @@
|
|
251
282
|
"session_id = \"test_session_456\"\n",
|
252
283
|
"session_data = {\"state\": {\"preferred_language\": \"English\", \"visit_count\": 1}}\n",
|
253
284
|
"\n",
|
254
|
-
"session_url = f\"
|
255
|
-
"headers = {\"Content-Type\": \"application/json\"
|
285
|
+
"session_url = f\"http://127.0.0.1:8000/apps/app/users/{user_id}/sessions/{session_id}\"\n",
|
286
|
+
"headers = {\"Content-Type\": \"application/json\"}\n",
|
256
287
|
"\n",
|
257
288
|
"session_response = requests.post(session_url, headers=headers, json=session_data)\n",
|
258
289
|
"print(f\"Session creation status code: {session_response.status_code}\")"
|
@@ -262,7 +293,8 @@
|
|
262
293
|
"cell_type": "markdown",
|
263
294
|
"metadata": {},
|
264
295
|
"source": [
|
265
|
-
"
|
296
|
+
"#### Send a message\n",
|
297
|
+
"Send a message to the backend service and receive a streaming response\n"
|
266
298
|
]
|
267
299
|
},
|
268
300
|
{
|
@@ -279,7 +311,7 @@
|
|
279
311
|
" \"streaming\": True,\n",
|
280
312
|
"}\n",
|
281
313
|
"\n",
|
282
|
-
"message_url =
|
314
|
+
"message_url = \"http://127.0.0.1:8000/run_sse\"\n",
|
283
315
|
"message_response = requests.post(\n",
|
284
316
|
" message_url, headers=headers, json=message_data, stream=True\n",
|
285
317
|
")\n",
|
@@ -299,7 +331,7 @@
|
|
299
331
|
],
|
300
332
|
"metadata": {
|
301
333
|
"kernelspec": {
|
302
|
-
"display_name": "
|
334
|
+
"display_name": "Python 3",
|
303
335
|
"language": "python",
|
304
336
|
"name": "python3"
|
305
337
|
},
|
@@ -313,7 +345,7 @@
|
|
313
345
|
"name": "python",
|
314
346
|
"nbconvert_exporter": "python",
|
315
347
|
"pygments_lexer": "ipython3",
|
316
|
-
"version": "3.12.
|
348
|
+
"version": "3.12.2"
|
317
349
|
}
|
318
350
|
},
|
319
351
|
"nbformat": 4,
|
@@ -16,58 +16,43 @@
|
|
16
16
|
"cell_type": "markdown",
|
17
17
|
"metadata": {},
|
18
18
|
"source": [
|
19
|
-
"
|
19
|
+
"## Install dependencies"
|
20
20
|
]
|
21
21
|
},
|
22
22
|
{
|
23
23
|
"cell_type": "code",
|
24
|
-
"execution_count":
|
24
|
+
"execution_count": null,
|
25
25
|
"metadata": {},
|
26
26
|
"outputs": [],
|
27
27
|
"source": [
|
28
|
-
"
|
29
|
-
"\n",
|
30
|
-
"import requests\n",
|
31
|
-
"import vertexai.agent_engines"
|
28
|
+
"!pip install google-cloud-aiplatform --upgrade"
|
32
29
|
]
|
33
30
|
},
|
34
31
|
{
|
35
32
|
"cell_type": "markdown",
|
36
33
|
"metadata": {},
|
37
34
|
"source": [
|
38
|
-
"
|
39
|
-
"See more documentation at [Agent Engine Overview](https://cloud.google.com/vertex-ai/generative-ai/docs/agent-engine/overview)"
|
40
|
-
]
|
41
|
-
},
|
42
|
-
{
|
43
|
-
"cell_type": "markdown",
|
44
|
-
"metadata": {},
|
45
|
-
"source": [
|
46
|
-
"### Local Testing\n",
|
47
|
-
"\n",
|
48
|
-
"You can import directly the AgentEngineApp class within your environment. "
|
35
|
+
"### Import libraries"
|
49
36
|
]
|
50
37
|
},
|
51
38
|
{
|
52
39
|
"cell_type": "code",
|
53
|
-
"execution_count":
|
40
|
+
"execution_count": 1,
|
54
41
|
"metadata": {},
|
55
42
|
"outputs": [],
|
56
43
|
"source": [
|
57
|
-
"
|
58
|
-
"from app.agent_engine_app import AgentEngineApp\n",
|
44
|
+
"import json\n",
|
59
45
|
"\n",
|
60
|
-
"
|
46
|
+
"import requests\n",
|
47
|
+
"import vertexai.agent_engines"
|
61
48
|
]
|
62
49
|
},
|
63
50
|
{
|
64
|
-
"cell_type": "
|
65
|
-
"execution_count": null,
|
51
|
+
"cell_type": "markdown",
|
66
52
|
"metadata": {},
|
67
|
-
"outputs": [],
|
68
53
|
"source": [
|
69
|
-
"
|
70
|
-
"
|
54
|
+
"## If you are using Agent Engine\n",
|
55
|
+
"See more documentation at [Agent Engine Overview](https://cloud.google.com/vertex-ai/generative-ai/docs/agent-engine/overview)"
|
71
56
|
]
|
72
57
|
},
|
73
58
|
{
|
@@ -122,6 +107,53 @@
|
|
122
107
|
")"
|
123
108
|
]
|
124
109
|
},
|
110
|
+
{
|
111
|
+
"cell_type": "markdown",
|
112
|
+
"metadata": {},
|
113
|
+
"source": [
|
114
|
+
"### Local Testing\n",
|
115
|
+
"\n",
|
116
|
+
"You can import directly the AgentEngineApp class within your environment. \n",
|
117
|
+
"To run the agent locally, follow these steps:\n",
|
118
|
+
"1. Make sure all required packages are installed in your environment\n",
|
119
|
+
"2. The recommended approach is to use the same virtual environment created by the 'uv' tool\n",
|
120
|
+
"3. You can set up this environment by running 'make install' from your agent's root directory\n",
|
121
|
+
"4. Then select this kernel (.venv folder in your project) in your Jupyter notebook to ensure all dependencies are available"
|
122
|
+
]
|
123
|
+
},
|
124
|
+
{
|
125
|
+
"cell_type": "code",
|
126
|
+
"execution_count": 2,
|
127
|
+
"metadata": {},
|
128
|
+
"outputs": [],
|
129
|
+
"source": [
|
130
|
+
"# Uncomment the following lines if you're not using the virtual environment created by uv\n",
|
131
|
+
"# import sys\n",
|
132
|
+
"# sys.path.append(\"../\")"
|
133
|
+
]
|
134
|
+
},
|
135
|
+
{
|
136
|
+
"cell_type": "code",
|
137
|
+
"execution_count": null,
|
138
|
+
"metadata": {},
|
139
|
+
"outputs": [],
|
140
|
+
"source": [
|
141
|
+
"from app.agent import root_agent\n",
|
142
|
+
"from app.agent_engine_app import AgentEngineApp\n",
|
143
|
+
"\n",
|
144
|
+
"agent_engine = AgentEngineApp(agent=root_agent)"
|
145
|
+
]
|
146
|
+
},
|
147
|
+
{
|
148
|
+
"cell_type": "code",
|
149
|
+
"execution_count": null,
|
150
|
+
"metadata": {},
|
151
|
+
"outputs": [],
|
152
|
+
"source": [
|
153
|
+
"for event in agent_engine.stream_query(message=\"hi!\", user_id=\"test\"):\n",
|
154
|
+
" print(event)"
|
155
|
+
]
|
156
|
+
},
|
125
157
|
{
|
126
158
|
"cell_type": "markdown",
|
127
159
|
"metadata": {},
|
@@ -133,17 +165,39 @@
|
|
133
165
|
"cell_type": "markdown",
|
134
166
|
"metadata": {},
|
135
167
|
"source": [
|
136
|
-
"
|
168
|
+
"#### Remote Testing\n",
|
137
169
|
"\n",
|
138
|
-
"
|
170
|
+
"For more information about authenticating HTTPS requests to Cloud Run services, see:\n",
|
171
|
+
"[Cloud Run Authentication Documentation](https://cloud.google.com/run/docs/triggering/https-request)\n",
|
172
|
+
"\n",
|
173
|
+
"Remote testing involves using a deployed service URL instead of localhost.\n",
|
174
|
+
"\n",
|
175
|
+
"Authentication is handled using GCP identity tokens instead of local credentials."
|
176
|
+
]
|
177
|
+
},
|
178
|
+
{
|
179
|
+
"cell_type": "code",
|
180
|
+
"execution_count": 20,
|
181
|
+
"metadata": {},
|
182
|
+
"outputs": [],
|
183
|
+
"source": [
|
184
|
+
"ID_TOKEN = get_ipython().getoutput(\"gcloud auth print-identity-token -q\")[0]"
|
185
|
+
]
|
186
|
+
},
|
187
|
+
{
|
188
|
+
"cell_type": "code",
|
189
|
+
"execution_count": null,
|
190
|
+
"metadata": {},
|
191
|
+
"outputs": [],
|
192
|
+
"source": [
|
193
|
+
"SERVICE_URL = \"YOUR_SERVICE_URL_HERE\" # Replace with your Cloud Run service URL"
|
139
194
|
]
|
140
195
|
},
|
141
196
|
{
|
142
197
|
"cell_type": "markdown",
|
143
198
|
"metadata": {},
|
144
199
|
"source": [
|
145
|
-
"
|
146
|
-
" Create a new session with user preferences and state information\n"
|
200
|
+
"You'll need to first create a Session"
|
147
201
|
]
|
148
202
|
},
|
149
203
|
{
|
@@ -156,8 +210,8 @@
|
|
156
210
|
"session_id = \"test_session_456\"\n",
|
157
211
|
"session_data = {\"state\": {\"preferred_language\": \"English\", \"visit_count\": 1}}\n",
|
158
212
|
"\n",
|
159
|
-
"session_url = f\"
|
160
|
-
"headers = {\"Content-Type\": \"application/json\"}\n",
|
213
|
+
"session_url = f\"{SERVICE_URL}/apps/app/users/{user_id}/sessions/{session_id}\"\n",
|
214
|
+
"headers = {\"Content-Type\": \"application/json\", \"Authorization\": f\"Bearer {ID_TOKEN}\"}\n",
|
161
215
|
"\n",
|
162
216
|
"session_response = requests.post(session_url, headers=headers, json=session_data)\n",
|
163
217
|
"print(f\"Session creation status code: {session_response.status_code}\")"
|
@@ -167,8 +221,7 @@
|
|
167
221
|
"cell_type": "markdown",
|
168
222
|
"metadata": {},
|
169
223
|
"source": [
|
170
|
-
"
|
171
|
-
"Send a message to the backend service and receive a streaming response\n"
|
224
|
+
"Then you will be able to send a message"
|
172
225
|
]
|
173
226
|
},
|
174
227
|
{
|
@@ -185,7 +238,7 @@
|
|
185
238
|
" \"streaming\": True,\n",
|
186
239
|
"}\n",
|
187
240
|
"\n",
|
188
|
-
"message_url = \"
|
241
|
+
"message_url = f\"{SERVICE_URL}/run_sse\"\n",
|
189
242
|
"message_response = requests.post(\n",
|
190
243
|
" message_url, headers=headers, json=message_data, stream=True\n",
|
191
244
|
")\n",
|
@@ -206,39 +259,17 @@
|
|
206
259
|
"cell_type": "markdown",
|
207
260
|
"metadata": {},
|
208
261
|
"source": [
|
209
|
-
"
|
210
|
-
"\n",
|
211
|
-
"For more information about authenticating HTTPS requests to Cloud Run services, see:\n",
|
212
|
-
"[Cloud Run Authentication Documentation](https://cloud.google.com/run/docs/triggering/https-request)\n",
|
213
|
-
"\n",
|
214
|
-
"Remote testing involves using a deployed service URL instead of localhost.\n",
|
262
|
+
"### Local Testing\n",
|
215
263
|
"\n",
|
216
|
-
"
|
217
|
-
]
|
218
|
-
},
|
219
|
-
{
|
220
|
-
"cell_type": "code",
|
221
|
-
"execution_count": 20,
|
222
|
-
"metadata": {},
|
223
|
-
"outputs": [],
|
224
|
-
"source": [
|
225
|
-
"ID_TOKEN = get_ipython().getoutput(\"gcloud auth print-identity-token -q\")[0]"
|
226
|
-
]
|
227
|
-
},
|
228
|
-
{
|
229
|
-
"cell_type": "code",
|
230
|
-
"execution_count": null,
|
231
|
-
"metadata": {},
|
232
|
-
"outputs": [],
|
233
|
-
"source": [
|
234
|
-
"SERVICE_URL = \"YOUR_SERVICE_URL_HERE\" # Replace with your Cloud Run service URL"
|
264
|
+
"> You can run the application locally via the `make backend` command."
|
235
265
|
]
|
236
266
|
},
|
237
267
|
{
|
238
268
|
"cell_type": "markdown",
|
239
269
|
"metadata": {},
|
240
270
|
"source": [
|
241
|
-
"
|
271
|
+
"#### Create a session\n",
|
272
|
+
" Create a new session with user preferences and state information\n"
|
242
273
|
]
|
243
274
|
},
|
244
275
|
{
|
@@ -251,8 +282,8 @@
|
|
251
282
|
"session_id = \"test_session_456\"\n",
|
252
283
|
"session_data = {\"state\": {\"preferred_language\": \"English\", \"visit_count\": 1}}\n",
|
253
284
|
"\n",
|
254
|
-
"session_url = f\"
|
255
|
-
"headers = {\"Content-Type\": \"application/json\"
|
285
|
+
"session_url = f\"http://127.0.0.1:8000/apps/app/users/{user_id}/sessions/{session_id}\"\n",
|
286
|
+
"headers = {\"Content-Type\": \"application/json\"}\n",
|
256
287
|
"\n",
|
257
288
|
"session_response = requests.post(session_url, headers=headers, json=session_data)\n",
|
258
289
|
"print(f\"Session creation status code: {session_response.status_code}\")"
|
@@ -262,7 +293,8 @@
|
|
262
293
|
"cell_type": "markdown",
|
263
294
|
"metadata": {},
|
264
295
|
"source": [
|
265
|
-
"
|
296
|
+
"#### Send a message\n",
|
297
|
+
"Send a message to the backend service and receive a streaming response\n"
|
266
298
|
]
|
267
299
|
},
|
268
300
|
{
|
@@ -279,7 +311,7 @@
|
|
279
311
|
" \"streaming\": True,\n",
|
280
312
|
"}\n",
|
281
313
|
"\n",
|
282
|
-
"message_url =
|
314
|
+
"message_url = \"http://127.0.0.1:8000/run_sse\"\n",
|
283
315
|
"message_response = requests.post(\n",
|
284
316
|
" message_url, headers=headers, json=message_data, stream=True\n",
|
285
317
|
")\n",
|
@@ -299,7 +331,7 @@
|
|
299
331
|
],
|
300
332
|
"metadata": {
|
301
333
|
"kernelspec": {
|
302
|
-
"display_name": "
|
334
|
+
"display_name": "Python 3",
|
303
335
|
"language": "python",
|
304
336
|
"name": "python3"
|
305
337
|
},
|
@@ -313,7 +345,7 @@
|
|
313
345
|
"name": "python",
|
314
346
|
"nbconvert_exporter": "python",
|
315
347
|
"pygments_lexer": "ipython3",
|
316
|
-
"version": "3.12.
|
348
|
+
"version": "3.12.2"
|
317
349
|
}
|
318
350
|
},
|
319
351
|
"nbformat": 4,
|
src/base_template/Makefile
CHANGED
@@ -42,8 +42,8 @@ backend:
|
|
42
42
|
"COMMIT_SHA=$(shell git rev-parse HEAD){%- if cookiecutter.data_ingestion %}{%- if cookiecutter.datastore_type == "vertex_ai_search" %},DATA_STORE_ID={{cookiecutter.project_name}}-datastore,DATA_STORE_REGION=us{%- elif cookiecutter.datastore_type == "vertex_ai_vector_search" %},VECTOR_SEARCH_INDEX={{cookiecutter.project_name}}-vector-search,VECTOR_SEARCH_INDEX_ENDPOINT={{cookiecutter.project_name}}-vector-search-endpoint,VECTOR_SEARCH_BUCKET=$$PROJECT_ID-{{cookiecutter.project_name}}-vs{%- endif %}{%- endif %}"
|
43
43
|
{%- elif cookiecutter.deployment_target == 'agent_engine' %}
|
44
44
|
# Export dependencies to requirements file using uv export.
|
45
|
-
uv export --no-hashes --no-
|
46
|
-
uv export --no-hashes --no-
|
45
|
+
uv export --no-hashes --no-header --no-dev --no-emit-project --no-annotate --frozen > .requirements.txt 2>/dev/null || \
|
46
|
+
uv export --no-hashes --no-header --no-dev --no-emit-project --frozen > .requirements.txt && uv run app/agent_engine_app.py
|
47
47
|
{%- endif %}
|
48
48
|
{%- if cookiecutter.deployment_target == 'cloud_run' %}
|
49
49
|
|
src/cli/commands/setup_cicd.py
CHANGED
@@ -12,7 +12,6 @@
|
|
12
12
|
# See the License for the specific language governing permissions and
|
13
13
|
# limitations under the License.
|
14
14
|
|
15
|
-
import json
|
16
15
|
import logging
|
17
16
|
import re
|
18
17
|
import shutil
|
@@ -228,40 +227,18 @@ def prompt_for_repository_details(
|
|
228
227
|
repo_url = click.prompt(
|
229
228
|
"Enter existing repository URL (e.g., https://github.com/owner/repo)"
|
230
229
|
)
|
231
|
-
# Extract owner and name from URL
|
232
|
-
match = re.
|
230
|
+
# Extract owner and repo name from URL
|
231
|
+
match = re.search(r"github\.com/([^/]+)/([^/]+)", repo_url)
|
233
232
|
if match:
|
234
233
|
repository_owner = match.group(1)
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
try:
|
239
|
-
result = run_command(
|
240
|
-
[
|
241
|
-
"gh",
|
242
|
-
"repo",
|
243
|
-
"view",
|
244
|
-
f"{repository_owner}/{repository_name}",
|
245
|
-
"--json",
|
246
|
-
"isEmpty",
|
247
|
-
],
|
248
|
-
capture_output=True,
|
249
|
-
)
|
250
|
-
if not json.loads(result.stdout).get("isEmpty", False):
|
251
|
-
if not click.confirm(
|
252
|
-
"Repository is not empty. Are you sure you want to use it?",
|
253
|
-
default=False,
|
254
|
-
):
|
255
|
-
continue
|
256
|
-
break
|
257
|
-
except subprocess.CalledProcessError:
|
258
|
-
console.print(
|
259
|
-
"❌ Repository not found or not accessible",
|
260
|
-
style="bold red",
|
261
|
-
)
|
262
|
-
continue
|
234
|
+
# Remove .git suffix if present
|
235
|
+
repository_name = match.group(2).rstrip(".git")
|
236
|
+
break
|
263
237
|
else:
|
264
|
-
console.print(
|
238
|
+
console.print(
|
239
|
+
"❌ Invalid repository URL format. Please use https://github.com/owner/repo",
|
240
|
+
style="bold red",
|
241
|
+
)
|
265
242
|
|
266
243
|
if repository_name is None or repository_owner is None:
|
267
244
|
raise ValueError("Repository name and owner must be provided")
|
@@ -570,15 +547,12 @@ def setup_cicd(
|
|
570
547
|
|
571
548
|
if git_provider == "github" and detected_mode == "interactive":
|
572
549
|
# First create the repository since we're in interactive mode
|
573
|
-
|
550
|
+
if not repository_exists:
|
551
|
+
create_github_repository(repository_owner, repository_name)
|
574
552
|
|
575
553
|
# Then create the connection
|
576
554
|
oauth_token_secret_id, github_app_installation_id = create_github_connection(
|
577
|
-
project_id=cicd_project,
|
578
|
-
region=region,
|
579
|
-
connection_name=host_connection_name,
|
580
|
-
repository_name=repository_name,
|
581
|
-
repository_owner=repository_owner,
|
555
|
+
project_id=cicd_project, region=region, connection_name=host_connection_name
|
582
556
|
)
|
583
557
|
repository_exists = True
|
584
558
|
elif git_provider == "github" and detected_mode == "programmatic":
|
src/cli/utils/cicd.py
CHANGED
@@ -89,11 +89,7 @@ def setup_repository_name(
|
|
89
89
|
|
90
90
|
|
91
91
|
def create_github_connection(
|
92
|
-
project_id: str,
|
93
|
-
region: str,
|
94
|
-
connection_name: str,
|
95
|
-
repository_name: str,
|
96
|
-
repository_owner: str,
|
92
|
+
project_id: str, region: str, connection_name: str
|
97
93
|
) -> tuple[str, str]:
|
98
94
|
"""Create and verify GitHub connection using gcloud command.
|
99
95
|
|
@@ -101,53 +97,12 @@ def create_github_connection(
|
|
101
97
|
project_id: GCP project ID
|
102
98
|
region: GCP region
|
103
99
|
connection_name: Name for the GitHub connection
|
104
|
-
repository_name: Name of repository to create
|
105
|
-
repository_owner: Owner of repository
|
106
100
|
|
107
101
|
Returns:
|
108
102
|
tuple[str, str]: The OAuth token secret ID and the app installation ID
|
109
103
|
"""
|
110
104
|
console.print("\n🔗 Creating GitHub connection...")
|
111
105
|
|
112
|
-
# Create repository if details provided
|
113
|
-
try:
|
114
|
-
# Check if repo exists
|
115
|
-
result = run_command(
|
116
|
-
[
|
117
|
-
"gh",
|
118
|
-
"repo",
|
119
|
-
"view",
|
120
|
-
f"{repository_owner}/{repository_name}",
|
121
|
-
"--json",
|
122
|
-
"name",
|
123
|
-
],
|
124
|
-
capture_output=True,
|
125
|
-
check=False,
|
126
|
-
)
|
127
|
-
|
128
|
-
if result.returncode != 0:
|
129
|
-
# Repository doesn't exist, create it
|
130
|
-
console.print(
|
131
|
-
f"\n📦 Creating GitHub repository: {repository_owner}/{repository_name}"
|
132
|
-
)
|
133
|
-
run_command(
|
134
|
-
[
|
135
|
-
"gh",
|
136
|
-
"repo",
|
137
|
-
"create",
|
138
|
-
f"{repository_owner}/{repository_name}",
|
139
|
-
"--private",
|
140
|
-
"--description",
|
141
|
-
"Repository created by Terraform",
|
142
|
-
]
|
143
|
-
)
|
144
|
-
console.print("✅ GitHub repository created")
|
145
|
-
else:
|
146
|
-
console.print("✅ Using existing GitHub repository")
|
147
|
-
except subprocess.CalledProcessError as e:
|
148
|
-
console.print(f"❌ Failed to create/check repository: {e!s}", style="bold red")
|
149
|
-
raise
|
150
|
-
|
151
106
|
def try_create_connection() -> subprocess.CompletedProcess[str]:
|
152
107
|
cmd = [
|
153
108
|
"gcloud",
|
File without changes
|
File without changes
|
File without changes
|