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,519 @@
|
|
|
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 json
|
|
17
|
+
import logging
|
|
18
|
+
import uuid
|
|
19
|
+
from collections.abc import Callable
|
|
20
|
+
from pathlib import Path
|
|
21
|
+
from typing import Any, Literal
|
|
22
|
+
|
|
23
|
+
import backoff
|
|
24
|
+
import google.auth
|
|
25
|
+
import vertexai
|
|
26
|
+
from fastapi import FastAPI, HTTPException, WebSocket
|
|
27
|
+
from fastapi.middleware.cors import CORSMiddleware
|
|
28
|
+
from fastapi.responses import FileResponse
|
|
29
|
+
from fastapi.staticfiles import StaticFiles
|
|
30
|
+
from google.cloud import logging as google_cloud_logging
|
|
31
|
+
from pydantic import BaseModel, Field
|
|
32
|
+
from websockets.exceptions import ConnectionClosedError
|
|
33
|
+
|
|
34
|
+
app = FastAPI()
|
|
35
|
+
app.add_middleware(
|
|
36
|
+
CORSMiddleware,
|
|
37
|
+
allow_origins=["*"],
|
|
38
|
+
allow_methods=["*"],
|
|
39
|
+
allow_headers=["*"],
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
# Get the path to the frontend build directory
|
|
43
|
+
current_dir = Path(__file__).parent
|
|
44
|
+
frontend_build_dir = current_dir.parent.parent / "frontend" / "build"
|
|
45
|
+
|
|
46
|
+
# Mount static files if build directory exists
|
|
47
|
+
if frontend_build_dir.exists():
|
|
48
|
+
app.mount(
|
|
49
|
+
"/static",
|
|
50
|
+
StaticFiles(directory=str(frontend_build_dir / "static")),
|
|
51
|
+
name="static",
|
|
52
|
+
)
|
|
53
|
+
logging_client = google_cloud_logging.Client()
|
|
54
|
+
logger = logging_client.logger(__name__)
|
|
55
|
+
logging.basicConfig(level=logging.INFO)
|
|
56
|
+
|
|
57
|
+
# Initialize default configuration
|
|
58
|
+
app.state.config = {
|
|
59
|
+
"use_remote_agent": False,
|
|
60
|
+
"remote_agent_engine_id": None,
|
|
61
|
+
"project_id": None,
|
|
62
|
+
"location": "us-central1",
|
|
63
|
+
"local_agent_path": "..agent.root_agent",
|
|
64
|
+
"agent_engine_object_path": "..agent_engine_app.agent_engine",
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
class WebSocketToQueueAdapter:
|
|
69
|
+
"""Adapter to convert WebSocket messages to an asyncio Queue for the agent engine."""
|
|
70
|
+
|
|
71
|
+
def __init__(
|
|
72
|
+
self,
|
|
73
|
+
websocket: WebSocket,
|
|
74
|
+
agent_engine: Any = None,
|
|
75
|
+
remote_config: dict[str, Any] | None = None,
|
|
76
|
+
):
|
|
77
|
+
"""Initialize the adapter.
|
|
78
|
+
|
|
79
|
+
Args:
|
|
80
|
+
websocket: The client websocket connection
|
|
81
|
+
agent_engine: The agent engine instance with bidi_stream_query method (None if using remote)
|
|
82
|
+
remote_config: Remote agent engine configuration (project_id, location, remote_agent_engine_id)
|
|
83
|
+
"""
|
|
84
|
+
self.websocket = websocket
|
|
85
|
+
self.agent_engine = agent_engine
|
|
86
|
+
self.remote_config = remote_config
|
|
87
|
+
self.input_queue: asyncio.Queue[dict] = asyncio.Queue()
|
|
88
|
+
self.first_message = True
|
|
89
|
+
|
|
90
|
+
def _transform_remote_agent_engine_response(self, response: dict) -> dict:
|
|
91
|
+
"""Transform remote Agent Engine bidiStreamOutput to ADK Event format for frontend."""
|
|
92
|
+
# Check if this is a remote Agent Engine bidiStreamOutput
|
|
93
|
+
bidi_output = response.get("bidiStreamOutput")
|
|
94
|
+
if not bidi_output:
|
|
95
|
+
# Not a remote agent engine response, return as-is
|
|
96
|
+
return response
|
|
97
|
+
|
|
98
|
+
# Transform to ADK Event format that frontend already handles
|
|
99
|
+
# Just unwrap the bidiStreamOutput wrapper - the content is already in ADK Event format
|
|
100
|
+
return bidi_output
|
|
101
|
+
|
|
102
|
+
async def receive_from_client(self) -> None:
|
|
103
|
+
"""Listen for messages from the client and put them in the queue."""
|
|
104
|
+
while True:
|
|
105
|
+
try:
|
|
106
|
+
# Use receive() instead of receive_json() to handle both text and binary data
|
|
107
|
+
message = await self.websocket.receive()
|
|
108
|
+
|
|
109
|
+
# Handle different message types
|
|
110
|
+
if "text" in message:
|
|
111
|
+
# Parse JSON text messages
|
|
112
|
+
data = json.loads(message["text"])
|
|
113
|
+
|
|
114
|
+
if isinstance(data, dict):
|
|
115
|
+
# Skip setup messages - they're for backend logging only, not valid LiveRequest format
|
|
116
|
+
if "setup" in data:
|
|
117
|
+
# Log setup information
|
|
118
|
+
logger.log_struct(
|
|
119
|
+
{**data["setup"], "type": "setup"}, severity="INFO"
|
|
120
|
+
)
|
|
121
|
+
logging.info(
|
|
122
|
+
"Received setup message (not forwarding to agent)"
|
|
123
|
+
)
|
|
124
|
+
continue
|
|
125
|
+
|
|
126
|
+
# Frontend handles message format for both modes
|
|
127
|
+
await self.input_queue.put(data)
|
|
128
|
+
else:
|
|
129
|
+
logging.warning(
|
|
130
|
+
f"Received unexpected JSON structure from client: {data}"
|
|
131
|
+
)
|
|
132
|
+
|
|
133
|
+
elif "bytes" in message:
|
|
134
|
+
# Handle binary data
|
|
135
|
+
# Convert binary to appropriate format for agent engine
|
|
136
|
+
await self.input_queue.put({"binary_data": message["bytes"]})
|
|
137
|
+
|
|
138
|
+
else:
|
|
139
|
+
logging.warning(
|
|
140
|
+
f"Received unexpected message type from client: {message}"
|
|
141
|
+
)
|
|
142
|
+
|
|
143
|
+
except ConnectionClosedError as e:
|
|
144
|
+
logging.warning(f"Client closed connection: {e}")
|
|
145
|
+
break
|
|
146
|
+
except json.JSONDecodeError as e:
|
|
147
|
+
logging.error(f"Error parsing JSON from client: {e}")
|
|
148
|
+
break
|
|
149
|
+
except Exception as e:
|
|
150
|
+
logging.error(f"Error receiving from client: {e!s}")
|
|
151
|
+
break
|
|
152
|
+
|
|
153
|
+
async def run_agent_engine(self) -> None:
|
|
154
|
+
"""Run the agent engine with the input queue."""
|
|
155
|
+
try:
|
|
156
|
+
if self.agent_engine is not None:
|
|
157
|
+
# Local agent engine mode
|
|
158
|
+
# Give the agent engine a moment to initialize before sending setupComplete
|
|
159
|
+
await asyncio.sleep(1)
|
|
160
|
+
|
|
161
|
+
# Send setupComplete after initialization delay
|
|
162
|
+
setup_complete_response: dict = {"setupComplete": {}}
|
|
163
|
+
await self.websocket.send_json(setup_complete_response)
|
|
164
|
+
|
|
165
|
+
async for response in self.agent_engine.bidi_stream_query(
|
|
166
|
+
self.input_queue
|
|
167
|
+
):
|
|
168
|
+
# Send responses from agent engine to the websocket client
|
|
169
|
+
if response is not None:
|
|
170
|
+
await self.websocket.send_json(response)
|
|
171
|
+
|
|
172
|
+
# Check for error responses
|
|
173
|
+
if isinstance(response, dict) and "error" in response:
|
|
174
|
+
logging.error(f"Agent engine error: {response['error']}")
|
|
175
|
+
break
|
|
176
|
+
else:
|
|
177
|
+
# Remote agent engine mode
|
|
178
|
+
# Don't send setupComplete until remote connection is established
|
|
179
|
+
assert self.remote_config is not None, (
|
|
180
|
+
"remote_config must be set for remote mode"
|
|
181
|
+
)
|
|
182
|
+
await self.run_remote_agent_engine(
|
|
183
|
+
project_id=self.remote_config["project_id"],
|
|
184
|
+
location=self.remote_config["location"],
|
|
185
|
+
remote_agent_engine_id=self.remote_config["remote_agent_engine_id"],
|
|
186
|
+
)
|
|
187
|
+
except Exception as e:
|
|
188
|
+
logging.error(f"Error in agent engine: {e}")
|
|
189
|
+
await self.websocket.send_json({"error": str(e)})
|
|
190
|
+
|
|
191
|
+
async def run_remote_agent_engine(
|
|
192
|
+
self, project_id: str, location: str, remote_agent_engine_id: str
|
|
193
|
+
) -> None:
|
|
194
|
+
"""Run the remote agent engine connection."""
|
|
195
|
+
client = vertexai.Client(
|
|
196
|
+
project=project_id,
|
|
197
|
+
location=location,
|
|
198
|
+
)
|
|
199
|
+
|
|
200
|
+
async with client.aio.live.agent_engines.connect(
|
|
201
|
+
agent_engine=remote_agent_engine_id,
|
|
202
|
+
config={"class_method": "bidi_stream_query"},
|
|
203
|
+
) as session:
|
|
204
|
+
# Send setupComplete only after remote connection is established
|
|
205
|
+
logging.info("Remote agent engine connection established")
|
|
206
|
+
setup_complete_response: dict = {"setupComplete": {}}
|
|
207
|
+
await self.websocket.send_json(setup_complete_response)
|
|
208
|
+
|
|
209
|
+
# Create task to forward messages from queue to remote session
|
|
210
|
+
async def forward_to_remote() -> None:
|
|
211
|
+
while True:
|
|
212
|
+
try:
|
|
213
|
+
message = await self.input_queue.get()
|
|
214
|
+
await session.send(message)
|
|
215
|
+
except Exception as e:
|
|
216
|
+
logging.error(f"Error forwarding to remote: {e}")
|
|
217
|
+
break
|
|
218
|
+
|
|
219
|
+
# Create task to receive from remote and send to websocket
|
|
220
|
+
async def receive_from_remote() -> None:
|
|
221
|
+
while True:
|
|
222
|
+
try:
|
|
223
|
+
response = await session.receive()
|
|
224
|
+
if response is not None:
|
|
225
|
+
# Transform remote Agent Engine bidiStreamOutput format to frontend format
|
|
226
|
+
transformed = self._transform_remote_agent_engine_response(
|
|
227
|
+
response
|
|
228
|
+
)
|
|
229
|
+
if transformed:
|
|
230
|
+
await self.websocket.send_json(transformed)
|
|
231
|
+
|
|
232
|
+
# Check for error responses
|
|
233
|
+
if isinstance(response, dict) and "error" in response:
|
|
234
|
+
logging.error(
|
|
235
|
+
f"Remote agent engine error: {response['error']}"
|
|
236
|
+
)
|
|
237
|
+
break
|
|
238
|
+
except Exception as e:
|
|
239
|
+
logging.error(f"Error receiving from remote: {e}")
|
|
240
|
+
break
|
|
241
|
+
|
|
242
|
+
await asyncio.gather(
|
|
243
|
+
forward_to_remote(),
|
|
244
|
+
receive_from_remote(),
|
|
245
|
+
)
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
def _dynamic_import(path: str) -> Any:
|
|
249
|
+
"""Dynamically import an object from a given path.
|
|
250
|
+
|
|
251
|
+
Args:
|
|
252
|
+
path: Python import path (e.g., '..agent.root_agent')
|
|
253
|
+
|
|
254
|
+
Returns:
|
|
255
|
+
The imported object
|
|
256
|
+
"""
|
|
257
|
+
import importlib
|
|
258
|
+
|
|
259
|
+
module_path, object_name = path.rsplit(".", 1)
|
|
260
|
+
module = importlib.import_module(module_path, package=__package__)
|
|
261
|
+
return getattr(module, object_name)
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
def get_connect_and_run_callable(
|
|
265
|
+
websocket: WebSocket, config: dict[str, Any]
|
|
266
|
+
) -> Callable:
|
|
267
|
+
"""Create a callable that handles agent engine connection with retry logic.
|
|
268
|
+
|
|
269
|
+
Args:
|
|
270
|
+
websocket: The client websocket connection
|
|
271
|
+
config: Configuration dict with agent engine settings
|
|
272
|
+
|
|
273
|
+
Returns:
|
|
274
|
+
Callable: An async function that establishes and manages the agent engine connection
|
|
275
|
+
"""
|
|
276
|
+
|
|
277
|
+
async def on_backoff(details: backoff._typing.Details) -> None:
|
|
278
|
+
await websocket.send_json(
|
|
279
|
+
{
|
|
280
|
+
"status": f"Model connection error, retrying in {details['wait']} seconds..."
|
|
281
|
+
}
|
|
282
|
+
)
|
|
283
|
+
|
|
284
|
+
@backoff.on_exception(
|
|
285
|
+
backoff.expo, ConnectionClosedError, max_tries=10, on_backoff=on_backoff
|
|
286
|
+
)
|
|
287
|
+
async def connect_and_run() -> None:
|
|
288
|
+
if config["use_remote_agent"]:
|
|
289
|
+
# Remote agent engine mode
|
|
290
|
+
logging.info(
|
|
291
|
+
f"Connecting to remote agent engine: {config['remote_agent_engine_id']}"
|
|
292
|
+
)
|
|
293
|
+
remote_config = {
|
|
294
|
+
"project_id": config["project_id"],
|
|
295
|
+
"location": config["location"],
|
|
296
|
+
"remote_agent_engine_id": config["remote_agent_engine_id"],
|
|
297
|
+
}
|
|
298
|
+
adapter = WebSocketToQueueAdapter(
|
|
299
|
+
websocket, agent_engine=None, remote_config=remote_config
|
|
300
|
+
)
|
|
301
|
+
else:
|
|
302
|
+
# Local agent engine mode
|
|
303
|
+
# Dynamically import the pre-configured agent_engine object
|
|
304
|
+
agent_engine = _dynamic_import(config["agent_engine_object_path"])
|
|
305
|
+
logging.info(
|
|
306
|
+
f"Starting local agent engine with object: {type(agent_engine).__name__}"
|
|
307
|
+
)
|
|
308
|
+
|
|
309
|
+
adapter = WebSocketToQueueAdapter(websocket, agent_engine)
|
|
310
|
+
|
|
311
|
+
logging.info("Starting bidirectional communication with agent engine")
|
|
312
|
+
await asyncio.gather(
|
|
313
|
+
adapter.receive_from_client(),
|
|
314
|
+
adapter.run_agent_engine(),
|
|
315
|
+
)
|
|
316
|
+
|
|
317
|
+
return connect_and_run
|
|
318
|
+
|
|
319
|
+
|
|
320
|
+
@app.websocket("/ws")
|
|
321
|
+
async def websocket_endpoint(websocket: WebSocket) -> None:
|
|
322
|
+
"""Handle new websocket connections."""
|
|
323
|
+
await websocket.accept()
|
|
324
|
+
connect_and_run = get_connect_and_run_callable(websocket, app.state.config)
|
|
325
|
+
await connect_and_run()
|
|
326
|
+
|
|
327
|
+
|
|
328
|
+
class Feedback(BaseModel):
|
|
329
|
+
"""Represents feedback for a conversation."""
|
|
330
|
+
|
|
331
|
+
score: int | float
|
|
332
|
+
text: str | None = ""
|
|
333
|
+
log_type: Literal["feedback"] = "feedback"
|
|
334
|
+
user_id: str = Field(default_factory=lambda: str(uuid.uuid4()))
|
|
335
|
+
session_id: str = Field(default_factory=lambda: str(uuid.uuid4()))
|
|
336
|
+
|
|
337
|
+
|
|
338
|
+
@app.post("/feedback")
|
|
339
|
+
def collect_feedback(feedback: Feedback) -> dict[str, str]:
|
|
340
|
+
"""Collect and log feedback.
|
|
341
|
+
|
|
342
|
+
Args:
|
|
343
|
+
feedback: The feedback data to log
|
|
344
|
+
|
|
345
|
+
Returns:
|
|
346
|
+
Success message
|
|
347
|
+
"""
|
|
348
|
+
logger.log_struct(feedback.model_dump(), severity="INFO")
|
|
349
|
+
return {"status": "success"}
|
|
350
|
+
|
|
351
|
+
|
|
352
|
+
@app.get("/")
|
|
353
|
+
async def serve_frontend_root() -> FileResponse:
|
|
354
|
+
"""Serve the frontend index.html at the root path."""
|
|
355
|
+
index_file = frontend_build_dir / "index.html"
|
|
356
|
+
if index_file.exists():
|
|
357
|
+
return FileResponse(str(index_file))
|
|
358
|
+
raise HTTPException(
|
|
359
|
+
status_code=404,
|
|
360
|
+
detail="Frontend not built. Run 'npm run build' in the frontend directory.",
|
|
361
|
+
)
|
|
362
|
+
|
|
363
|
+
|
|
364
|
+
@app.get("/{full_path:path}")
|
|
365
|
+
async def serve_frontend_spa(full_path: str) -> FileResponse:
|
|
366
|
+
"""Catch-all route to serve the frontend for SPA routing.
|
|
367
|
+
|
|
368
|
+
This ensures that client-side routes are handled by the React app.
|
|
369
|
+
Excludes API routes (ws, feedback) and static assets.
|
|
370
|
+
"""
|
|
371
|
+
# Don't intercept API routes
|
|
372
|
+
if full_path.startswith(("ws", "feedback", "static", "api")):
|
|
373
|
+
raise HTTPException(status_code=404, detail="Not found")
|
|
374
|
+
|
|
375
|
+
# Serve index.html for all other routes (SPA routing)
|
|
376
|
+
index_file = frontend_build_dir / "index.html"
|
|
377
|
+
if index_file.exists():
|
|
378
|
+
return FileResponse(str(index_file))
|
|
379
|
+
raise HTTPException(
|
|
380
|
+
status_code=404,
|
|
381
|
+
detail="Frontend not built. Run 'npm run build' in the frontend directory.",
|
|
382
|
+
)
|
|
383
|
+
|
|
384
|
+
|
|
385
|
+
# Main execution
|
|
386
|
+
if __name__ == "__main__":
|
|
387
|
+
import argparse
|
|
388
|
+
|
|
389
|
+
import uvicorn
|
|
390
|
+
|
|
391
|
+
parser = argparse.ArgumentParser(description="Agent Engine Proxy Server")
|
|
392
|
+
parser.add_argument(
|
|
393
|
+
"--mode",
|
|
394
|
+
choices=["local", "remote"],
|
|
395
|
+
default="local",
|
|
396
|
+
help="Agent engine mode: 'local' for local agent or 'remote' for deployed agent engine",
|
|
397
|
+
)
|
|
398
|
+
parser.add_argument(
|
|
399
|
+
"--remote-id",
|
|
400
|
+
type=str,
|
|
401
|
+
help="Remote agent engine ID (required when mode=remote)",
|
|
402
|
+
)
|
|
403
|
+
parser.add_argument(
|
|
404
|
+
"--project-id", type=str, help="GCP project ID (required when mode=remote)"
|
|
405
|
+
)
|
|
406
|
+
parser.add_argument(
|
|
407
|
+
"--location",
|
|
408
|
+
type=str,
|
|
409
|
+
default="us-central1",
|
|
410
|
+
help="GCP location (default: us-central1)",
|
|
411
|
+
)
|
|
412
|
+
parser.add_argument(
|
|
413
|
+
"--local-agent",
|
|
414
|
+
type=str,
|
|
415
|
+
default="..agent.root_agent",
|
|
416
|
+
help="Python path to local agent callable (e.g., 'app.agent.root_agent')",
|
|
417
|
+
)
|
|
418
|
+
parser.add_argument(
|
|
419
|
+
"--agent-engine-object",
|
|
420
|
+
type=str,
|
|
421
|
+
default="..agent_engine_app.agent_engine",
|
|
422
|
+
help="Python path to agent engine object instance",
|
|
423
|
+
)
|
|
424
|
+
parser.add_argument(
|
|
425
|
+
"--port",
|
|
426
|
+
type=int,
|
|
427
|
+
default=8000,
|
|
428
|
+
help="Port to run the server on (default: 8000)",
|
|
429
|
+
)
|
|
430
|
+
parser.add_argument(
|
|
431
|
+
"--host",
|
|
432
|
+
type=str,
|
|
433
|
+
default="localhost",
|
|
434
|
+
help="Host to run the server on (default: localhost)",
|
|
435
|
+
)
|
|
436
|
+
|
|
437
|
+
args = parser.parse_args()
|
|
438
|
+
|
|
439
|
+
# Initialize configuration
|
|
440
|
+
config: dict[str, Any] = {
|
|
441
|
+
"use_remote_agent": False,
|
|
442
|
+
"remote_agent_engine_id": None,
|
|
443
|
+
"project_id": None,
|
|
444
|
+
"location": "us-central1",
|
|
445
|
+
"local_agent_path": args.local_agent,
|
|
446
|
+
"agent_engine_object_path": args.agent_engine_object,
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
if args.mode == "remote":
|
|
450
|
+
config["use_remote_agent"] = True
|
|
451
|
+
|
|
452
|
+
# Try to load from deployment_metadata.json if remote-id not provided
|
|
453
|
+
if not args.remote_id:
|
|
454
|
+
deployment_metadata_path = (
|
|
455
|
+
Path(__file__).parent.parent.parent / "deployment_metadata.json"
|
|
456
|
+
)
|
|
457
|
+
if deployment_metadata_path.exists():
|
|
458
|
+
with open(deployment_metadata_path) as f:
|
|
459
|
+
metadata = json.load(f)
|
|
460
|
+
config["remote_agent_engine_id"] = metadata.get(
|
|
461
|
+
"remote_agent_engine_id"
|
|
462
|
+
)
|
|
463
|
+
if not config["remote_agent_engine_id"]:
|
|
464
|
+
parser.error(
|
|
465
|
+
"No remote_agent_engine_id found in deployment_metadata.json"
|
|
466
|
+
)
|
|
467
|
+
print("Loaded remote agent engine ID from deployment_metadata.json")
|
|
468
|
+
else:
|
|
469
|
+
parser.error(
|
|
470
|
+
"--remote-id is required when deployment_metadata.json is not found"
|
|
471
|
+
)
|
|
472
|
+
else:
|
|
473
|
+
config["remote_agent_engine_id"] = args.remote_id
|
|
474
|
+
|
|
475
|
+
# Extract project ID from remote agent engine ID if not provided
|
|
476
|
+
if not args.project_id:
|
|
477
|
+
# Format: projects/PROJECT_ID/locations/LOCATION/reasoningEngines/ENGINE_ID
|
|
478
|
+
import re
|
|
479
|
+
|
|
480
|
+
match = re.match(
|
|
481
|
+
r"projects/([^/]+)/locations/([^/]+)/reasoningEngines/",
|
|
482
|
+
config["remote_agent_engine_id"],
|
|
483
|
+
)
|
|
484
|
+
if match:
|
|
485
|
+
config["project_id"] = match.group(1)
|
|
486
|
+
extracted_location = match.group(2)
|
|
487
|
+
config["location"] = (
|
|
488
|
+
args.location
|
|
489
|
+
if args.location != "us-central1"
|
|
490
|
+
else extracted_location
|
|
491
|
+
)
|
|
492
|
+
print("Extracted project ID and location from remote agent engine ID")
|
|
493
|
+
else:
|
|
494
|
+
# Fall back to google.auth.default()
|
|
495
|
+
try:
|
|
496
|
+
_, config["project_id"] = google.auth.default()
|
|
497
|
+
config["location"] = args.location
|
|
498
|
+
print(
|
|
499
|
+
f"Using default project ID from google.auth: {config['project_id']}"
|
|
500
|
+
)
|
|
501
|
+
except Exception as e:
|
|
502
|
+
parser.error(f"Could not determine project ID: {e}")
|
|
503
|
+
else:
|
|
504
|
+
config["project_id"] = args.project_id
|
|
505
|
+
config["location"] = args.location
|
|
506
|
+
|
|
507
|
+
print("Starting server in REMOTE mode:")
|
|
508
|
+
print(f" Remote Agent Engine ID: {config['remote_agent_engine_id']}")
|
|
509
|
+
print(f" Project ID: {config['project_id']}")
|
|
510
|
+
print(f" Location: {config['location']}")
|
|
511
|
+
else:
|
|
512
|
+
print("Starting server in LOCAL mode")
|
|
513
|
+
print(f" Using agent: {config['local_agent_path']}")
|
|
514
|
+
print(f" Using agent engine object: {config['agent_engine_object_path']}")
|
|
515
|
+
|
|
516
|
+
# Store configuration in app state
|
|
517
|
+
app.state.config = config
|
|
518
|
+
|
|
519
|
+
uvicorn.run(app, host=args.host, port=args.port)
|
|
@@ -0,0 +1,51 @@
|
|
|
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
|
+
FROM python:3.11-slim
|
|
16
|
+
|
|
17
|
+
RUN pip install --no-cache-dir uv==0.8.13
|
|
18
|
+
|
|
19
|
+
{%- if cookiecutter.is_adk_live %}
|
|
20
|
+
# Install Node.js for frontend build
|
|
21
|
+
RUN apt-get update && apt-get install -y \
|
|
22
|
+
curl \
|
|
23
|
+
&& curl -fsSL https://deb.nodesource.com/setup_18.x | bash - \
|
|
24
|
+
&& apt-get install -y nodejs \
|
|
25
|
+
&& apt-get clean \
|
|
26
|
+
&& rm -rf /var/lib/apt/lists/*
|
|
27
|
+
{%- endif %}
|
|
28
|
+
|
|
29
|
+
WORKDIR /code
|
|
30
|
+
|
|
31
|
+
COPY ./pyproject.toml ./README.md ./uv.lock* ./
|
|
32
|
+
|
|
33
|
+
COPY ./{{cookiecutter.agent_directory}} ./{{cookiecutter.agent_directory}}
|
|
34
|
+
|
|
35
|
+
{%- if cookiecutter.is_adk_live %}
|
|
36
|
+
# Copy and build frontend
|
|
37
|
+
COPY ./frontend ./frontend
|
|
38
|
+
RUN cd frontend && npm ci && npm run build
|
|
39
|
+
{%- endif %}
|
|
40
|
+
|
|
41
|
+
RUN uv sync --frozen
|
|
42
|
+
|
|
43
|
+
ARG COMMIT_SHA=""
|
|
44
|
+
ENV COMMIT_SHA=${COMMIT_SHA}
|
|
45
|
+
|
|
46
|
+
ARG AGENT_VERSION=0.0.0
|
|
47
|
+
ENV AGENT_VERSION=${AGENT_VERSION}
|
|
48
|
+
|
|
49
|
+
EXPOSE 8080
|
|
50
|
+
|
|
51
|
+
CMD ["uv", "run", "uvicorn", "{{cookiecutter.agent_directory}}.fast_api_app:app", "--host", "0.0.0.0", "--port", "8080"]
|