agent-starter-pack 0.4.0__py3-none-any.whl → 0.4.1__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.1.dist-info}/METADATA +1 -1
- {agent_starter_pack-0.4.0.dist-info → agent_starter_pack-0.4.1.dist-info}/RECORD +8 -8
- 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
- {agent_starter_pack-0.4.0.dist-info → agent_starter_pack-0.4.1.dist-info}/WHEEL +0 -0
- {agent_starter_pack-0.4.0.dist-info → agent_starter_pack-0.4.1.dist-info}/entry_points.txt +0 -0
- {agent_starter_pack-0.4.0.dist-info → agent_starter_pack-0.4.1.dist-info}/licenses/LICENSE +0 -0
@@ -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
|
@@ -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.1.dist-info/METADATA,sha256=PNCwLDsh82UgVEY2jQqKdW2K_p-hhIxo4IOu3Ra-nM8,9991
|
173
|
+
agent_starter_pack-0.4.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
174
|
+
agent_starter_pack-0.4.1.dist-info/entry_points.txt,sha256=U7uCxR7YulIhZ0L8R8Hui0Bsy6J7oyESBeDYJYMrQjA,56
|
175
|
+
agent_starter_pack-0.4.1.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
176
|
+
agent_starter_pack-0.4.1.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
|
|
File without changes
|
File without changes
|
File without changes
|