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
src/cli/commands/create.py
DELETED
|
@@ -1,664 +0,0 @@
|
|
|
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 logging
|
|
16
|
-
import os
|
|
17
|
-
import pathlib
|
|
18
|
-
import subprocess
|
|
19
|
-
|
|
20
|
-
import click
|
|
21
|
-
from click.core import ParameterSource
|
|
22
|
-
from rich.console import Console
|
|
23
|
-
from rich.prompt import IntPrompt, Prompt
|
|
24
|
-
|
|
25
|
-
from ..utils.datastores import DATASTORE_TYPES
|
|
26
|
-
from ..utils.gcp import verify_credentials, verify_vertex_connection
|
|
27
|
-
from ..utils.logging import handle_cli_error
|
|
28
|
-
from ..utils.template import (
|
|
29
|
-
get_available_agents,
|
|
30
|
-
get_template_path,
|
|
31
|
-
load_template_config,
|
|
32
|
-
process_template,
|
|
33
|
-
prompt_datastore_selection,
|
|
34
|
-
prompt_deployment_target,
|
|
35
|
-
)
|
|
36
|
-
|
|
37
|
-
console = Console()
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
def normalize_project_name(project_name: str) -> str:
|
|
41
|
-
"""Normalize project name for better compatibility with cloud resources and tools."""
|
|
42
|
-
|
|
43
|
-
needs_normalization = (
|
|
44
|
-
any(char.isupper() for char in project_name) or "_" in project_name
|
|
45
|
-
)
|
|
46
|
-
|
|
47
|
-
if needs_normalization:
|
|
48
|
-
normalized_name = project_name
|
|
49
|
-
console.print(
|
|
50
|
-
"Note: Project names are normalized (lowercase, hyphens only) for better compatibility with cloud resources and tools.",
|
|
51
|
-
style="dim",
|
|
52
|
-
)
|
|
53
|
-
if any(char.isupper() for char in normalized_name):
|
|
54
|
-
normalized_name = normalized_name.lower()
|
|
55
|
-
console.print(
|
|
56
|
-
f"Info: Converting to lowercase for compatibility: '{project_name}' -> '{normalized_name}'",
|
|
57
|
-
style="bold yellow",
|
|
58
|
-
)
|
|
59
|
-
|
|
60
|
-
if "_" in normalized_name:
|
|
61
|
-
# Capture the name state before this specific change
|
|
62
|
-
name_before_hyphenation = normalized_name
|
|
63
|
-
normalized_name = normalized_name.replace("_", "-")
|
|
64
|
-
console.print(
|
|
65
|
-
f"Info: Replacing underscores with hyphens for compatibility: '{name_before_hyphenation}' -> '{normalized_name}'",
|
|
66
|
-
style="yellow",
|
|
67
|
-
)
|
|
68
|
-
|
|
69
|
-
return normalized_name
|
|
70
|
-
|
|
71
|
-
return project_name
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
@click.command()
|
|
75
|
-
@click.pass_context
|
|
76
|
-
@click.argument("project_name")
|
|
77
|
-
@click.option("--agent", "-a", help="agent name or number to use")
|
|
78
|
-
@click.option(
|
|
79
|
-
"--deployment-target",
|
|
80
|
-
"-d",
|
|
81
|
-
type=click.Choice(["agent_engine", "cloud_run"]),
|
|
82
|
-
help="Deployment target name",
|
|
83
|
-
)
|
|
84
|
-
@click.option(
|
|
85
|
-
"--include-data-ingestion",
|
|
86
|
-
"-i",
|
|
87
|
-
is_flag=True,
|
|
88
|
-
help="Include data ingestion pipeline in the project",
|
|
89
|
-
)
|
|
90
|
-
@click.option(
|
|
91
|
-
"--datastore",
|
|
92
|
-
"-ds",
|
|
93
|
-
type=click.Choice(DATASTORE_TYPES),
|
|
94
|
-
help="Type of datastore to use for data ingestion (requires --include-data-ingestion)",
|
|
95
|
-
)
|
|
96
|
-
@click.option("--debug", is_flag=True, help="Enable debug logging")
|
|
97
|
-
@click.option(
|
|
98
|
-
"--output-dir",
|
|
99
|
-
"-o",
|
|
100
|
-
type=click.Path(),
|
|
101
|
-
help="Output directory for the project (default: current directory)",
|
|
102
|
-
)
|
|
103
|
-
@click.option(
|
|
104
|
-
"--auto-approve", is_flag=True, help="Skip credential confirmation prompts"
|
|
105
|
-
)
|
|
106
|
-
@click.option(
|
|
107
|
-
"--region",
|
|
108
|
-
help="GCP region for deployment (default: us-central1)",
|
|
109
|
-
default="us-central1",
|
|
110
|
-
)
|
|
111
|
-
@click.option(
|
|
112
|
-
"--skip-checks",
|
|
113
|
-
is_flag=True,
|
|
114
|
-
help="Skip verification checks for uv, GCP and Vertex AI",
|
|
115
|
-
default=False,
|
|
116
|
-
)
|
|
117
|
-
@handle_cli_error
|
|
118
|
-
def create(
|
|
119
|
-
ctx: click.Context,
|
|
120
|
-
project_name: str,
|
|
121
|
-
agent: str | None,
|
|
122
|
-
deployment_target: str | None,
|
|
123
|
-
include_data_ingestion: bool,
|
|
124
|
-
datastore: str | None,
|
|
125
|
-
debug: bool,
|
|
126
|
-
output_dir: str | None,
|
|
127
|
-
auto_approve: bool,
|
|
128
|
-
region: str,
|
|
129
|
-
skip_checks: bool,
|
|
130
|
-
) -> None:
|
|
131
|
-
"""Create GCP-based AI agent projects from templates."""
|
|
132
|
-
try:
|
|
133
|
-
# Display welcome banner
|
|
134
|
-
console.print("\n=== GCP Agent Starter Pack :rocket:===", style="bold blue")
|
|
135
|
-
console.print("Welcome to the Agent Starter Pack!")
|
|
136
|
-
console.print(
|
|
137
|
-
"This tool will help you create an end-to-end production-ready AI agent in GCP!\n"
|
|
138
|
-
)
|
|
139
|
-
# Validate project name
|
|
140
|
-
if len(project_name) > 26:
|
|
141
|
-
console.print(
|
|
142
|
-
f"Error: Project name '{project_name}' exceeds 26 characters. Please use a shorter name.",
|
|
143
|
-
style="bold red",
|
|
144
|
-
)
|
|
145
|
-
return
|
|
146
|
-
|
|
147
|
-
project_name = normalize_project_name(project_name)
|
|
148
|
-
|
|
149
|
-
# Setup debug logging if enabled
|
|
150
|
-
if debug:
|
|
151
|
-
logging.basicConfig(level=logging.DEBUG)
|
|
152
|
-
console.print("> Debug mode enabled")
|
|
153
|
-
logging.debug("Starting CLI in debug mode")
|
|
154
|
-
|
|
155
|
-
# Convert output_dir to Path if provided, otherwise use current directory
|
|
156
|
-
destination_dir = pathlib.Path(output_dir) if output_dir else pathlib.Path.cwd()
|
|
157
|
-
destination_dir = destination_dir.resolve() # Convert to absolute path
|
|
158
|
-
|
|
159
|
-
# Check if project would exist in output directory
|
|
160
|
-
project_path = destination_dir / project_name
|
|
161
|
-
if project_path.exists():
|
|
162
|
-
console.print(
|
|
163
|
-
f"Error: Project directory '{project_path}' already exists",
|
|
164
|
-
style="bold red",
|
|
165
|
-
)
|
|
166
|
-
return
|
|
167
|
-
|
|
168
|
-
# Agent selection
|
|
169
|
-
selected_agent = None
|
|
170
|
-
if agent:
|
|
171
|
-
agents = get_available_agents()
|
|
172
|
-
# First check if it's a valid agent name
|
|
173
|
-
if any(p["name"] == agent for p in agents.values()):
|
|
174
|
-
selected_agent = agent
|
|
175
|
-
else:
|
|
176
|
-
# Try numeric agent selection if input is a number
|
|
177
|
-
try:
|
|
178
|
-
agent_num = int(agent)
|
|
179
|
-
if agent_num in agents:
|
|
180
|
-
selected_agent = agents[agent_num]["name"]
|
|
181
|
-
else:
|
|
182
|
-
raise ValueError(f"Invalid agent number: {agent_num}")
|
|
183
|
-
except ValueError as err:
|
|
184
|
-
raise ValueError(f"Invalid agent name or number: {agent}") from err
|
|
185
|
-
|
|
186
|
-
final_agent = (
|
|
187
|
-
selected_agent
|
|
188
|
-
if selected_agent
|
|
189
|
-
else display_agent_selection(deployment_target)
|
|
190
|
-
)
|
|
191
|
-
if debug:
|
|
192
|
-
logging.debug(f"Selected agent: {agent}")
|
|
193
|
-
|
|
194
|
-
# Data ingestion and datastore selection
|
|
195
|
-
if include_data_ingestion or datastore:
|
|
196
|
-
# If datastore is specified but include_data_ingestion is not, set it to True
|
|
197
|
-
include_data_ingestion = True
|
|
198
|
-
|
|
199
|
-
# If include_data_ingestion is True but no datastore is specified, prompt for it
|
|
200
|
-
if not datastore:
|
|
201
|
-
# Pass a flag to indicate this is from explicit CLI flag
|
|
202
|
-
datastore = prompt_datastore_selection(final_agent, from_cli_flag=True)
|
|
203
|
-
|
|
204
|
-
if debug:
|
|
205
|
-
logging.debug(f"Data ingestion enabled: {include_data_ingestion}")
|
|
206
|
-
logging.debug(f"Selected datastore type: {datastore}")
|
|
207
|
-
else:
|
|
208
|
-
# Check if the agent requires data ingestion
|
|
209
|
-
template_path = (
|
|
210
|
-
pathlib.Path(__file__).parent.parent.parent.parent
|
|
211
|
-
/ "agents"
|
|
212
|
-
/ final_agent
|
|
213
|
-
/ "template"
|
|
214
|
-
)
|
|
215
|
-
config = load_template_config(template_path)
|
|
216
|
-
if config and config.get("settings", {}).get("requires_data_ingestion"):
|
|
217
|
-
include_data_ingestion = True
|
|
218
|
-
datastore = prompt_datastore_selection(final_agent)
|
|
219
|
-
|
|
220
|
-
if debug:
|
|
221
|
-
logging.debug(
|
|
222
|
-
f"Data ingestion required by agent: {include_data_ingestion}"
|
|
223
|
-
)
|
|
224
|
-
logging.debug(f"Selected datastore type: {datastore}")
|
|
225
|
-
|
|
226
|
-
# Deployment target selection
|
|
227
|
-
final_deployment = (
|
|
228
|
-
deployment_target
|
|
229
|
-
if deployment_target
|
|
230
|
-
else prompt_deployment_target(final_agent)
|
|
231
|
-
)
|
|
232
|
-
if debug:
|
|
233
|
-
logging.debug(f"Selected deployment target: {final_deployment}")
|
|
234
|
-
|
|
235
|
-
# Region confirmation (if not explicitly passed)
|
|
236
|
-
if (
|
|
237
|
-
not auto_approve
|
|
238
|
-
and ctx.get_parameter_source("region") != ParameterSource.COMMANDLINE
|
|
239
|
-
):
|
|
240
|
-
region = prompt_region_confirmation(region)
|
|
241
|
-
if debug:
|
|
242
|
-
logging.debug(f"Selected region: {region}")
|
|
243
|
-
|
|
244
|
-
# GCP Setup
|
|
245
|
-
logging.debug("Setting up GCP...")
|
|
246
|
-
|
|
247
|
-
creds_info = {}
|
|
248
|
-
if not skip_checks:
|
|
249
|
-
# Set up GCP environment
|
|
250
|
-
try:
|
|
251
|
-
creds_info = setup_gcp_environment(
|
|
252
|
-
auto_approve=auto_approve,
|
|
253
|
-
skip_checks=skip_checks,
|
|
254
|
-
region=region,
|
|
255
|
-
debug=debug,
|
|
256
|
-
)
|
|
257
|
-
except Exception as e:
|
|
258
|
-
if debug:
|
|
259
|
-
logging.warning(f"GCP environment setup failed: {e}")
|
|
260
|
-
console.print(
|
|
261
|
-
f"> Warning: GCP environment setup failed: {e}", style="yellow"
|
|
262
|
-
)
|
|
263
|
-
console.print(
|
|
264
|
-
"> Please check your authentication settings and permissions. "
|
|
265
|
-
"Visit https://cloud.google.com/vertex-ai/docs/authentication for help.",
|
|
266
|
-
style="yellow",
|
|
267
|
-
)
|
|
268
|
-
console.print(
|
|
269
|
-
"> Continuing with template processing...", style="yellow"
|
|
270
|
-
)
|
|
271
|
-
|
|
272
|
-
# Process template
|
|
273
|
-
template_path = get_template_path(final_agent, debug=debug)
|
|
274
|
-
if debug:
|
|
275
|
-
logging.debug(f"Template path: {template_path}")
|
|
276
|
-
logging.debug(f"Processing template for project: {project_name}")
|
|
277
|
-
|
|
278
|
-
# Create output directory if it doesn't exist
|
|
279
|
-
if not destination_dir.exists():
|
|
280
|
-
destination_dir.mkdir(parents=True)
|
|
281
|
-
|
|
282
|
-
if debug:
|
|
283
|
-
logging.debug(f"Output directory: {destination_dir}")
|
|
284
|
-
|
|
285
|
-
process_template(
|
|
286
|
-
final_agent,
|
|
287
|
-
template_path,
|
|
288
|
-
project_name,
|
|
289
|
-
deployment_target=final_deployment,
|
|
290
|
-
include_data_ingestion=include_data_ingestion,
|
|
291
|
-
datastore=datastore,
|
|
292
|
-
output_dir=destination_dir,
|
|
293
|
-
)
|
|
294
|
-
|
|
295
|
-
# Replace region in all files if a different region was specified
|
|
296
|
-
if region != "us-central1":
|
|
297
|
-
replace_region_in_files(project_path, region, debug=debug)
|
|
298
|
-
|
|
299
|
-
project_path = destination_dir / project_name
|
|
300
|
-
cd_path = project_path if output_dir else project_name
|
|
301
|
-
|
|
302
|
-
if include_data_ingestion:
|
|
303
|
-
project_id = creds_info.get("project", "")
|
|
304
|
-
console.print(
|
|
305
|
-
f"\n[bold white]===== DATA INGESTION SETUP =====[/bold white]\n"
|
|
306
|
-
f"This agent uses a datastore for grounded responses.\n"
|
|
307
|
-
f"The agent will work without data, but for optimal results:\n"
|
|
308
|
-
f"1. Set up dev environment:\n"
|
|
309
|
-
f" [white italic]export PROJECT_ID={project_id} && cd {cd_path} && make setup-dev-env[/white italic]\n\n"
|
|
310
|
-
f" See deployment/README.md for more info\n"
|
|
311
|
-
f"2. Run the data ingestion pipeline:\n"
|
|
312
|
-
f" [white italic]export PROJECT_ID={project_id} && cd {cd_path} && make data-ingestion[/white italic]\n\n"
|
|
313
|
-
f" See data_ingestion/README.md for more info\n"
|
|
314
|
-
f"[bold white]=================================[/bold white]\n"
|
|
315
|
-
)
|
|
316
|
-
console.print("\n> 👍 Done. Execute the following command to get started:")
|
|
317
|
-
|
|
318
|
-
console.print("\n> Success! Your agent project is ready.")
|
|
319
|
-
console.print(
|
|
320
|
-
"\n📖 For more information on project structure, usage, and deployment, check out the README:"
|
|
321
|
-
)
|
|
322
|
-
console.print(f" [cyan]cat {cd_path}/README.md[/]")
|
|
323
|
-
# Determine the correct path to display based on whether output_dir was specified
|
|
324
|
-
console.print("\n🚀 To get started, run the following command:")
|
|
325
|
-
console.print(
|
|
326
|
-
f" [bold bright_green]cd {cd_path} && make install && make playground[/]"
|
|
327
|
-
)
|
|
328
|
-
except Exception:
|
|
329
|
-
if debug:
|
|
330
|
-
logging.exception(
|
|
331
|
-
"An error occurred:"
|
|
332
|
-
) # This will print the full stack trace
|
|
333
|
-
raise
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
def prompt_region_confirmation(default_region: str = "us-central1") -> str:
|
|
337
|
-
"""Prompt user to confirm or change the default region."""
|
|
338
|
-
console.print(f"\n> Default GCP region is '{default_region}'")
|
|
339
|
-
new_region = Prompt.ask(
|
|
340
|
-
"Enter desired GCP region (leave blank for default)",
|
|
341
|
-
default="",
|
|
342
|
-
show_default=False,
|
|
343
|
-
)
|
|
344
|
-
|
|
345
|
-
return new_region if new_region else default_region
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
def display_agent_selection(deployment_target: str | None = None) -> str:
|
|
349
|
-
"""Display available agents and prompt for selection."""
|
|
350
|
-
agents = get_available_agents(deployment_target=deployment_target)
|
|
351
|
-
|
|
352
|
-
if not agents:
|
|
353
|
-
if deployment_target:
|
|
354
|
-
raise click.ClickException(
|
|
355
|
-
f"No agents available for deployment target '{deployment_target}'"
|
|
356
|
-
)
|
|
357
|
-
raise click.ClickException("No valid agents found")
|
|
358
|
-
|
|
359
|
-
console.print("\n> Please select a agent to get started:")
|
|
360
|
-
for num, agent in agents.items():
|
|
361
|
-
console.print(
|
|
362
|
-
f"{num}. [bold]{agent['name']}[/] - [dim]{agent['description']}[/]"
|
|
363
|
-
)
|
|
364
|
-
|
|
365
|
-
choice = IntPrompt.ask(
|
|
366
|
-
"\nEnter the number of your template choice", default=1, show_default=True
|
|
367
|
-
)
|
|
368
|
-
|
|
369
|
-
if choice not in agents:
|
|
370
|
-
raise ValueError(f"Invalid agent selection: {choice}")
|
|
371
|
-
|
|
372
|
-
return agents[choice]["name"]
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
def set_gcp_project(project_id: str, set_quota_project: bool = True) -> None:
|
|
376
|
-
"""Set the GCP project and optionally the application default quota project.
|
|
377
|
-
|
|
378
|
-
Args:
|
|
379
|
-
project_id: The GCP project ID to set.
|
|
380
|
-
set_quota_project: Whether to set the application default quota project.
|
|
381
|
-
"""
|
|
382
|
-
try:
|
|
383
|
-
subprocess.run(
|
|
384
|
-
["gcloud", "config", "set", "project", project_id],
|
|
385
|
-
check=True,
|
|
386
|
-
capture_output=True,
|
|
387
|
-
text=True,
|
|
388
|
-
)
|
|
389
|
-
except subprocess.CalledProcessError as e:
|
|
390
|
-
console.print(f"\n> Error setting project to {project_id}:")
|
|
391
|
-
console.print(e.stderr)
|
|
392
|
-
raise
|
|
393
|
-
|
|
394
|
-
if set_quota_project:
|
|
395
|
-
try:
|
|
396
|
-
subprocess.run(
|
|
397
|
-
[
|
|
398
|
-
"gcloud",
|
|
399
|
-
"auth",
|
|
400
|
-
"application-default",
|
|
401
|
-
"set-quota-project",
|
|
402
|
-
project_id,
|
|
403
|
-
],
|
|
404
|
-
check=True,
|
|
405
|
-
capture_output=True,
|
|
406
|
-
text=True,
|
|
407
|
-
)
|
|
408
|
-
except subprocess.CalledProcessError as e:
|
|
409
|
-
console.print("> Error setting application default quota project:")
|
|
410
|
-
console.print(e.stderr)
|
|
411
|
-
raise
|
|
412
|
-
|
|
413
|
-
console.print(f"> Successfully configured project: {project_id}")
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
def setup_gcp_environment(
|
|
417
|
-
auto_approve: bool, skip_checks: bool, region: str, debug: bool
|
|
418
|
-
) -> dict:
|
|
419
|
-
"""Set up the GCP environment with proper credentials and project.
|
|
420
|
-
|
|
421
|
-
Args:
|
|
422
|
-
auto_approve: Whether to skip confirmation prompts
|
|
423
|
-
skip_checks: Whether to skip verification checks
|
|
424
|
-
region: GCP region for deployment
|
|
425
|
-
debug: Whether debug logging is enabled
|
|
426
|
-
|
|
427
|
-
Returns:
|
|
428
|
-
Dictionary with credential information
|
|
429
|
-
"""
|
|
430
|
-
# Skip all verification if requested
|
|
431
|
-
if skip_checks:
|
|
432
|
-
if debug:
|
|
433
|
-
logging.debug("Skipping verification checks due to --skip-checks flag")
|
|
434
|
-
console.print("> Skipping verification checks", style="yellow")
|
|
435
|
-
return {"project": "unknown"}
|
|
436
|
-
|
|
437
|
-
# Verify current GCP credentials
|
|
438
|
-
if debug:
|
|
439
|
-
logging.debug("Verifying GCP credentials...")
|
|
440
|
-
creds_info = verify_credentials()
|
|
441
|
-
# Handle credential verification and project selection
|
|
442
|
-
if not auto_approve:
|
|
443
|
-
creds_info = _handle_credential_verification(creds_info)
|
|
444
|
-
# If user chose to skip verification, don't test Vertex AI connection
|
|
445
|
-
if creds_info.get("skip_vertex_test", False):
|
|
446
|
-
console.print("> Skipping Vertex AI connection test", style="yellow")
|
|
447
|
-
else:
|
|
448
|
-
# Test Vertex AI connection
|
|
449
|
-
_test_vertex_ai_connection(creds_info["project"], region)
|
|
450
|
-
else:
|
|
451
|
-
# Even with auto_approve, we should still set the GCP project
|
|
452
|
-
set_gcp_project(creds_info["project"], set_quota_project=True)
|
|
453
|
-
# Test Vertex AI connection
|
|
454
|
-
_test_vertex_ai_connection(creds_info["project"], region)
|
|
455
|
-
|
|
456
|
-
return creds_info
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
def _handle_credential_verification(creds_info: dict) -> dict:
|
|
460
|
-
"""Handle verification of credentials and project selection.
|
|
461
|
-
|
|
462
|
-
Args:
|
|
463
|
-
creds_info: Current credential information
|
|
464
|
-
|
|
465
|
-
Returns:
|
|
466
|
-
Updated credential information
|
|
467
|
-
"""
|
|
468
|
-
# Check if running in Cloud Shell
|
|
469
|
-
if os.environ.get("CLOUD_SHELL") == "true":
|
|
470
|
-
if creds_info["project"] == "":
|
|
471
|
-
console.print("> It looks like you are running in Cloud Shell.")
|
|
472
|
-
console.print(
|
|
473
|
-
"> You need to set up a project ID to continue, but you haven't setup a project yet."
|
|
474
|
-
)
|
|
475
|
-
new_project = Prompt.ask("\n> Enter a project ID")
|
|
476
|
-
creds_info["project"] = new_project
|
|
477
|
-
set_gcp_project(creds_info["project"], set_quota_project=False)
|
|
478
|
-
return creds_info
|
|
479
|
-
|
|
480
|
-
# Ask user if current credentials are correct or if they want to skip
|
|
481
|
-
console.print(f"\n> You are logged in with account: '{creds_info['account']}'")
|
|
482
|
-
console.print(f"> You are using project: '{creds_info['project']}'")
|
|
483
|
-
|
|
484
|
-
choices = ["Y", "skip", "edit"]
|
|
485
|
-
response = Prompt.ask(
|
|
486
|
-
"> Do you want to continue? (The CLI will check if Vertex AI is enabled in this project)",
|
|
487
|
-
choices=choices,
|
|
488
|
-
default="Y",
|
|
489
|
-
).lower()
|
|
490
|
-
|
|
491
|
-
if response == "skip":
|
|
492
|
-
console.print("> Skipping credential verification", style="yellow")
|
|
493
|
-
creds_info["skip_vertex_test"] = True
|
|
494
|
-
return creds_info
|
|
495
|
-
|
|
496
|
-
change_creds = response == "edit"
|
|
497
|
-
|
|
498
|
-
if change_creds:
|
|
499
|
-
# Handle credential change
|
|
500
|
-
console.print("\n> Initiating new login...")
|
|
501
|
-
subprocess.run(["gcloud", "auth", "login", "--update-adc"], check=True)
|
|
502
|
-
console.print("> Login successful. Verifying new credentials...")
|
|
503
|
-
|
|
504
|
-
# Re-verify credentials after login
|
|
505
|
-
creds_info = verify_credentials()
|
|
506
|
-
|
|
507
|
-
# Prompt for project change
|
|
508
|
-
console.print(
|
|
509
|
-
f"\n> You are now logged in with account: '{creds_info['account']}'."
|
|
510
|
-
)
|
|
511
|
-
console.print(f"> Current project is: '{creds_info['project']}'.")
|
|
512
|
-
choices = ["y", "skip", "edit"]
|
|
513
|
-
response = Prompt.ask(
|
|
514
|
-
"> Do you want to continue? (The CLI will verify Vertex AI access in this project)",
|
|
515
|
-
choices=choices,
|
|
516
|
-
default="y",
|
|
517
|
-
).lower()
|
|
518
|
-
|
|
519
|
-
if response == "skip":
|
|
520
|
-
console.print("> Skipping project verification", style="yellow")
|
|
521
|
-
creds_info["skip_vertex_test"] = True
|
|
522
|
-
return creds_info
|
|
523
|
-
|
|
524
|
-
if response == "edit":
|
|
525
|
-
# Prompt for new project ID
|
|
526
|
-
new_project = Prompt.ask("\n> Enter the new project ID")
|
|
527
|
-
creds_info["project"] = new_project
|
|
528
|
-
|
|
529
|
-
set_gcp_project(creds_info["project"], set_quota_project=True)
|
|
530
|
-
return creds_info
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
def _test_vertex_ai_connection(project_id: str, region: str) -> None:
|
|
534
|
-
"""Test connection to Vertex AI.
|
|
535
|
-
|
|
536
|
-
Args:
|
|
537
|
-
project_id: GCP project ID
|
|
538
|
-
region: GCP region for deployment
|
|
539
|
-
"""
|
|
540
|
-
console.print("> Testing GCP and Vertex AI Connection...")
|
|
541
|
-
try:
|
|
542
|
-
verify_vertex_connection(
|
|
543
|
-
project_id=project_id,
|
|
544
|
-
location=region,
|
|
545
|
-
)
|
|
546
|
-
console.print(
|
|
547
|
-
f"> ✓ Successfully verified connection to Vertex AI in project {project_id}"
|
|
548
|
-
)
|
|
549
|
-
except Exception as e:
|
|
550
|
-
console.print(
|
|
551
|
-
f"> ✗ Failed to connect to Vertex AI: {e!s}\n"
|
|
552
|
-
f"> Please check your authentication settings and permissions. "
|
|
553
|
-
f"Visit https://cloud.google.com/vertex-ai/docs/authentication for help.",
|
|
554
|
-
style="bold red",
|
|
555
|
-
)
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
def replace_region_in_files(
|
|
559
|
-
project_path: pathlib.Path, new_region: str, debug: bool = False
|
|
560
|
-
) -> None:
|
|
561
|
-
"""Replace all instances of 'us-central1' with the specified region in project files.
|
|
562
|
-
Also handles vertex_ai_search region mapping.
|
|
563
|
-
|
|
564
|
-
Args:
|
|
565
|
-
project_path: Path to the project directory
|
|
566
|
-
new_region: The new region to use
|
|
567
|
-
debug: Whether to enable debug logging
|
|
568
|
-
"""
|
|
569
|
-
if debug:
|
|
570
|
-
logging.debug(
|
|
571
|
-
f"Replacing region 'us-central1' with '{new_region}' in {project_path}"
|
|
572
|
-
)
|
|
573
|
-
|
|
574
|
-
# Define allowed file extensions
|
|
575
|
-
allowed_extensions = {
|
|
576
|
-
".md",
|
|
577
|
-
".py",
|
|
578
|
-
".tfvars",
|
|
579
|
-
".yaml",
|
|
580
|
-
".tf",
|
|
581
|
-
".yml",
|
|
582
|
-
"Makefile",
|
|
583
|
-
"makefile",
|
|
584
|
-
}
|
|
585
|
-
|
|
586
|
-
# Skip directories that shouldn't be modified
|
|
587
|
-
skip_dirs = {".git", "__pycache__", "venv", ".venv", "node_modules"}
|
|
588
|
-
|
|
589
|
-
# Determine data_store_region region value
|
|
590
|
-
if new_region.startswith("us"):
|
|
591
|
-
data_store_region = "us"
|
|
592
|
-
elif new_region.startswith("europe"):
|
|
593
|
-
data_store_region = "eu"
|
|
594
|
-
else:
|
|
595
|
-
data_store_region = "global"
|
|
596
|
-
|
|
597
|
-
for file_path in project_path.rglob("*"):
|
|
598
|
-
# Skip directories and files with unwanted extensions
|
|
599
|
-
if (
|
|
600
|
-
file_path.is_dir()
|
|
601
|
-
or any(skip_dir in file_path.parts for skip_dir in skip_dirs)
|
|
602
|
-
or (
|
|
603
|
-
file_path.suffix not in allowed_extensions
|
|
604
|
-
and file_path.name not in allowed_extensions
|
|
605
|
-
)
|
|
606
|
-
):
|
|
607
|
-
continue
|
|
608
|
-
|
|
609
|
-
try:
|
|
610
|
-
content = file_path.read_text()
|
|
611
|
-
modified = False
|
|
612
|
-
|
|
613
|
-
# Replace standard region references
|
|
614
|
-
if "us-central1" in content:
|
|
615
|
-
if debug:
|
|
616
|
-
logging.debug(f"Replacing region in {file_path}")
|
|
617
|
-
content = content.replace("us-central1", new_region)
|
|
618
|
-
modified = True
|
|
619
|
-
|
|
620
|
-
# Replace data_store_region region if present (all variants)
|
|
621
|
-
if 'data_store_region = "us"' in content:
|
|
622
|
-
if debug:
|
|
623
|
-
logging.debug(f"Replacing vertex_ai_search region in {file_path}")
|
|
624
|
-
content = content.replace(
|
|
625
|
-
'data_store_region = "us"',
|
|
626
|
-
f'data_store_region = "{data_store_region}"',
|
|
627
|
-
)
|
|
628
|
-
modified = True
|
|
629
|
-
elif 'data_store_region="us"' in content:
|
|
630
|
-
if debug:
|
|
631
|
-
logging.debug(f"Replacing data_store_region in {file_path}")
|
|
632
|
-
content = content.replace(
|
|
633
|
-
'data_store_region="us"', f'data_store_region="{data_store_region}"'
|
|
634
|
-
)
|
|
635
|
-
modified = True
|
|
636
|
-
elif 'data-store-region="us"' in content:
|
|
637
|
-
if debug:
|
|
638
|
-
logging.debug(f"Replacing data-store-region in {file_path}")
|
|
639
|
-
content = content.replace(
|
|
640
|
-
'data-store-region="us"', f'data-store-region="{data_store_region}"'
|
|
641
|
-
)
|
|
642
|
-
modified = True
|
|
643
|
-
elif "_DATA_STORE_REGION: us" in content:
|
|
644
|
-
if debug:
|
|
645
|
-
logging.debug(f"Replacing _DATA_STORE_REGION in {file_path}")
|
|
646
|
-
content = content.replace(
|
|
647
|
-
"_DATA_STORE_REGION: us", f"_DATA_STORE_REGION: {data_store_region}"
|
|
648
|
-
)
|
|
649
|
-
modified = True
|
|
650
|
-
elif '"DATA_STORE_REGION", "us"' in content:
|
|
651
|
-
if debug:
|
|
652
|
-
logging.debug(f"Replacing DATA_STORE_REGION in {file_path}")
|
|
653
|
-
content = content.replace(
|
|
654
|
-
'"DATA_STORE_REGION", "us"',
|
|
655
|
-
f'"DATA_STORE_REGION", "{data_store_region}"',
|
|
656
|
-
)
|
|
657
|
-
modified = True
|
|
658
|
-
|
|
659
|
-
if modified:
|
|
660
|
-
file_path.write_text(content)
|
|
661
|
-
|
|
662
|
-
except UnicodeDecodeError:
|
|
663
|
-
# Skip files that can't be read as text
|
|
664
|
-
continue
|