agent-starter-pack 0.15.2__py3-none-any.whl → 0.15.4__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.
Potentially problematic release.
This version of agent-starter-pack might be problematic. Click here for more details.
- {agent_starter_pack-0.15.2.dist-info → agent_starter_pack-0.15.4.dist-info}/METADATA +1 -1
- {agent_starter_pack-0.15.2.dist-info → agent_starter_pack-0.15.4.dist-info}/RECORD +9 -8
- src/cli/commands/create.py +19 -9
- src/cli/main.py +4 -2
- src/deployment_targets/agent_engine/{{cookiecutter.agent_directory}}/agent_engine_app.py +86 -96
- src/deployment_targets/agent_engine/{{cookiecutter.agent_directory}}/utils/deployment.py +85 -0
- {agent_starter_pack-0.15.2.dist-info → agent_starter_pack-0.15.4.dist-info}/WHEEL +0 -0
- {agent_starter_pack-0.15.2.dist-info → agent_starter_pack-0.15.4.dist-info}/entry_points.txt +0 -0
- {agent_starter_pack-0.15.2.dist-info → agent_starter_pack-0.15.4.dist-info}/licenses/LICENSE +0 -0
|
@@ -71,8 +71,8 @@ src/base_template/{% if cookiecutter.cicd_runner == 'google_cloud_build' %}.clou
|
|
|
71
71
|
src/base_template/{{cookiecutter.agent_directory}}/utils/gcs.py,sha256=jKblaWOGQEigw3esaawcfX178shhZi2Fyk0fJSA4T68,1501
|
|
72
72
|
src/base_template/{{cookiecutter.agent_directory}}/utils/tracing.py,sha256=2rv1Ukh2jTBENDwoghCItJ28l-Sjz9gMlzdojlVgJa4,6052
|
|
73
73
|
src/base_template/{{cookiecutter.agent_directory}}/utils/typing.py,sha256=DP5OZC3IGvqA1XbvWt8kI3gyAK3ZjzUSL5Ca17wNeLI,4249
|
|
74
|
-
src/cli/main.py,sha256=
|
|
75
|
-
src/cli/commands/create.py,sha256=
|
|
74
|
+
src/cli/main.py,sha256=aSD5x_r3yMqnI1Bp_HUsgpzJ7QdQNgR06TOVixVv1kU,1954
|
|
75
|
+
src/cli/commands/create.py,sha256=ceUJyzdUN-h-0-7jw6gSSgQWFNXmcsDS47C7Lt8yEew,47385
|
|
76
76
|
src/cli/commands/enhance.py,sha256=AF58CFikNLPib8PULKkzM6r9JGXkTvRWspBaEvGnR3k,24237
|
|
77
77
|
src/cli/commands/list.py,sha256=ZGol9eYB9Yon7JysMUCtpEOwdXzrApdTHzErx6KvT04,6856
|
|
78
78
|
src/cli/commands/setup_cicd.py,sha256=3BtHChOPvp0I-4tlPqwz5hZFm13gtw9gvlWQwF-F7oE,32492
|
|
@@ -97,7 +97,8 @@ src/deployment_targets/agent_engine/tests/integration/test_agent_engine_app.py,s
|
|
|
97
97
|
src/deployment_targets/agent_engine/tests/load_test/README.md,sha256=aQP7nDAqd2jKBET4noI39HC9PVHpgpned7cxucWpVJo,1302
|
|
98
98
|
src/deployment_targets/agent_engine/tests/load_test/load_test.py,sha256=VbQjm8uR8JsdJe3upO1eUIz5SZR7IQsHYyJy88cAjy0,4516
|
|
99
99
|
src/deployment_targets/agent_engine/tests/load_test/.results/.placeholder,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
100
|
-
src/deployment_targets/agent_engine/{{cookiecutter.agent_directory}}/agent_engine_app.py,sha256=
|
|
100
|
+
src/deployment_targets/agent_engine/{{cookiecutter.agent_directory}}/agent_engine_app.py,sha256=a5QPypiAn_yJxTAEJLQwpbqJRzhP3vk21IoeIZvC0VI,12437
|
|
101
|
+
src/deployment_targets/agent_engine/{{cookiecutter.agent_directory}}/utils/deployment.py,sha256=AY7awaGuFjri4Ha6M2IrPwpl1b1V7RTlJ_4uZ_zpfTo,2833
|
|
101
102
|
src/deployment_targets/cloud_run/Dockerfile,sha256=rSpmFK7uJhZYwYMtxH8W7mywcCPvaoFn7gL_mXRYuF8,1449
|
|
102
103
|
src/deployment_targets/cloud_run/deployment/terraform/service.tf,sha256=09F6jkkMtoQlbQNdzJl8OZs-ZlfmzZmgCaUFvniJnlQ,11146
|
|
103
104
|
src/deployment_targets/cloud_run/deployment/terraform/dev/service.tf,sha256=l6fG-kMyYOOrRwnsUys_Vq46-76bMiRyXzHYkVD2XFM,6993
|
|
@@ -168,8 +169,8 @@ src/resources/locks/uv-live_api-cloud_run.lock,sha256=jrcrlnpJfJ6MIyEz1Z7qS_nxy0
|
|
|
168
169
|
src/utils/generate_locks.py,sha256=6V1B8V2BEuevWnXUsxZVTrLjXwFRII8UfsIGrQqZxVs,4320
|
|
169
170
|
src/utils/lock_utils.py,sha256=IFOMUWtb-ypm2Y8w8J5y2oI_-MaPuwPF_JOAAlnNudA,2275
|
|
170
171
|
src/utils/watch_and_rebuild.py,sha256=vP4yIiA7E_lj5sfQdJUl8TXas6V7msDg8XWUutAC05Q,6679
|
|
171
|
-
agent_starter_pack-0.15.
|
|
172
|
-
agent_starter_pack-0.15.
|
|
173
|
-
agent_starter_pack-0.15.
|
|
174
|
-
agent_starter_pack-0.15.
|
|
175
|
-
agent_starter_pack-0.15.
|
|
172
|
+
agent_starter_pack-0.15.4.dist-info/METADATA,sha256=oy_pKDCsfQynZ1vnr9LvdqmyOI8QE0DqvWsTOu3Trnw,11482
|
|
173
|
+
agent_starter_pack-0.15.4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
174
|
+
agent_starter_pack-0.15.4.dist-info/entry_points.txt,sha256=U7uCxR7YulIhZ0L8R8Hui0Bsy6J7oyESBeDYJYMrQjA,56
|
|
175
|
+
agent_starter_pack-0.15.4.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
176
|
+
agent_starter_pack-0.15.4.dist-info/RECORD,,
|
src/cli/commands/create.py
CHANGED
|
@@ -630,12 +630,13 @@ def create(
|
|
|
630
630
|
# CI/CD runner selection
|
|
631
631
|
final_cicd_runner = cicd_runner
|
|
632
632
|
if not final_cicd_runner:
|
|
633
|
-
if auto_approve:
|
|
633
|
+
if auto_approve or agent_garden:
|
|
634
634
|
final_cicd_runner = "google_cloud_build"
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
635
|
+
if not agent_garden:
|
|
636
|
+
console.print(
|
|
637
|
+
"Info: --cicd-runner not specified. Defaulting to 'google_cloud_build' in auto-approve mode.",
|
|
638
|
+
style="yellow",
|
|
639
|
+
)
|
|
639
640
|
else:
|
|
640
641
|
final_cicd_runner = prompt_cicd_runner_selection()
|
|
641
642
|
if debug:
|
|
@@ -646,7 +647,13 @@ def create(
|
|
|
646
647
|
not auto_approve
|
|
647
648
|
and ctx.get_parameter_source("region") != ParameterSource.COMMANDLINE
|
|
648
649
|
):
|
|
649
|
-
|
|
650
|
+
# Show Agent Engine supported regions link if agent_garden flag is set
|
|
651
|
+
if agent_garden:
|
|
652
|
+
console.print(
|
|
653
|
+
"\n📍 [blue]Agent Engine Supported Regions:[/blue]\n"
|
|
654
|
+
" [cyan]https://cloud.google.com/vertex-ai/generative-ai/docs/agent-engine/overview#supported-regions[/cyan]"
|
|
655
|
+
)
|
|
656
|
+
region = prompt_region_confirmation(region, agent_garden=agent_garden)
|
|
650
657
|
if debug:
|
|
651
658
|
logging.debug(f"Selected region: {region}")
|
|
652
659
|
|
|
@@ -777,7 +784,9 @@ def create(
|
|
|
777
784
|
raise
|
|
778
785
|
|
|
779
786
|
|
|
780
|
-
def prompt_region_confirmation(
|
|
787
|
+
def prompt_region_confirmation(
|
|
788
|
+
default_region: str = "us-central1", agent_garden: bool = False
|
|
789
|
+
) -> str:
|
|
781
790
|
"""Prompt user to confirm or change the default region."""
|
|
782
791
|
new_region = Prompt.ask(
|
|
783
792
|
"\nEnter desired GCP region (Gemini uses global endpoint by default)",
|
|
@@ -965,7 +974,8 @@ def setup_gcp_environment(
|
|
|
965
974
|
logging.debug("Verifying GCP credentials...")
|
|
966
975
|
creds_info = verify_credentials()
|
|
967
976
|
# Handle credential verification and project selection
|
|
968
|
-
if
|
|
977
|
+
# Skip interactive prompts if auto_approve or agent_garden is set
|
|
978
|
+
if not auto_approve and not agent_garden:
|
|
969
979
|
creds_info = _handle_credential_verification(creds_info)
|
|
970
980
|
# If user chose to skip verification, don't test Vertex AI connection
|
|
971
981
|
if creds_info.get("skip_vertex_test", False):
|
|
@@ -976,7 +986,7 @@ def setup_gcp_environment(
|
|
|
976
986
|
creds_info["project"], region, agent_garden=agent_garden
|
|
977
987
|
)
|
|
978
988
|
else:
|
|
979
|
-
# Even with auto_approve, we should still set the GCP project
|
|
989
|
+
# Even with auto_approve or agent_garden, we should still set the GCP project
|
|
980
990
|
set_gcp_project(creds_info["project"], set_quota_project=True)
|
|
981
991
|
# Test Vertex AI connection
|
|
982
992
|
_test_vertex_ai_connection(
|
src/cli/main.py
CHANGED
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
# limitations under the License.
|
|
14
14
|
|
|
15
15
|
import importlib.metadata
|
|
16
|
+
import sys
|
|
16
17
|
|
|
17
18
|
import click
|
|
18
19
|
from rich.console import Console
|
|
@@ -48,8 +49,9 @@ def print_version(ctx: click.Context, param: click.Parameter, value: bool) -> No
|
|
|
48
49
|
help="Show the version and exit.",
|
|
49
50
|
)
|
|
50
51
|
def cli() -> None:
|
|
51
|
-
# Check for updates at startup
|
|
52
|
-
|
|
52
|
+
# Check for updates at startup (skip if --agent-garden or -ag is used)
|
|
53
|
+
if "--agent-garden" not in sys.argv and "-ag" not in sys.argv:
|
|
54
|
+
display_update_message()
|
|
53
55
|
|
|
54
56
|
|
|
55
57
|
# Register commands
|
|
@@ -14,12 +14,11 @@
|
|
|
14
14
|
|
|
15
15
|
# mypy: disable-error-code="attr-defined,arg-type"
|
|
16
16
|
{%- if "adk" in cookiecutter.tags %}
|
|
17
|
-
import datetime
|
|
18
|
-
import json
|
|
19
17
|
import logging
|
|
20
18
|
import os
|
|
21
19
|
from typing import Any
|
|
22
20
|
|
|
21
|
+
import click
|
|
23
22
|
import google.auth
|
|
24
23
|
import vertexai
|
|
25
24
|
from google.adk.artifacts import GcsArtifactService
|
|
@@ -30,6 +29,11 @@ from vertexai._genai.types import AgentEngine, AgentEngineConfig
|
|
|
30
29
|
from vertexai.agent_engines.templates.adk import AdkApp
|
|
31
30
|
|
|
32
31
|
from {{cookiecutter.agent_directory}}.agent import root_agent
|
|
32
|
+
from {{cookiecutter.agent_directory}}.utils.deployment import (
|
|
33
|
+
parse_env_vars,
|
|
34
|
+
print_deployment_success,
|
|
35
|
+
write_deployment_metadata,
|
|
36
|
+
)
|
|
33
37
|
from {{cookiecutter.agent_directory}}.utils.gcs import create_bucket_if_not_exists
|
|
34
38
|
from {{cookiecutter.agent_directory}}.utils.tracing import CloudTraceLoggingSpanExporter
|
|
35
39
|
from {{cookiecutter.agent_directory}}.utils.typing import Feedback
|
|
@@ -68,8 +72,6 @@ class AgentEngineApp(AdkApp):
|
|
|
68
72
|
return operations
|
|
69
73
|
|
|
70
74
|
{%- else %}
|
|
71
|
-
import datetime
|
|
72
|
-
import json
|
|
73
75
|
import logging
|
|
74
76
|
import os
|
|
75
77
|
from collections.abc import Iterable, Mapping
|
|
@@ -77,6 +79,7 @@ from typing import (
|
|
|
77
79
|
Any,
|
|
78
80
|
)
|
|
79
81
|
|
|
82
|
+
import click
|
|
80
83
|
import google.auth
|
|
81
84
|
import vertexai
|
|
82
85
|
from google.cloud import logging as google_cloud_logging
|
|
@@ -84,6 +87,11 @@ from langchain_core.runnables import RunnableConfig
|
|
|
84
87
|
from traceloop.sdk import Instruments, Traceloop
|
|
85
88
|
from vertexai._genai.types import AgentEngine, AgentEngineConfig
|
|
86
89
|
|
|
90
|
+
from {{cookiecutter.agent_directory}}.utils.deployment import (
|
|
91
|
+
parse_env_vars,
|
|
92
|
+
print_deployment_success,
|
|
93
|
+
write_deployment_metadata,
|
|
94
|
+
)
|
|
87
95
|
from {{cookiecutter.agent_directory}}.utils.gcs import create_bucket_if_not_exists
|
|
88
96
|
from {{cookiecutter.agent_directory}}.utils.tracing import CloudTraceLoggingSpanExporter
|
|
89
97
|
from {{cookiecutter.agent_directory}}.utils.typing import Feedback, InputChat, dumpd, ensure_valid_config
|
|
@@ -190,17 +198,69 @@ class AgentEngineApp:
|
|
|
190
198
|
{%- endif %}
|
|
191
199
|
|
|
192
200
|
|
|
201
|
+
@click.command()
|
|
202
|
+
@click.option(
|
|
203
|
+
"--project",
|
|
204
|
+
default=None,
|
|
205
|
+
help="GCP project ID (defaults to application default credentials)",
|
|
206
|
+
)
|
|
207
|
+
@click.option(
|
|
208
|
+
"--location",
|
|
209
|
+
default="us-central1",
|
|
210
|
+
help="GCP region (defaults to us-central1)",
|
|
211
|
+
)
|
|
212
|
+
@click.option(
|
|
213
|
+
"--agent-name",
|
|
214
|
+
default="{{cookiecutter.project_name}}",
|
|
215
|
+
help="Name for the agent engine",
|
|
216
|
+
)
|
|
217
|
+
@click.option(
|
|
218
|
+
"--requirements-file",
|
|
219
|
+
default=".requirements.txt",
|
|
220
|
+
help="Path to requirements.txt file",
|
|
221
|
+
)
|
|
222
|
+
@click.option(
|
|
223
|
+
"--extra-packages",
|
|
224
|
+
multiple=True,
|
|
225
|
+
default=["./{{cookiecutter.agent_directory}}"],
|
|
226
|
+
help="Additional packages to include",
|
|
227
|
+
)
|
|
228
|
+
@click.option(
|
|
229
|
+
"--set-env-vars",
|
|
230
|
+
default=None,
|
|
231
|
+
help="Comma-separated list of environment variables in KEY=VALUE format",
|
|
232
|
+
)
|
|
233
|
+
@click.option(
|
|
234
|
+
"--service-account",
|
|
235
|
+
default=None,
|
|
236
|
+
help="Service account email to use for the agent engine",
|
|
237
|
+
)
|
|
193
238
|
def deploy_agent_engine_app(
|
|
194
|
-
project: str,
|
|
239
|
+
project: str | None,
|
|
195
240
|
location: str,
|
|
196
|
-
agent_name: str
|
|
197
|
-
requirements_file: str
|
|
198
|
-
extra_packages:
|
|
199
|
-
|
|
200
|
-
service_account: str | None
|
|
241
|
+
agent_name: str,
|
|
242
|
+
requirements_file: str,
|
|
243
|
+
extra_packages: tuple[str, ...],
|
|
244
|
+
set_env_vars: str | None,
|
|
245
|
+
service_account: str | None,
|
|
201
246
|
) -> AgentEngine:
|
|
202
247
|
"""Deploy the agent engine app to Vertex AI."""
|
|
248
|
+
# Parse environment variables if provided
|
|
249
|
+
env_vars = parse_env_vars(set_env_vars)
|
|
250
|
+
|
|
251
|
+
if not project:
|
|
252
|
+
_, project = google.auth.default()
|
|
253
|
+
|
|
254
|
+
print("""
|
|
255
|
+
╔═══════════════════════════════════════════════════════════╗
|
|
256
|
+
║ ║
|
|
257
|
+
║ 🤖 DEPLOYING AGENT TO VERTEX AI AGENT ENGINE 🤖 ║
|
|
258
|
+
║ ║
|
|
259
|
+
╚═══════════════════════════════════════════════════════════╝
|
|
260
|
+
""")
|
|
261
|
+
|
|
203
262
|
logging.basicConfig(level=logging.INFO)
|
|
263
|
+
extra_packages_list = list(extra_packages)
|
|
204
264
|
staging_bucket_uri = f"gs://{project}-agent-engine"
|
|
205
265
|
{%- if "adk" in cookiecutter.tags %}
|
|
206
266
|
artifacts_bucket_name = f"{project}-{{cookiecutter.project_name}}-logs-data"
|
|
@@ -236,14 +296,24 @@ def deploy_agent_engine_app(
|
|
|
236
296
|
env_vars["NUM_WORKERS"] = "1"
|
|
237
297
|
|
|
238
298
|
# Common configuration for both create and update operations
|
|
299
|
+
labels: dict[str, str] = {}
|
|
300
|
+
{%- if cookiecutter.agent_garden %}
|
|
301
|
+
labels["deployed-with"] = "agent-garden"
|
|
302
|
+
{%- if cookiecutter.agent_sample_id and cookiecutter.agent_sample_publisher %}
|
|
303
|
+
labels["vertex-agent-sample-id"] = "{{cookiecutter.agent_sample_id}}"
|
|
304
|
+
labels["vertex-agent-sample-publisher"] = "{{cookiecutter.agent_sample_publisher}}"
|
|
305
|
+
{%- endif %}
|
|
306
|
+
{%- endif %}
|
|
307
|
+
|
|
239
308
|
config = AgentEngineConfig(
|
|
240
309
|
display_name=agent_name,
|
|
241
310
|
description="{{cookiecutter.agent_description}}",
|
|
242
|
-
extra_packages=
|
|
311
|
+
extra_packages=extra_packages_list,
|
|
243
312
|
env_vars=env_vars,
|
|
244
313
|
service_account=service_account,
|
|
245
314
|
requirements=requirements,
|
|
246
315
|
staging_bucket=staging_bucket_uri,
|
|
316
|
+
labels=labels,
|
|
247
317
|
)
|
|
248
318
|
|
|
249
319
|
agent_config = {
|
|
@@ -262,100 +332,20 @@ def deploy_agent_engine_app(
|
|
|
262
332
|
|
|
263
333
|
if matching_agents:
|
|
264
334
|
# Update the existing agent with new configuration
|
|
265
|
-
logging.info(f"Updating existing agent: {agent_name}")
|
|
335
|
+
logging.info(f"\n📝 Updating existing agent: {agent_name}")
|
|
266
336
|
remote_agent = client.agent_engines.update(
|
|
267
337
|
name=matching_agents[0].api_resource.name, **agent_config
|
|
268
338
|
)
|
|
269
339
|
else:
|
|
270
340
|
# Create a new agent if none exists
|
|
271
|
-
logging.info(f"Creating new agent: {agent_name}")
|
|
341
|
+
logging.info(f"\n🚀 Creating new agent: {agent_name}")
|
|
272
342
|
remote_agent = client.agent_engines.create(**agent_config)
|
|
273
343
|
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
"deployment_timestamp": datetime.datetime.now().isoformat(),
|
|
277
|
-
}
|
|
278
|
-
metadata_file = "deployment_metadata.json"
|
|
279
|
-
|
|
280
|
-
with open(metadata_file, "w") as f:
|
|
281
|
-
json.dump(metadata, f, indent=2)
|
|
282
|
-
|
|
283
|
-
logging.info(f"Agent Engine ID written to {metadata_file}")
|
|
284
|
-
|
|
285
|
-
{%- if "adk" in cookiecutter.tags %}
|
|
286
|
-
print(
|
|
287
|
-
"\n✅ Deployment successful! Test your agent: notebooks/adk_app_testing.ipynb\n"
|
|
288
|
-
)
|
|
289
|
-
{%- endif %}
|
|
344
|
+
write_deployment_metadata(remote_agent)
|
|
345
|
+
print_deployment_success(remote_agent, location, project)
|
|
290
346
|
|
|
291
347
|
return remote_agent
|
|
292
348
|
|
|
293
349
|
|
|
294
350
|
if __name__ == "__main__":
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
parser = argparse.ArgumentParser(description="Deploy agent engine app to Vertex AI")
|
|
298
|
-
parser.add_argument(
|
|
299
|
-
"--project",
|
|
300
|
-
default=None,
|
|
301
|
-
help="GCP project ID (defaults to application default credentials)",
|
|
302
|
-
)
|
|
303
|
-
parser.add_argument(
|
|
304
|
-
"--location",
|
|
305
|
-
default="us-central1",
|
|
306
|
-
help="GCP region (defaults to us-central1)",
|
|
307
|
-
)
|
|
308
|
-
parser.add_argument(
|
|
309
|
-
"--agent-name",
|
|
310
|
-
default="{{cookiecutter.project_name}}",
|
|
311
|
-
help="Name for the agent engine",
|
|
312
|
-
)
|
|
313
|
-
parser.add_argument(
|
|
314
|
-
"--requirements-file",
|
|
315
|
-
default=".requirements.txt",
|
|
316
|
-
help="Path to requirements.txt file",
|
|
317
|
-
)
|
|
318
|
-
parser.add_argument(
|
|
319
|
-
"--extra-packages",
|
|
320
|
-
nargs="+",
|
|
321
|
-
default=["./{{cookiecutter.agent_directory}}"],
|
|
322
|
-
help="Additional packages to include",
|
|
323
|
-
)
|
|
324
|
-
parser.add_argument(
|
|
325
|
-
"--set-env-vars",
|
|
326
|
-
help="Comma-separated list of environment variables in KEY=VALUE format",
|
|
327
|
-
)
|
|
328
|
-
parser.add_argument(
|
|
329
|
-
"--service-account",
|
|
330
|
-
default=None,
|
|
331
|
-
help="Service account email to use for the agent engine",
|
|
332
|
-
)
|
|
333
|
-
args = parser.parse_args()
|
|
334
|
-
|
|
335
|
-
# Parse environment variables if provided
|
|
336
|
-
env_vars = {}
|
|
337
|
-
if args.set_env_vars:
|
|
338
|
-
for pair in args.set_env_vars.split(","):
|
|
339
|
-
key, value = pair.split("=", 1)
|
|
340
|
-
env_vars[key] = value
|
|
341
|
-
|
|
342
|
-
if not args.project:
|
|
343
|
-
_, args.project = google.auth.default()
|
|
344
|
-
|
|
345
|
-
print("""
|
|
346
|
-
╔═══════════════════════════════════════════════════════════╗
|
|
347
|
-
║ ║
|
|
348
|
-
║ 🤖 DEPLOYING AGENT TO VERTEX AI AGENT ENGINE 🤖 ║
|
|
349
|
-
║ ║
|
|
350
|
-
╚═══════════════════════════════════════════════════════════╝
|
|
351
|
-
""")
|
|
352
|
-
|
|
353
|
-
deploy_agent_engine_app(
|
|
354
|
-
project=args.project,
|
|
355
|
-
location=args.location,
|
|
356
|
-
agent_name=args.agent_name,
|
|
357
|
-
requirements_file=args.requirements_file,
|
|
358
|
-
extra_packages=args.extra_packages,
|
|
359
|
-
env_vars=env_vars,
|
|
360
|
-
service_account=args.service_account,
|
|
361
|
-
)
|
|
351
|
+
deploy_agent_engine_app()
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# Copyright 2025 Google LLC
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
import datetime
|
|
16
|
+
import json
|
|
17
|
+
import logging
|
|
18
|
+
from typing import Any
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def parse_env_vars(env_vars_string: str | None) -> dict[str, str]:
|
|
22
|
+
"""Parse environment variables from a comma-separated KEY=VALUE string.
|
|
23
|
+
|
|
24
|
+
Args:
|
|
25
|
+
env_vars_string: Comma-separated list of environment variables in KEY=VALUE format
|
|
26
|
+
|
|
27
|
+
Returns:
|
|
28
|
+
Dictionary of environment variables with keys and values stripped of whitespace
|
|
29
|
+
"""
|
|
30
|
+
env_vars = {}
|
|
31
|
+
if env_vars_string:
|
|
32
|
+
for pair in env_vars_string.split(","):
|
|
33
|
+
if "=" in pair:
|
|
34
|
+
key, value = pair.split("=", 1)
|
|
35
|
+
env_vars[key.strip()] = value.strip()
|
|
36
|
+
else:
|
|
37
|
+
logging.warning(f"Skipping malformed environment variable pair: {pair}")
|
|
38
|
+
return env_vars
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def write_deployment_metadata(
|
|
42
|
+
remote_agent: Any,
|
|
43
|
+
metadata_file: str = "deployment_metadata.json",
|
|
44
|
+
) -> None:
|
|
45
|
+
"""Write deployment metadata to file.
|
|
46
|
+
|
|
47
|
+
Args:
|
|
48
|
+
remote_agent: The deployed agent engine resource
|
|
49
|
+
metadata_file: Path to write the metadata JSON file
|
|
50
|
+
"""
|
|
51
|
+
metadata = {
|
|
52
|
+
"remote_agent_engine_id": remote_agent.api_resource.name,
|
|
53
|
+
"deployment_timestamp": datetime.datetime.now().isoformat(),
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
with open(metadata_file, "w") as f:
|
|
57
|
+
json.dump(metadata, f, indent=2)
|
|
58
|
+
|
|
59
|
+
logging.info(f"Agent Engine ID written to {metadata_file}")
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def print_deployment_success(
|
|
63
|
+
remote_agent: Any,
|
|
64
|
+
location: str,
|
|
65
|
+
project: str,
|
|
66
|
+
) -> None:
|
|
67
|
+
"""Print deployment success message with console URL.
|
|
68
|
+
|
|
69
|
+
Args:
|
|
70
|
+
remote_agent: The deployed agent engine resource
|
|
71
|
+
location: GCP region where the agent was deployed
|
|
72
|
+
project: GCP project ID
|
|
73
|
+
"""
|
|
74
|
+
# Extract agent engine ID for console URL
|
|
75
|
+
agent_engine_id = remote_agent.api_resource.name.split("/")[-1]
|
|
76
|
+
console_url = f"https://console.cloud.google.com/vertex-ai/agents/locations/{location}/agent-engines/{agent_engine_id}?project={project}"
|
|
77
|
+
|
|
78
|
+
{%- if "adk" in cookiecutter.tags %}
|
|
79
|
+
print(
|
|
80
|
+
f"\n✅ Deployment successful! Test your agent: notebooks/adk_app_testing.ipynb"
|
|
81
|
+
f"\n📊 View in console: {console_url}\n"
|
|
82
|
+
)
|
|
83
|
+
{%- else %}
|
|
84
|
+
print(f"\n✅ Deployment successful!\n📊 View in console: {console_url}\n")
|
|
85
|
+
{%- endif %}
|
|
File without changes
|
{agent_starter_pack-0.15.2.dist-info → agent_starter_pack-0.15.4.dist-info}/entry_points.txt
RENAMED
|
File without changes
|
{agent_starter_pack-0.15.2.dist-info → agent_starter_pack-0.15.4.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|