agent-starter-pack 0.3.3__py3-none-any.whl → 0.21.0__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/agents/README.md +7 -0
- agents/langgraph_base_react/template/.templateconfig.yaml → agent_starter_pack/agents/adk_a2a_base/.template/templateconfig.yaml +5 -10
- agent_starter_pack/agents/adk_a2a_base/README.md +37 -0
- src/deployment_targets/cloud_run/Dockerfile → agent_starter_pack/agents/adk_a2a_base/app/__init__.py +2 -14
- agent_starter_pack/agents/adk_a2a_base/app/agent.py +70 -0
- agent_starter_pack/agents/adk_a2a_base/notebooks/adk_a2a_app_testing.ipynb +583 -0
- agents/crewai_coding_crew/notebooks/evaluating_crewai_agent.ipynb → agent_starter_pack/agents/adk_a2a_base/notebooks/evaluating_adk_agent.ipynb +163 -199
- {agents/adk_base → agent_starter_pack/agents/adk_a2a_base}/tests/integration/test_agent.py +2 -2
- agents/adk_base/template/.templateconfig.yaml → agent_starter_pack/agents/adk_base/.template/templateconfig.yaml +4 -1
- {agents → agent_starter_pack/agents}/adk_base/README.md +1 -1
- agent_starter_pack/agents/adk_base/app/__init__.py +17 -0
- {agents → agent_starter_pack/agents}/adk_base/app/agent.py +5 -2
- {agents → agent_starter_pack/agents}/adk_base/notebooks/adk_app_testing.ipynb +128 -82
- agents/langgraph_base_react/notebooks/evaluating_langgraph_agent.ipynb → agent_starter_pack/agents/adk_base/notebooks/evaluating_adk_agent.ipynb +181 -207
- agent_starter_pack/agents/adk_base/tests/integration/test_agent.py +58 -0
- agents/crewai_coding_crew/template/.templateconfig.yaml → agent_starter_pack/agents/adk_live/.template/templateconfig.yaml +5 -9
- agent_starter_pack/agents/adk_live/README.md +32 -0
- agent_starter_pack/agents/adk_live/app/__init__.py +17 -0
- agent_starter_pack/agents/adk_live/app/agent.py +51 -0
- agent_starter_pack/agents/adk_live/tests/unit/test_dummy.py +38 -0
- agents/agentic_rag/template/.templateconfig.yaml → agent_starter_pack/agents/agentic_rag/.template/templateconfig.yaml +7 -3
- {agents → agent_starter_pack/agents}/agentic_rag/README.md +1 -1
- agent_starter_pack/agents/agentic_rag/app/__init__.py +17 -0
- {agents → agent_starter_pack/agents}/agentic_rag/app/agent.py +8 -4
- {agents → agent_starter_pack/agents}/agentic_rag/notebooks/adk_app_testing.ipynb +128 -82
- agent_starter_pack/agents/agentic_rag/notebooks/evaluating_adk_agent.ipynb +1535 -0
- {agents → agent_starter_pack/agents}/agentic_rag/tests/integration/test_agent.py +3 -3
- agent_starter_pack/agents/langgraph_base/.template/templateconfig.yaml +31 -0
- agent_starter_pack/agents/langgraph_base/README.md +30 -0
- agent_starter_pack/agents/langgraph_base/app/__init__.py +17 -0
- agent_starter_pack/agents/langgraph_base/app/agent.py +34 -0
- {agents/crewai_coding_crew → agent_starter_pack/agents/langgraph_base}/notebooks/evaluating_langgraph_agent.ipynb +30 -17
- {agents/langgraph_base_react → agent_starter_pack/agents/langgraph_base}/tests/integration/test_agent.py +2 -2
- {src → agent_starter_pack}/base_template/.gitignore +5 -3
- agent_starter_pack/base_template/GEMINI.md +5 -0
- agent_starter_pack/base_template/Makefile +339 -0
- agent_starter_pack/base_template/README.md +267 -0
- agent_starter_pack/base_template/deployment/README.md +11 -0
- {src → agent_starter_pack}/base_template/deployment/terraform/apis.tf +2 -2
- {src → agent_starter_pack}/base_template/deployment/terraform/dev/apis.tf +6 -1
- {src → agent_starter_pack}/base_template/deployment/terraform/dev/iam.tf +12 -11
- {src → agent_starter_pack}/base_template/deployment/terraform/dev/providers.tf +5 -1
- {src → agent_starter_pack}/base_template/deployment/terraform/dev/storage.tf +1 -1
- {src → agent_starter_pack}/base_template/deployment/terraform/dev/variables.tf +10 -10
- agent_starter_pack/base_template/deployment/terraform/dev/{% if cookiecutter.is_adk %}telemetry.tf{% else %}unused_telemetry.tf{% endif %} +193 -0
- agent_starter_pack/base_template/deployment/terraform/github.tf +337 -0
- {src → agent_starter_pack}/base_template/deployment/terraform/iam.tf +20 -41
- {src → agent_starter_pack}/base_template/deployment/terraform/locals.tf +10 -3
- {src/resources/setup_cicd → agent_starter_pack/base_template/deployment/terraform}/providers.tf +8 -1
- {src → agent_starter_pack}/base_template/deployment/terraform/service_accounts.tf +7 -8
- agent_starter_pack/base_template/deployment/terraform/sql/completions.sql +138 -0
- {src → agent_starter_pack}/base_template/deployment/terraform/storage.tf +7 -16
- {src → agent_starter_pack}/base_template/deployment/terraform/variables.tf +61 -28
- {src → agent_starter_pack}/base_template/deployment/terraform/vars/env.tfvars +6 -1
- agent_starter_pack/base_template/deployment/terraform/{% if cookiecutter.cicd_runner == 'github_actions' %}wif.tf{% else %}unused_wif.tf{% endif %} +43 -0
- src/base_template/deployment/terraform/build_triggers.tf → agent_starter_pack/base_template/deployment/terraform/{% if cookiecutter.cicd_runner == 'google_cloud_build' %}build_triggers.tf{% else %}unused_build_triggers.tf{% endif %} +55 -38
- agent_starter_pack/base_template/deployment/terraform/{% if cookiecutter.is_adk %}telemetry.tf{% else %}unused_telemetry.tf{% endif %} +206 -0
- {src → agent_starter_pack}/base_template/pyproject.toml +24 -37
- agent_starter_pack/base_template/{% if cookiecutter.cicd_runner == 'github_actions' %}.github{% else %}unused_github{% endif %}/workflows/deploy-to-prod.yaml +132 -0
- agent_starter_pack/base_template/{% if cookiecutter.cicd_runner == 'github_actions' %}.github{% else %}unused_github{% endif %}/workflows/pr_checks.yaml +65 -0
- agent_starter_pack/base_template/{% if cookiecutter.cicd_runner == 'github_actions' %}.github{% else %}unused_github{% endif %}/workflows/staging.yaml +259 -0
- src/base_template/deployment/cd/deploy-to-prod.yaml → agent_starter_pack/base_template/{% if cookiecutter.cicd_runner == 'google_cloud_build' %}.cloudbuild{% else %}unused_.cloudbuild{% endif %}/deploy-to-prod.yaml +38 -30
- src/base_template/deployment/ci/pr_checks.yaml → agent_starter_pack/base_template/{% if cookiecutter.cicd_runner == 'google_cloud_build' %}.cloudbuild{% else %}unused_.cloudbuild{% endif %}/pr_checks.yaml +5 -5
- agent_starter_pack/base_template/{% if cookiecutter.cicd_runner == 'google_cloud_build' %}.cloudbuild{% else %}unused_.cloudbuild{% endif %}/staging.yaml +322 -0
- agent_starter_pack/base_template/{{cookiecutter.agent_directory}}/app_utils/telemetry.py +96 -0
- {src/base_template/app/utils → agent_starter_pack/base_template/{{cookiecutter.agent_directory}}/app_utils}/typing.py +7 -9
- agent_starter_pack/base_template/{{cookiecutter.agent_directory}}/app_utils/{% if cookiecutter.is_a2a and cookiecutter.agent_name == 'langgraph_base' %}converters{% else %}unused_converters{% endif %}/__init__.py +25 -0
- agent_starter_pack/base_template/{{cookiecutter.agent_directory}}/app_utils/{% if cookiecutter.is_a2a and cookiecutter.agent_name == 'langgraph_base' %}converters{% else %}unused_converters{% endif %}/part_converter.py +138 -0
- agent_starter_pack/base_template/{{cookiecutter.agent_directory}}/app_utils/{% if cookiecutter.is_a2a and cookiecutter.agent_name == 'langgraph_base' %}executor{% else %}unused_executor{% endif %}/__init__.py +13 -0
- agent_starter_pack/base_template/{{cookiecutter.agent_directory}}/app_utils/{% if cookiecutter.is_a2a and cookiecutter.agent_name == 'langgraph_base' %}executor{% else %}unused_executor{% endif %}/a2a_agent_executor.py +265 -0
- agent_starter_pack/base_template/{{cookiecutter.agent_directory}}/app_utils/{% if cookiecutter.is_a2a and cookiecutter.agent_name == 'langgraph_base' %}executor{% else %}unused_executor{% endif %}/task_result_aggregator.py +152 -0
- agent_starter_pack/cli/commands/create.py +1256 -0
- agent_starter_pack/cli/commands/enhance.py +611 -0
- agent_starter_pack/cli/commands/list.py +203 -0
- agent_starter_pack/cli/commands/register_gemini_enterprise.py +1070 -0
- agent_starter_pack/cli/commands/setup_cicd.py +862 -0
- {src → agent_starter_pack}/cli/main.py +10 -2
- {src → agent_starter_pack}/cli/utils/cicd.py +139 -48
- agent_starter_pack/cli/utils/gcp.py +263 -0
- agent_starter_pack/cli/utils/logging.py +103 -0
- agent_starter_pack/cli/utils/remote_template.py +677 -0
- agent_starter_pack/cli/utils/template.py +1466 -0
- {src → agent_starter_pack}/data_ingestion/data_ingestion_pipeline/components/process_data.py +1 -1
- {src → agent_starter_pack}/data_ingestion/data_ingestion_pipeline/submit_pipeline.py +20 -6
- {src → agent_starter_pack}/data_ingestion/pyproject.toml +1 -0
- {src → agent_starter_pack}/data_ingestion/uv.lock +602 -494
- agent_starter_pack/deployment_targets/agent_engine/tests/integration/test_agent_engine_app.py +484 -0
- agent_starter_pack/deployment_targets/agent_engine/tests/load_test/README.md +84 -0
- agent_starter_pack/deployment_targets/agent_engine/tests/load_test/load_test.py +424 -0
- agent_starter_pack/deployment_targets/agent_engine/tests/{% if cookiecutter.is_a2a %}helpers.py{% else %}unused_helpers.py{% endif %} +138 -0
- agent_starter_pack/deployment_targets/agent_engine/{{cookiecutter.agent_directory}}/agent_engine_app.py +263 -0
- agent_starter_pack/deployment_targets/agent_engine/{{cookiecutter.agent_directory}}/app_utils/deploy.py +414 -0
- agent_starter_pack/deployment_targets/agent_engine/{{cookiecutter.agent_directory}}/app_utils/{% if cookiecutter.is_adk_live %}expose_app.py{% else %}unused_expose_app.py{% endif %} +519 -0
- agent_starter_pack/deployment_targets/cloud_run/Dockerfile +51 -0
- agent_starter_pack/deployment_targets/cloud_run/deployment/terraform/dev/service.tf +243 -0
- agent_starter_pack/deployment_targets/cloud_run/deployment/terraform/service.tf +417 -0
- agent_starter_pack/deployment_targets/cloud_run/tests/integration/test_server_e2e.py +705 -0
- agent_starter_pack/deployment_targets/cloud_run/tests/load_test/.results/.placeholder +321 -0
- agent_starter_pack/deployment_targets/cloud_run/tests/load_test/README.md +165 -0
- agent_starter_pack/deployment_targets/cloud_run/tests/load_test/load_test.py +329 -0
- agent_starter_pack/deployment_targets/cloud_run/{{cookiecutter.agent_directory}}/fast_api_app.py +556 -0
- {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/package-lock.json +79 -1044
- {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/package.json +1 -9
- agent_starter_pack/frontends/adk_live_react/frontend/src/App.tsx +65 -0
- {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/src/components/logger/Logger.tsx +8 -3
- {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/src/components/logger/logger.scss +26 -0
- agent_starter_pack/frontends/adk_live_react/frontend/src/components/side-panel/SidePanel.tsx +516 -0
- agent_starter_pack/frontends/adk_live_react/frontend/src/components/side-panel/side-panel.scss +563 -0
- agent_starter_pack/frontends/adk_live_react/frontend/src/components/transcription-preview/TranscriptionPreview.tsx +106 -0
- agent_starter_pack/frontends/adk_live_react/frontend/src/components/transcription-preview/transcription-preview.scss +150 -0
- {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/src/hooks/use-live-api.ts +8 -2
- {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/src/multimodal-live-types.ts +40 -2
- {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/src/utils/audio-recorder.ts +1 -1
- {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/src/utils/audio-streamer.ts +1 -1
- {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/src/utils/multimodal-live-client.ts +210 -24
- {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/src/utils/utils.ts +27 -5
- agent_starter_pack/resources/docs/adk-cheatsheet.md +1628 -0
- agent_starter_pack/resources/locks/uv-adk_a2a_base-agent_engine.lock +4966 -0
- agent_starter_pack/resources/locks/uv-adk_a2a_base-cloud_run.lock +5011 -0
- agent_starter_pack/resources/locks/uv-adk_base-agent_engine.lock +4946 -0
- agent_starter_pack/resources/locks/uv-adk_base-cloud_run.lock +4991 -0
- agent_starter_pack/resources/locks/uv-adk_live-agent_engine.lock +4963 -0
- agent_starter_pack/resources/locks/uv-adk_live-cloud_run.lock +5006 -0
- agent_starter_pack/resources/locks/uv-agentic_rag-agent_engine.lock +5487 -0
- agent_starter_pack/resources/locks/uv-agentic_rag-cloud_run.lock +5532 -0
- agent_starter_pack/resources/locks/uv-langgraph_base-agent_engine.lock +5788 -0
- agent_starter_pack/resources/locks/uv-langgraph_base-cloud_run.lock +5811 -0
- {src → agent_starter_pack}/utils/generate_locks.py +15 -12
- {src → agent_starter_pack}/utils/lock_utils.py +4 -7
- {src → agent_starter_pack}/utils/watch_and_rebuild.py +2 -2
- agent_starter_pack-0.21.0.dist-info/METADATA +182 -0
- agent_starter_pack-0.21.0.dist-info/RECORD +171 -0
- agent_starter_pack-0.21.0.dist-info/entry_points.txt +2 -0
- llm.txt +362 -0
- agent_starter_pack-0.3.3.dist-info/METADATA +0 -164
- agent_starter_pack-0.3.3.dist-info/RECORD +0 -176
- agent_starter_pack-0.3.3.dist-info/entry_points.txt +0 -2
- agents/crewai_coding_crew/README.md +0 -34
- agents/crewai_coding_crew/app/agent.py +0 -86
- agents/crewai_coding_crew/app/crew/config/agents.yaml +0 -39
- agents/crewai_coding_crew/app/crew/config/tasks.yaml +0 -37
- agents/crewai_coding_crew/app/crew/crew.py +0 -71
- agents/crewai_coding_crew/tests/integration/test_agent.py +0 -47
- agents/langgraph_base_react/README.md +0 -9
- agents/langgraph_base_react/app/agent.py +0 -73
- agents/live_api/README.md +0 -37
- agents/live_api/app/agent.py +0 -78
- agents/live_api/app/server.py +0 -196
- agents/live_api/app/templates.py +0 -51
- agents/live_api/app/vector_store.py +0 -55
- agents/live_api/template/.templateconfig.yaml +0 -29
- agents/live_api/tests/integration/test_server_e2e.py +0 -254
- agents/live_api/tests/load_test/load_test.py +0 -40
- agents/live_api/tests/unit/test_server.py +0 -143
- src/base_template/Makefile +0 -72
- src/base_template/README.md +0 -208
- src/base_template/app/__init__.py +0 -3
- src/base_template/app/utils/tracing.py +0 -155
- src/base_template/deployment/README.md +0 -126
- src/base_template/deployment/cd/staging.yaml +0 -216
- src/base_template/deployment/terraform/dev/log_sinks.tf +0 -63
- src/base_template/deployment/terraform/log_sinks.tf +0 -70
- src/base_template/deployment/terraform/providers.tf +0 -37
- src/cli/commands/create.py +0 -664
- src/cli/commands/setup_cicd.py +0 -829
- src/cli/utils/gcp.py +0 -117
- src/cli/utils/logging.py +0 -51
- src/cli/utils/template.py +0 -737
- src/deployment_targets/agent_engine/app/agent_engine_app.py +0 -336
- src/deployment_targets/agent_engine/notebooks/intro_agent_engine.ipynb +0 -1025
- src/deployment_targets/agent_engine/tests/integration/test_agent_engine_app.py +0 -183
- src/deployment_targets/agent_engine/tests/load_test/README.md +0 -42
- src/deployment_targets/agent_engine/tests/load_test/load_test.py +0 -107
- src/deployment_targets/cloud_run/app/server.py +0 -154
- src/deployment_targets/cloud_run/tests/integration/test_server_e2e.py +0 -249
- src/deployment_targets/cloud_run/tests/load_test/.results/.placeholder +0 -0
- src/deployment_targets/cloud_run/tests/load_test/README.md +0 -83
- src/deployment_targets/cloud_run/tests/load_test/load_test.py +0 -118
- src/deployment_targets/cloud_run/uv.lock +0 -6952
- src/frontends/live_api_react/frontend/src/App.tsx +0 -205
- src/frontends/live_api_react/frontend/src/components/control-tray/ControlTray.tsx +0 -217
- src/frontends/live_api_react/frontend/src/components/control-tray/control-tray.scss +0 -201
- src/frontends/live_api_react/frontend/src/components/side-panel/SidePanel.tsx +0 -161
- src/frontends/live_api_react/frontend/src/components/side-panel/side-panel.scss +0 -285
- src/frontends/streamlit/frontend/side_bar.py +0 -214
- src/frontends/streamlit/frontend/streamlit_app.py +0 -265
- src/frontends/streamlit/frontend/style/app_markdown.py +0 -37
- src/frontends/streamlit/frontend/utils/chat_utils.py +0 -67
- src/frontends/streamlit/frontend/utils/local_chat_history.py +0 -125
- src/frontends/streamlit/frontend/utils/message_editing.py +0 -59
- src/frontends/streamlit/frontend/utils/multimodal_utils.py +0 -217
- src/frontends/streamlit/frontend/utils/stream_handler.py +0 -301
- src/frontends/streamlit/frontend/utils/title_summary.py +0 -94
- src/frontends/streamlit_adk/frontend/side_bar.py +0 -214
- src/frontends/streamlit_adk/frontend/streamlit_app.py +0 -314
- src/frontends/streamlit_adk/frontend/style/app_markdown.py +0 -37
- src/frontends/streamlit_adk/frontend/utils/chat_utils.py +0 -84
- src/frontends/streamlit_adk/frontend/utils/local_chat_history.py +0 -110
- src/frontends/streamlit_adk/frontend/utils/message_editing.py +0 -61
- src/frontends/streamlit_adk/frontend/utils/multimodal_utils.py +0 -223
- src/frontends/streamlit_adk/frontend/utils/stream_handler.py +0 -311
- src/frontends/streamlit_adk/frontend/utils/title_summary.py +0 -129
- src/resources/containers/data_processing/Dockerfile +0 -27
- src/resources/containers/e2e-tests/Dockerfile +0 -19
- src/resources/idx/.idx/dev.nix +0 -57
- src/resources/idx/idx-template.json +0 -21
- src/resources/idx/idx-template.nix +0 -26
- src/resources/locks/uv-adk_base-agent_engine.lock +0 -5338
- src/resources/locks/uv-adk_base-cloud_run.lock +0 -5930
- src/resources/locks/uv-agentic_rag-agent_engine.lock +0 -5528
- src/resources/locks/uv-agentic_rag-cloud_run.lock +0 -6120
- src/resources/locks/uv-crewai_coding_crew-agent_engine.lock +0 -6231
- src/resources/locks/uv-crewai_coding_crew-cloud_run.lock +0 -6839
- src/resources/locks/uv-langgraph_base_react-agent_engine.lock +0 -5233
- src/resources/locks/uv-langgraph_base_react-cloud_run.lock +0 -5862
- src/resources/locks/uv-live_api-cloud_run.lock +0 -5832
- src/resources/setup_cicd/cicd_variables.tf +0 -41
- src/resources/setup_cicd/github.tf +0 -87
- {agents → agent_starter_pack/agents}/agentic_rag/app/retrievers.py +0 -0
- {agents → agent_starter_pack/agents}/agentic_rag/app/templates.py +0 -0
- {src → agent_starter_pack}/base_template/deployment/terraform/dev/vars/env.tfvars +0 -0
- {src → agent_starter_pack}/base_template/tests/unit/test_dummy.py +0 -0
- {src/deployment_targets/agent_engine/app/utils → agent_starter_pack/base_template/{{cookiecutter.agent_directory}}/app_utils}/gcs.py +0 -0
- {src → agent_starter_pack}/cli/utils/__init__.py +0 -0
- {src → agent_starter_pack}/cli/utils/datastores.py +0 -0
- {src → agent_starter_pack}/cli/utils/version.py +0 -0
- {src → agent_starter_pack}/data_ingestion/README.md +0 -0
- {src → agent_starter_pack}/data_ingestion/data_ingestion_pipeline/components/ingest_data.py +0 -0
- {src → agent_starter_pack}/data_ingestion/data_ingestion_pipeline/pipeline.py +0 -0
- {src → agent_starter_pack}/deployment_targets/agent_engine/deployment_metadata.json +0 -0
- {src → agent_starter_pack}/deployment_targets/agent_engine/tests/load_test/.results/.placeholder +0 -0
- {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/public/favicon.ico +0 -0
- {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/public/index.html +0 -0
- {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/public/robots.txt +0 -0
- {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/src/App.scss +0 -0
- {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/src/App.test.tsx +0 -0
- {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/src/components/audio-pulse/AudioPulse.tsx +0 -0
- {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/src/components/audio-pulse/audio-pulse.scss +0 -0
- {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/src/components/logger/mock-logs.ts +0 -0
- {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/src/contexts/LiveAPIContext.tsx +0 -0
- {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/src/hooks/use-media-stream-mux.ts +0 -0
- {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/src/hooks/use-screen-capture.ts +0 -0
- {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/src/hooks/use-webcam.ts +0 -0
- {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/src/index.css +0 -0
- {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/src/index.tsx +0 -0
- {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/src/react-app-env.d.ts +0 -0
- {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/src/reportWebVitals.ts +0 -0
- {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/src/setupTests.ts +0 -0
- {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/src/utils/audioworklet-registry.ts +0 -0
- {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/src/utils/store-logger.ts +0 -0
- {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/src/utils/worklets/audio-processing.ts +0 -0
- {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/src/utils/worklets/vol-meter.ts +0 -0
- {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/tsconfig.json +0 -0
- {agent_starter_pack-0.3.3.dist-info → agent_starter_pack-0.21.0.dist-info}/WHEEL +0 -0
- {agent_starter_pack-0.3.3.dist-info → agent_starter_pack-0.21.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,263 @@
|
|
|
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
|
+
# mypy: disable-error-code="attr-defined,arg-type"
|
|
16
|
+
{%- if cookiecutter.is_adk %}
|
|
17
|
+
{%- if cookiecutter.is_a2a %}
|
|
18
|
+
import asyncio
|
|
19
|
+
{%- endif %}
|
|
20
|
+
import logging
|
|
21
|
+
import os
|
|
22
|
+
from typing import Any
|
|
23
|
+
|
|
24
|
+
{% if cookiecutter.is_a2a -%}
|
|
25
|
+
import nest_asyncio
|
|
26
|
+
{% endif -%}
|
|
27
|
+
import vertexai
|
|
28
|
+
{%- if cookiecutter.is_a2a %}
|
|
29
|
+
from a2a.types import AgentCapabilities, AgentCard, TransportProtocol
|
|
30
|
+
from google.adk.a2a.executor.a2a_agent_executor import A2aAgentExecutor
|
|
31
|
+
from google.adk.a2a.utils.agent_card_builder import AgentCardBuilder
|
|
32
|
+
from google.adk.apps.app import App
|
|
33
|
+
{%- endif %}
|
|
34
|
+
from google.adk.artifacts import GcsArtifactService, InMemoryArtifactService
|
|
35
|
+
{%- if cookiecutter.is_a2a %}
|
|
36
|
+
from google.adk.runners import Runner
|
|
37
|
+
from google.adk.sessions import InMemorySessionService
|
|
38
|
+
{%- endif %}
|
|
39
|
+
from google.cloud import logging as google_cloud_logging
|
|
40
|
+
{%- if cookiecutter.is_adk_live %}
|
|
41
|
+
from vertexai.agent_engines.templates.adk import AdkApp
|
|
42
|
+
from vertexai.preview.reasoning_engines import AdkApp as PreviewAdkApp
|
|
43
|
+
{%- elif cookiecutter.is_a2a %}
|
|
44
|
+
from vertexai.preview.reasoning_engines import A2aAgent
|
|
45
|
+
{%- else %}
|
|
46
|
+
from vertexai.agent_engines.templates.adk import AdkApp
|
|
47
|
+
{%- endif %}
|
|
48
|
+
{%- if cookiecutter.is_adk or cookiecutter.is_adk_live %}
|
|
49
|
+
|
|
50
|
+
from {{cookiecutter.agent_directory}}.agent import app as adk_app
|
|
51
|
+
{%- else %}
|
|
52
|
+
|
|
53
|
+
{%- endif %}
|
|
54
|
+
from {{cookiecutter.agent_directory}}.app_utils.telemetry import setup_telemetry
|
|
55
|
+
from {{cookiecutter.agent_directory}}.app_utils.typing import Feedback
|
|
56
|
+
{%- if cookiecutter.is_a2a %}
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
class AgentEngineApp(A2aAgent):
|
|
60
|
+
@staticmethod
|
|
61
|
+
def create(
|
|
62
|
+
app: App | None = None,
|
|
63
|
+
artifact_service: Any = None,
|
|
64
|
+
session_service: Any = None,
|
|
65
|
+
) -> Any:
|
|
66
|
+
"""Create an AgentEngineApp instance.
|
|
67
|
+
|
|
68
|
+
This method detects whether it's being called in an async context (like notebooks
|
|
69
|
+
or Agent Engine) and handles agent card creation appropriately.
|
|
70
|
+
"""
|
|
71
|
+
if app is None:
|
|
72
|
+
app = adk_app
|
|
73
|
+
|
|
74
|
+
def create_runner() -> Runner:
|
|
75
|
+
"""Create a Runner for the AgentEngineApp."""
|
|
76
|
+
return Runner(
|
|
77
|
+
app=app,
|
|
78
|
+
session_service=session_service,
|
|
79
|
+
artifact_service=artifact_service,
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
# Build agent card in an async context if needed
|
|
83
|
+
try:
|
|
84
|
+
asyncio.get_running_loop()
|
|
85
|
+
# Running event loop detected - enable nested asyncio.run()
|
|
86
|
+
nest_asyncio.apply()
|
|
87
|
+
except RuntimeError:
|
|
88
|
+
pass
|
|
89
|
+
|
|
90
|
+
agent_card = asyncio.run(AgentEngineApp.build_agent_card(app=app))
|
|
91
|
+
|
|
92
|
+
return AgentEngineApp(
|
|
93
|
+
agent_executor_builder=lambda: A2aAgentExecutor(runner=create_runner()),
|
|
94
|
+
agent_card=agent_card,
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
@staticmethod
|
|
98
|
+
async def build_agent_card(app: App) -> AgentCard:
|
|
99
|
+
"""Builds the Agent Card dynamically from the app."""
|
|
100
|
+
agent_card_builder = AgentCardBuilder(
|
|
101
|
+
agent=app.root_agent,
|
|
102
|
+
# Agent Engine does not support streaming yet
|
|
103
|
+
capabilities=AgentCapabilities(streaming=False),
|
|
104
|
+
rpc_url="http://localhost:9999/",
|
|
105
|
+
agent_version=os.getenv("AGENT_VERSION", "0.1.0"),
|
|
106
|
+
)
|
|
107
|
+
agent_card = await agent_card_builder.build()
|
|
108
|
+
agent_card.preferred_transport = TransportProtocol.http_json # Http Only.
|
|
109
|
+
agent_card.supports_authenticated_extended_card = True
|
|
110
|
+
return agent_card
|
|
111
|
+
{% else %}
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
class AgentEngineApp(AdkApp):
|
|
115
|
+
{%- endif %}
|
|
116
|
+
def set_up(self) -> None:
|
|
117
|
+
"""Initialize the agent engine app with logging and telemetry."""
|
|
118
|
+
vertexai.init()
|
|
119
|
+
setup_telemetry()
|
|
120
|
+
super().set_up()
|
|
121
|
+
logging.basicConfig(level=logging.INFO)
|
|
122
|
+
logging_client = google_cloud_logging.Client()
|
|
123
|
+
self.logger = logging_client.logger(__name__)
|
|
124
|
+
if gemini_location:
|
|
125
|
+
os.environ["GOOGLE_CLOUD_LOCATION"] = gemini_location
|
|
126
|
+
|
|
127
|
+
def register_feedback(self, feedback: dict[str, Any]) -> None:
|
|
128
|
+
"""Collect and log feedback."""
|
|
129
|
+
feedback_obj = Feedback.model_validate(feedback)
|
|
130
|
+
self.logger.log_struct(feedback_obj.model_dump(), severity="INFO")
|
|
131
|
+
|
|
132
|
+
def register_operations(self) -> dict[str, list[str]]:
|
|
133
|
+
"""Registers the operations of the Agent."""
|
|
134
|
+
operations = super().register_operations()
|
|
135
|
+
operations[""] = operations.get("", []) + ["register_feedback"]
|
|
136
|
+
{%- if cookiecutter.is_adk_live %}
|
|
137
|
+
# Add bidi_stream_query for adk_live
|
|
138
|
+
operations["bidi_stream"] = ["bidi_stream_query"]
|
|
139
|
+
{%- endif %}
|
|
140
|
+
return operations
|
|
141
|
+
{%- if cookiecutter.is_a2a %}
|
|
142
|
+
|
|
143
|
+
def clone(self) -> "AgentEngineApp":
|
|
144
|
+
"""Returns a clone of the Agent Engine application."""
|
|
145
|
+
return self
|
|
146
|
+
{%- endif %}
|
|
147
|
+
{%- if cookiecutter.is_adk_live %}
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
# Add bidi_stream_query support from preview AdkApp for adk_live
|
|
151
|
+
AgentEngineApp.bidi_stream_query = PreviewAdkApp.bidi_stream_query
|
|
152
|
+
{%- endif %}
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
gemini_location = os.environ.get("GOOGLE_CLOUD_LOCATION")
|
|
156
|
+
logs_bucket_name = os.environ.get("LOGS_BUCKET_NAME")
|
|
157
|
+
{%- if cookiecutter.is_a2a %}
|
|
158
|
+
agent_engine = AgentEngineApp.create(
|
|
159
|
+
app=adk_app,
|
|
160
|
+
artifact_service=(
|
|
161
|
+
GcsArtifactService(bucket_name=logs_bucket_name)
|
|
162
|
+
if logs_bucket_name
|
|
163
|
+
else InMemoryArtifactService()
|
|
164
|
+
),
|
|
165
|
+
session_service=InMemorySessionService(),
|
|
166
|
+
)
|
|
167
|
+
{%- else %}
|
|
168
|
+
agent_engine = AgentEngineApp(
|
|
169
|
+
app=adk_app,
|
|
170
|
+
artifact_service_builder=lambda: GcsArtifactService(bucket_name=logs_bucket_name)
|
|
171
|
+
if logs_bucket_name
|
|
172
|
+
else InMemoryArtifactService(),
|
|
173
|
+
)
|
|
174
|
+
{%- endif -%}
|
|
175
|
+
{% else %}
|
|
176
|
+
|
|
177
|
+
import asyncio
|
|
178
|
+
import os
|
|
179
|
+
from typing import Any
|
|
180
|
+
|
|
181
|
+
import nest_asyncio
|
|
182
|
+
from a2a.types import AgentCapabilities, AgentCard, AgentSkill, TransportProtocol
|
|
183
|
+
from google.cloud import logging as google_cloud_logging
|
|
184
|
+
from vertexai.preview.reasoning_engines import A2aAgent
|
|
185
|
+
|
|
186
|
+
from {{cookiecutter.agent_directory}}.agent import root_agent
|
|
187
|
+
from {{cookiecutter.agent_directory}}.app_utils.executor.a2a_agent_executor import (
|
|
188
|
+
LangGraphAgentExecutor,
|
|
189
|
+
)
|
|
190
|
+
from {{cookiecutter.agent_directory}}.app_utils.typing import Feedback
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
class AgentEngineApp(A2aAgent):
|
|
194
|
+
"""Agent Engine App with A2A Protocol support for LangGraph agents."""
|
|
195
|
+
|
|
196
|
+
@staticmethod
|
|
197
|
+
def create() -> "AgentEngineApp":
|
|
198
|
+
"""Create an AgentEngineApp instance with A2A support.
|
|
199
|
+
|
|
200
|
+
This method handles agent card creation in async context.
|
|
201
|
+
"""
|
|
202
|
+
# Handle nested asyncio contexts (like notebooks or Agent Engine)
|
|
203
|
+
try:
|
|
204
|
+
asyncio.get_running_loop()
|
|
205
|
+
nest_asyncio.apply()
|
|
206
|
+
except RuntimeError:
|
|
207
|
+
pass
|
|
208
|
+
|
|
209
|
+
agent_card = asyncio.run(AgentEngineApp.build_agent_card())
|
|
210
|
+
|
|
211
|
+
return AgentEngineApp(
|
|
212
|
+
agent_executor_builder=lambda: LangGraphAgentExecutor(graph=root_agent),
|
|
213
|
+
agent_card=agent_card,
|
|
214
|
+
)
|
|
215
|
+
|
|
216
|
+
@staticmethod
|
|
217
|
+
async def build_agent_card() -> AgentCard:
|
|
218
|
+
"""Build the Agent Card for the LangGraph agent."""
|
|
219
|
+
skill = AgentSkill(
|
|
220
|
+
id="root_agent-get_weather",
|
|
221
|
+
name="get_weather",
|
|
222
|
+
description="Simulates a web search. Use it get information on weather.",
|
|
223
|
+
tags=["llm", "tools"],
|
|
224
|
+
examples=["What's the weather in San Francisco?"],
|
|
225
|
+
)
|
|
226
|
+
agent_card = AgentCard(
|
|
227
|
+
name="root_agent",
|
|
228
|
+
description="A base ReAct agent using LangGraph with Agent2Agent (A2A) Protocol support",
|
|
229
|
+
url="http://localhost:9999/", # RPC URL for Agent Engine
|
|
230
|
+
version=os.getenv("AGENT_VERSION", "0.1.0"),
|
|
231
|
+
default_input_modes=["text/plain"],
|
|
232
|
+
default_output_modes=["text/plain"],
|
|
233
|
+
capabilities=AgentCapabilities(
|
|
234
|
+
streaming=False
|
|
235
|
+
), # Agent Engine does not support streaming yet
|
|
236
|
+
skills=[skill],
|
|
237
|
+
)
|
|
238
|
+
|
|
239
|
+
agent_card.preferred_transport = TransportProtocol.http_json # Http Only.
|
|
240
|
+
agent_card.supports_authenticated_extended_card = True
|
|
241
|
+
|
|
242
|
+
return agent_card
|
|
243
|
+
|
|
244
|
+
def register_feedback(self, feedback: dict[str, Any]) -> None:
|
|
245
|
+
"""Collect and log feedback."""
|
|
246
|
+
feedback_obj = Feedback.model_validate(feedback)
|
|
247
|
+
logging_client = google_cloud_logging.Client()
|
|
248
|
+
logger = logging_client.logger(__name__)
|
|
249
|
+
logger.log_struct(feedback_obj.model_dump(), severity="INFO")
|
|
250
|
+
|
|
251
|
+
def register_operations(self) -> dict[str, list[str]]:
|
|
252
|
+
"""Registers the operations of the Agent."""
|
|
253
|
+
operations = super().register_operations()
|
|
254
|
+
operations[""] = operations.get("", []) + ["register_feedback"]
|
|
255
|
+
return operations
|
|
256
|
+
|
|
257
|
+
def clone(self) -> "AgentEngineApp":
|
|
258
|
+
"""Returns a clone of the Agent Engine application."""
|
|
259
|
+
return self
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
agent_engine = AgentEngineApp.create()
|
|
263
|
+
{%- endif %}
|
|
@@ -0,0 +1,414 @@
|
|
|
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 asyncio
|
|
16
|
+
import datetime
|
|
17
|
+
import importlib
|
|
18
|
+
import inspect
|
|
19
|
+
import json
|
|
20
|
+
import logging
|
|
21
|
+
import warnings
|
|
22
|
+
from typing import Any
|
|
23
|
+
|
|
24
|
+
import click
|
|
25
|
+
import google.auth
|
|
26
|
+
import vertexai
|
|
27
|
+
from vertexai._genai import _agent_engines_utils
|
|
28
|
+
from vertexai._genai.types import AgentEngine, AgentEngineConfig{%- if cookiecutter.is_adk_live %}, AgentServerMode{%- endif %}
|
|
29
|
+
{%- if cookiecutter.is_adk_live %}
|
|
30
|
+
|
|
31
|
+
from {{cookiecutter.agent_directory}}.app_utils.gcs import create_bucket_if_not_exists
|
|
32
|
+
{%- endif %}
|
|
33
|
+
|
|
34
|
+
# Suppress google-cloud-storage version compatibility warning
|
|
35
|
+
warnings.filterwarnings(
|
|
36
|
+
"ignore", category=FutureWarning, module="google.cloud.aiplatform"
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def generate_class_methods_from_agent(agent_instance: Any) -> list[dict[str, Any]]:
|
|
41
|
+
"""Generate method specifications with schemas from agent's register_operations().
|
|
42
|
+
|
|
43
|
+
See: https://docs.cloud.google.com/agent-builder/agent-engine/use/custom#supported-operations
|
|
44
|
+
"""
|
|
45
|
+
registered_operations = _agent_engines_utils._get_registered_operations(
|
|
46
|
+
agent=agent_instance
|
|
47
|
+
)
|
|
48
|
+
class_methods_spec = _agent_engines_utils._generate_class_methods_spec_or_raise(
|
|
49
|
+
agent=agent_instance,
|
|
50
|
+
operations=registered_operations,
|
|
51
|
+
)
|
|
52
|
+
class_methods_list = [
|
|
53
|
+
_agent_engines_utils._to_dict(method_spec) for method_spec in class_methods_spec
|
|
54
|
+
]
|
|
55
|
+
return class_methods_list
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def parse_key_value_pairs(kv_string: str | None) -> dict[str, str]:
|
|
59
|
+
"""Parse key-value pairs from a comma-separated KEY=VALUE string."""
|
|
60
|
+
result = {}
|
|
61
|
+
if kv_string:
|
|
62
|
+
for pair in kv_string.split(","):
|
|
63
|
+
if "=" in pair:
|
|
64
|
+
key, value = pair.split("=", 1)
|
|
65
|
+
result[key.strip()] = value.strip()
|
|
66
|
+
else:
|
|
67
|
+
logging.warning(f"Skipping malformed key-value pair: {pair}")
|
|
68
|
+
return result
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
def write_deployment_metadata(
|
|
72
|
+
remote_agent: Any,
|
|
73
|
+
metadata_file: str = "deployment_metadata.json",
|
|
74
|
+
) -> None:
|
|
75
|
+
"""Write deployment metadata to file."""
|
|
76
|
+
metadata = {
|
|
77
|
+
"remote_agent_engine_id": remote_agent.api_resource.name,
|
|
78
|
+
"deployment_target": "agent_engine",
|
|
79
|
+
{%- if cookiecutter.is_a2a %}
|
|
80
|
+
"is_a2a": True,
|
|
81
|
+
{%- else %}
|
|
82
|
+
"is_a2a": False,
|
|
83
|
+
{%- endif %}
|
|
84
|
+
"deployment_timestamp": datetime.datetime.now().isoformat(),
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
with open(metadata_file, "w") as f:
|
|
88
|
+
json.dump(metadata, f, indent=2)
|
|
89
|
+
|
|
90
|
+
logging.info(f"Agent Engine ID written to {metadata_file}")
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
def print_deployment_success(
|
|
94
|
+
remote_agent: Any,
|
|
95
|
+
location: str,
|
|
96
|
+
project: str,
|
|
97
|
+
) -> None:
|
|
98
|
+
"""Print deployment success message with console URL."""
|
|
99
|
+
# Extract agent engine ID and project number for console URL
|
|
100
|
+
resource_name_parts = remote_agent.api_resource.name.split("/")
|
|
101
|
+
agent_engine_id = resource_name_parts[-1]
|
|
102
|
+
project_number = resource_name_parts[1]
|
|
103
|
+
|
|
104
|
+
{%- if cookiecutter.is_adk_live %}
|
|
105
|
+
print("\n✅ Deployment successful! Run your agent with: `make playground-remote`")
|
|
106
|
+
{%- elif cookiecutter.is_a2a %}
|
|
107
|
+
print(
|
|
108
|
+
"\n✅ Deployment successful! Test your agent: notebooks/adk_a2a_app_testing.ipynb"
|
|
109
|
+
)
|
|
110
|
+
{%- else %}
|
|
111
|
+
print("\n✅ Deployment successful!")
|
|
112
|
+
{%- endif %}
|
|
113
|
+
service_account = remote_agent.api_resource.spec.service_account
|
|
114
|
+
if service_account:
|
|
115
|
+
print(f"Service Account: {service_account}")
|
|
116
|
+
else:
|
|
117
|
+
default_sa = (
|
|
118
|
+
f"service-{project_number}@gcp-sa-aiplatform-re.iam.gserviceaccount.com"
|
|
119
|
+
)
|
|
120
|
+
print(f"Service Account: {default_sa}")
|
|
121
|
+
{%- if cookiecutter.is_adk and not cookiecutter.is_adk_live and not cookiecutter.is_a2a %}
|
|
122
|
+
playground_url = f"https://console.cloud.google.com/vertex-ai/agents/locations/{location}/agent-engines/{agent_engine_id}/playground?project={project}"
|
|
123
|
+
print(f"\n📊 Open Console Playground: {playground_url}\n")
|
|
124
|
+
{%- else %}
|
|
125
|
+
console_url = f"https://console.cloud.google.com/vertex-ai/agents/locations/{location}/agent-engines/{agent_engine_id}?project={project}"
|
|
126
|
+
print(f"\n📊 View in Console: {console_url}\n")
|
|
127
|
+
{%- endif %}
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
@click.command()
|
|
131
|
+
@click.option(
|
|
132
|
+
"--project",
|
|
133
|
+
default=None,
|
|
134
|
+
help="GCP project ID (defaults to application default credentials)",
|
|
135
|
+
)
|
|
136
|
+
@click.option(
|
|
137
|
+
"--location",
|
|
138
|
+
default="us-central1",
|
|
139
|
+
help="GCP region (defaults to us-central1)",
|
|
140
|
+
)
|
|
141
|
+
@click.option(
|
|
142
|
+
"--display-name",
|
|
143
|
+
default="{{cookiecutter.project_name}}",
|
|
144
|
+
help="Display name for the agent engine",
|
|
145
|
+
)
|
|
146
|
+
@click.option(
|
|
147
|
+
"--description",
|
|
148
|
+
default="{{cookiecutter.agent_description}}",
|
|
149
|
+
help="Description of the agent",
|
|
150
|
+
)
|
|
151
|
+
@click.option(
|
|
152
|
+
"--source-packages",
|
|
153
|
+
multiple=True,
|
|
154
|
+
default=["./{{cookiecutter.agent_directory}}"],
|
|
155
|
+
help="Source packages to deploy. Can be specified multiple times (e.g., --source-packages=./app --source-packages=./lib)",
|
|
156
|
+
)
|
|
157
|
+
@click.option(
|
|
158
|
+
"--entrypoint-module",
|
|
159
|
+
default="{{cookiecutter.agent_directory}}.agent_engine_app",
|
|
160
|
+
help="Python module path for the agent entrypoint (required)",
|
|
161
|
+
)
|
|
162
|
+
@click.option(
|
|
163
|
+
"--entrypoint-object",
|
|
164
|
+
default="agent_engine",
|
|
165
|
+
help="Name of the agent instance at module level (required)",
|
|
166
|
+
)
|
|
167
|
+
@click.option(
|
|
168
|
+
"--requirements-file",
|
|
169
|
+
default="{{cookiecutter.agent_directory}}/app_utils/.requirements.txt",
|
|
170
|
+
help="Path to requirements.txt file",
|
|
171
|
+
)
|
|
172
|
+
@click.option(
|
|
173
|
+
"--set-env-vars",
|
|
174
|
+
default=None,
|
|
175
|
+
help="Comma-separated list of environment variables in KEY=VALUE format",
|
|
176
|
+
)
|
|
177
|
+
@click.option(
|
|
178
|
+
"--labels",
|
|
179
|
+
default=None,
|
|
180
|
+
help="Comma-separated list of labels in KEY=VALUE format",
|
|
181
|
+
)
|
|
182
|
+
@click.option(
|
|
183
|
+
"--service-account",
|
|
184
|
+
default=None,
|
|
185
|
+
help="Service account email to use for the agent engine",
|
|
186
|
+
)
|
|
187
|
+
@click.option(
|
|
188
|
+
"--min-instances",
|
|
189
|
+
type=int,
|
|
190
|
+
default=1,
|
|
191
|
+
help="Minimum number of instances (default: 1)",
|
|
192
|
+
)
|
|
193
|
+
@click.option(
|
|
194
|
+
"--max-instances",
|
|
195
|
+
type=int,
|
|
196
|
+
default=10,
|
|
197
|
+
help="Maximum number of instances (default: 10)",
|
|
198
|
+
)
|
|
199
|
+
@click.option(
|
|
200
|
+
"--cpu",
|
|
201
|
+
default="4",
|
|
202
|
+
help="CPU limit (default: 4)",
|
|
203
|
+
)
|
|
204
|
+
@click.option(
|
|
205
|
+
"--memory",
|
|
206
|
+
default="8Gi",
|
|
207
|
+
help="Memory limit (default: 8Gi)",
|
|
208
|
+
)
|
|
209
|
+
@click.option(
|
|
210
|
+
"--container-concurrency",
|
|
211
|
+
type=int,
|
|
212
|
+
default=9,
|
|
213
|
+
help="Container concurrency (default: 9)",
|
|
214
|
+
)
|
|
215
|
+
@click.option(
|
|
216
|
+
"--num-workers",
|
|
217
|
+
type=int,
|
|
218
|
+
default=1,
|
|
219
|
+
help="Number of worker processes (default: 1)",
|
|
220
|
+
)
|
|
221
|
+
def deploy_agent_engine_app(
|
|
222
|
+
project: str | None,
|
|
223
|
+
location: str,
|
|
224
|
+
display_name: str,
|
|
225
|
+
description: str,
|
|
226
|
+
source_packages: tuple[str, ...],
|
|
227
|
+
entrypoint_module: str,
|
|
228
|
+
entrypoint_object: str,
|
|
229
|
+
requirements_file: str,
|
|
230
|
+
set_env_vars: str | None,
|
|
231
|
+
labels: str | None,
|
|
232
|
+
service_account: str | None,
|
|
233
|
+
min_instances: int,
|
|
234
|
+
max_instances: int,
|
|
235
|
+
cpu: str,
|
|
236
|
+
memory: str,
|
|
237
|
+
container_concurrency: int,
|
|
238
|
+
num_workers: int,
|
|
239
|
+
) -> AgentEngine:
|
|
240
|
+
"""Deploy the agent engine app to Vertex AI."""
|
|
241
|
+
|
|
242
|
+
logging.basicConfig(level=logging.INFO)
|
|
243
|
+
logging.getLogger("httpx").setLevel(logging.WARNING)
|
|
244
|
+
|
|
245
|
+
# Parse environment variables and labels if provided
|
|
246
|
+
env_vars = parse_key_value_pairs(set_env_vars)
|
|
247
|
+
labels_dict = parse_key_value_pairs(labels)
|
|
248
|
+
|
|
249
|
+
# Set GOOGLE_CLOUD_REGION to match deployment location
|
|
250
|
+
env_vars["GOOGLE_CLOUD_REGION"] = location
|
|
251
|
+
|
|
252
|
+
# Add NUM_WORKERS from CLI argument (can be overridden via --set-env-vars)
|
|
253
|
+
if "NUM_WORKERS" not in env_vars:
|
|
254
|
+
env_vars["NUM_WORKERS"] = str(num_workers)
|
|
255
|
+
|
|
256
|
+
# Enable telemetry by default for Agent Engine
|
|
257
|
+
if "GOOGLE_CLOUD_AGENT_ENGINE_ENABLE_TELEMETRY" not in env_vars:
|
|
258
|
+
env_vars["GOOGLE_CLOUD_AGENT_ENGINE_ENABLE_TELEMETRY"] = "true"
|
|
259
|
+
if "OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT" not in env_vars:
|
|
260
|
+
env_vars["OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT"] = "true"
|
|
261
|
+
|
|
262
|
+
if not project:
|
|
263
|
+
_, project = google.auth.default()
|
|
264
|
+
|
|
265
|
+
print("""
|
|
266
|
+
╔═══════════════════════════════════════════════════════════╗
|
|
267
|
+
║ ║
|
|
268
|
+
║ 🤖 DEPLOYING AGENT TO VERTEX AI AGENT ENGINE 🤖 ║
|
|
269
|
+
║ ║
|
|
270
|
+
╚═══════════════════════════════════════════════════════════╝
|
|
271
|
+
""")
|
|
272
|
+
|
|
273
|
+
# Log deployment parameters
|
|
274
|
+
click.echo("\n📋 Deployment Parameters:")
|
|
275
|
+
click.echo(f" Project: {project}")
|
|
276
|
+
click.echo(f" Location: {location}")
|
|
277
|
+
click.echo(f" Display Name: {display_name}")
|
|
278
|
+
click.echo(f" Min Instances: {min_instances}")
|
|
279
|
+
click.echo(f" Max Instances: {max_instances}")
|
|
280
|
+
click.echo(f" CPU: {cpu}")
|
|
281
|
+
click.echo(f" Memory: {memory}")
|
|
282
|
+
click.echo(f" Container Concurrency: {container_concurrency}")
|
|
283
|
+
if service_account:
|
|
284
|
+
click.echo(f" Service Account: {service_account}")
|
|
285
|
+
if env_vars:
|
|
286
|
+
click.echo("\n🌍 Environment Variables:")
|
|
287
|
+
for key, value in sorted(env_vars.items()):
|
|
288
|
+
click.echo(f" {key}: {value}")
|
|
289
|
+
|
|
290
|
+
source_packages_list = list(source_packages)
|
|
291
|
+
|
|
292
|
+
# Initialize vertexai client
|
|
293
|
+
client = vertexai.Client(
|
|
294
|
+
project=project,
|
|
295
|
+
location=location,
|
|
296
|
+
)
|
|
297
|
+
vertexai.init(project=project, location=location)
|
|
298
|
+
|
|
299
|
+
# Add agent garden labels if configured
|
|
300
|
+
{%- if cookiecutter.agent_garden %}
|
|
301
|
+
{%- if cookiecutter.agent_sample_id and cookiecutter.agent_sample_publisher %}
|
|
302
|
+
labels_dict["vertex-agent-sample-id"] = "{{cookiecutter.agent_sample_id}}"
|
|
303
|
+
labels_dict["vertex-agent-sample-publisher"] = "{{cookiecutter.agent_sample_publisher}}"
|
|
304
|
+
labels_dict["deployed-with"] = "agent-garden"
|
|
305
|
+
{%- endif %}
|
|
306
|
+
{%- endif %}
|
|
307
|
+
|
|
308
|
+
# Dynamically import the agent instance to generate class_methods
|
|
309
|
+
logging.info(f"Importing {entrypoint_module}.{entrypoint_object}")
|
|
310
|
+
module = importlib.import_module(entrypoint_module)
|
|
311
|
+
agent_instance = getattr(module, entrypoint_object)
|
|
312
|
+
|
|
313
|
+
# If the agent_instance is a coroutine, await it to get the actual instance
|
|
314
|
+
if inspect.iscoroutine(agent_instance):
|
|
315
|
+
logging.info(f"Detected coroutine, awaiting {entrypoint_object}...")
|
|
316
|
+
agent_instance = asyncio.run(agent_instance)
|
|
317
|
+
|
|
318
|
+
{%- if cookiecutter.is_adk_live %}
|
|
319
|
+
# For adk_live, use pickle-based deployment (source-based not yet supported with EXPERIMENTAL mode)
|
|
320
|
+
# Ensure staging bucket exists for pickle serialization
|
|
321
|
+
staging_bucket_uri = f"gs://{project}-agent-engine"
|
|
322
|
+
|
|
323
|
+
create_bucket_if_not_exists(
|
|
324
|
+
bucket_name=staging_bucket_uri, project=project, location=location
|
|
325
|
+
)
|
|
326
|
+
|
|
327
|
+
config = AgentEngineConfig(
|
|
328
|
+
display_name=display_name,
|
|
329
|
+
description=description,
|
|
330
|
+
env_vars=env_vars,
|
|
331
|
+
extra_packages=source_packages_list,
|
|
332
|
+
service_account=service_account,
|
|
333
|
+
requirements=requirements_file,
|
|
334
|
+
staging_bucket=staging_bucket_uri,
|
|
335
|
+
labels=labels_dict,
|
|
336
|
+
gcs_dir_name=display_name,
|
|
337
|
+
agent_server_mode=AgentServerMode.EXPERIMENTAL, # Enable bidi streaming
|
|
338
|
+
resource_limits={"cpu": cpu, "memory": memory},
|
|
339
|
+
)
|
|
340
|
+
|
|
341
|
+
agent_config = {
|
|
342
|
+
"agent": agent_instance,
|
|
343
|
+
"config": config,
|
|
344
|
+
}
|
|
345
|
+
{%- else %}
|
|
346
|
+
# Generate class methods spec from register_operations
|
|
347
|
+
class_methods_list = generate_class_methods_from_agent(agent_instance)
|
|
348
|
+
|
|
349
|
+
config = AgentEngineConfig(
|
|
350
|
+
display_name=display_name,
|
|
351
|
+
description=description,
|
|
352
|
+
source_packages=source_packages_list,
|
|
353
|
+
entrypoint_module=entrypoint_module,
|
|
354
|
+
entrypoint_object=entrypoint_object,
|
|
355
|
+
class_methods=class_methods_list,
|
|
356
|
+
env_vars=env_vars,
|
|
357
|
+
service_account=service_account,
|
|
358
|
+
requirements_file=requirements_file,
|
|
359
|
+
labels=labels_dict,
|
|
360
|
+
min_instances=min_instances,
|
|
361
|
+
max_instances=max_instances,
|
|
362
|
+
resource_limits={"cpu": cpu, "memory": memory},
|
|
363
|
+
container_concurrency=container_concurrency,
|
|
364
|
+
{%- if cookiecutter.is_adk %}
|
|
365
|
+
agent_framework="google-adk",
|
|
366
|
+
{%- endif %}
|
|
367
|
+
)
|
|
368
|
+
{%- endif %}
|
|
369
|
+
|
|
370
|
+
# Check if an agent with this name already exists
|
|
371
|
+
existing_agents = list(client.agent_engines.list())
|
|
372
|
+
matching_agents = [
|
|
373
|
+
agent
|
|
374
|
+
for agent in existing_agents
|
|
375
|
+
if agent.api_resource.display_name == display_name
|
|
376
|
+
]
|
|
377
|
+
|
|
378
|
+
# Deploy the agent (create or update)
|
|
379
|
+
if matching_agents:
|
|
380
|
+
click.echo(f"\n📝 Updating existing agent: {display_name}")
|
|
381
|
+
else:
|
|
382
|
+
click.echo(f"\n🚀 Creating new agent: {display_name}")
|
|
383
|
+
|
|
384
|
+
click.echo("🚀 Deploying to Vertex AI Agent Engine (this can take 3-5 minutes)...")
|
|
385
|
+
|
|
386
|
+
{%- if cookiecutter.is_adk_live %}
|
|
387
|
+
if matching_agents:
|
|
388
|
+
remote_agent = client.agent_engines.update(
|
|
389
|
+
name=matching_agents[0].api_resource.name,
|
|
390
|
+
agent=agent_instance,
|
|
391
|
+
config=config,
|
|
392
|
+
)
|
|
393
|
+
else:
|
|
394
|
+
remote_agent = client.agent_engines.create(
|
|
395
|
+
agent=agent_instance,
|
|
396
|
+
config=config,
|
|
397
|
+
)
|
|
398
|
+
{%- else %}
|
|
399
|
+
if matching_agents:
|
|
400
|
+
remote_agent = client.agent_engines.update(
|
|
401
|
+
name=matching_agents[0].api_resource.name, config=config
|
|
402
|
+
)
|
|
403
|
+
else:
|
|
404
|
+
remote_agent = client.agent_engines.create(config=config)
|
|
405
|
+
{%- endif %}
|
|
406
|
+
|
|
407
|
+
write_deployment_metadata(remote_agent)
|
|
408
|
+
print_deployment_success(remote_agent, location, project)
|
|
409
|
+
|
|
410
|
+
return remote_agent
|
|
411
|
+
|
|
412
|
+
|
|
413
|
+
if __name__ == "__main__":
|
|
414
|
+
deploy_agent_engine_app()
|