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,611 @@
|
|
|
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 pathlib
|
|
16
|
+
import re
|
|
17
|
+
import sys
|
|
18
|
+
from typing import Any
|
|
19
|
+
|
|
20
|
+
import click
|
|
21
|
+
from rich.console import Console
|
|
22
|
+
from rich.prompt import IntPrompt, Prompt
|
|
23
|
+
|
|
24
|
+
if sys.version_info >= (3, 11):
|
|
25
|
+
import tomllib
|
|
26
|
+
else:
|
|
27
|
+
import tomli as tomllib
|
|
28
|
+
|
|
29
|
+
from ..utils.logging import display_welcome_banner, handle_cli_error
|
|
30
|
+
from ..utils.template import get_available_agents, validate_agent_directory_name
|
|
31
|
+
from .create import (
|
|
32
|
+
create,
|
|
33
|
+
get_available_base_templates,
|
|
34
|
+
shared_template_options,
|
|
35
|
+
validate_base_template,
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
console = Console()
|
|
39
|
+
|
|
40
|
+
# Directories to exclude when scanning for agent directories
|
|
41
|
+
_EXCLUDED_DIRS = {
|
|
42
|
+
".git",
|
|
43
|
+
".github",
|
|
44
|
+
"__pycache__",
|
|
45
|
+
"node_modules",
|
|
46
|
+
".venv",
|
|
47
|
+
"venv",
|
|
48
|
+
"build",
|
|
49
|
+
"dist",
|
|
50
|
+
".terraform",
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def display_base_template_selection(current_base: str) -> str:
|
|
55
|
+
"""Display available base templates and prompt for selection."""
|
|
56
|
+
agents = get_available_agents()
|
|
57
|
+
|
|
58
|
+
if not agents:
|
|
59
|
+
raise click.ClickException("No base templates available")
|
|
60
|
+
|
|
61
|
+
console.print()
|
|
62
|
+
console.print("🔧 [bold]Base Template Selection[/bold]")
|
|
63
|
+
console.print()
|
|
64
|
+
console.print(f"Your project currently inherits from: [cyan]{current_base}[/cyan]")
|
|
65
|
+
console.print("Available base templates:")
|
|
66
|
+
|
|
67
|
+
# Create a mapping of choices to agent names
|
|
68
|
+
template_choices = {}
|
|
69
|
+
choice_num = 1
|
|
70
|
+
current_choice = None
|
|
71
|
+
|
|
72
|
+
for agent in agents.values():
|
|
73
|
+
template_choices[choice_num] = agent["name"]
|
|
74
|
+
current_indicator = " (current)" if agent["name"] == current_base else ""
|
|
75
|
+
console.print(
|
|
76
|
+
f" {choice_num}. [bold]{agent['name']}[/]{current_indicator} - [dim]{agent['description']}[/]"
|
|
77
|
+
)
|
|
78
|
+
if agent["name"] == current_base:
|
|
79
|
+
current_choice = choice_num
|
|
80
|
+
choice_num += 1
|
|
81
|
+
|
|
82
|
+
if current_choice is None:
|
|
83
|
+
current_choice = 1
|
|
84
|
+
|
|
85
|
+
console.print()
|
|
86
|
+
choice = IntPrompt.ask(
|
|
87
|
+
"Select base template", default=current_choice, show_default=True
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
if choice in template_choices:
|
|
91
|
+
return template_choices[choice]
|
|
92
|
+
else:
|
|
93
|
+
raise ValueError(f"Invalid base template selection: {choice}")
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
def display_agent_directory_selection(
|
|
97
|
+
current_dir: pathlib.Path, detected_directory: str, base_template: str | None = None
|
|
98
|
+
) -> str:
|
|
99
|
+
"""Display available directories and prompt for agent directory selection."""
|
|
100
|
+
# Determine the required object name based on base template
|
|
101
|
+
is_adk = base_template and "adk" in base_template.lower()
|
|
102
|
+
required_object = "root_agent" if is_adk else "agent"
|
|
103
|
+
|
|
104
|
+
while True:
|
|
105
|
+
console.print()
|
|
106
|
+
console.print("📁 [bold]Agent Directory Selection[/bold]")
|
|
107
|
+
console.print()
|
|
108
|
+
console.print("Your project needs an agent directory containing:")
|
|
109
|
+
console.print(" • [cyan]agent.py[/cyan] file with your agent logic")
|
|
110
|
+
console.print(
|
|
111
|
+
f" • [cyan]{required_object}[/cyan] variable defined in agent.py"
|
|
112
|
+
)
|
|
113
|
+
console.print()
|
|
114
|
+
console.print("Choose where your agent code is located:")
|
|
115
|
+
|
|
116
|
+
# Get all directories in the current path (excluding hidden and common non-agent dirs)
|
|
117
|
+
available_dirs = [
|
|
118
|
+
item.name
|
|
119
|
+
for item in current_dir.iterdir()
|
|
120
|
+
if (
|
|
121
|
+
item.is_dir()
|
|
122
|
+
and not item.name.startswith(".")
|
|
123
|
+
and item.name not in _EXCLUDED_DIRS
|
|
124
|
+
)
|
|
125
|
+
]
|
|
126
|
+
|
|
127
|
+
# Sort directories and create choices
|
|
128
|
+
available_dirs.sort()
|
|
129
|
+
|
|
130
|
+
directory_choices = {}
|
|
131
|
+
choice_num = 1
|
|
132
|
+
default_choice = None
|
|
133
|
+
|
|
134
|
+
# Only include the detected directory if it actually exists
|
|
135
|
+
if detected_directory in available_dirs:
|
|
136
|
+
directory_choices[choice_num] = detected_directory
|
|
137
|
+
current_indicator = (
|
|
138
|
+
" (detected)" if detected_directory != "app" else " (default)"
|
|
139
|
+
)
|
|
140
|
+
console.print(
|
|
141
|
+
f" {choice_num}. [bold]{detected_directory}[/]{current_indicator}"
|
|
142
|
+
)
|
|
143
|
+
default_choice = choice_num
|
|
144
|
+
choice_num += 1
|
|
145
|
+
# Remove from available_dirs to avoid duplication
|
|
146
|
+
available_dirs.remove(detected_directory)
|
|
147
|
+
|
|
148
|
+
# Add other available directories
|
|
149
|
+
for dir_name in available_dirs:
|
|
150
|
+
directory_choices[choice_num] = dir_name
|
|
151
|
+
# Check if this directory might contain agent code
|
|
152
|
+
agent_py_exists = (current_dir / dir_name / "agent.py").exists()
|
|
153
|
+
hint = " (has agent.py)" if agent_py_exists else ""
|
|
154
|
+
console.print(f" {choice_num}. [bold]{dir_name}[/]{hint}")
|
|
155
|
+
if (
|
|
156
|
+
default_choice is None
|
|
157
|
+
): # If no detected directory exists, use first available as default
|
|
158
|
+
default_choice = choice_num
|
|
159
|
+
choice_num += 1
|
|
160
|
+
|
|
161
|
+
# Add option for custom directory
|
|
162
|
+
custom_choice = choice_num
|
|
163
|
+
directory_choices[custom_choice] = "__custom__"
|
|
164
|
+
console.print(f" {custom_choice}. [bold]Enter custom directory name[/]")
|
|
165
|
+
|
|
166
|
+
# If no directories found and no default set, default to custom option
|
|
167
|
+
if default_choice is None:
|
|
168
|
+
default_choice = custom_choice
|
|
169
|
+
|
|
170
|
+
console.print()
|
|
171
|
+
choice = IntPrompt.ask(
|
|
172
|
+
"Select agent directory", default=default_choice, show_default=True
|
|
173
|
+
)
|
|
174
|
+
|
|
175
|
+
if choice in directory_choices:
|
|
176
|
+
selected = directory_choices[choice]
|
|
177
|
+
if selected == "__custom__":
|
|
178
|
+
console.print()
|
|
179
|
+
while True:
|
|
180
|
+
custom_dir = Prompt.ask(
|
|
181
|
+
"Enter custom agent directory name", default=detected_directory
|
|
182
|
+
)
|
|
183
|
+
try:
|
|
184
|
+
validate_agent_directory_name(custom_dir)
|
|
185
|
+
return custom_dir
|
|
186
|
+
except ValueError as e:
|
|
187
|
+
console.print(f"[bold red]Error:[/] {e}", style="bold red")
|
|
188
|
+
console.print("Please try again with a valid directory name.")
|
|
189
|
+
else:
|
|
190
|
+
# Validate existing directory selection as well
|
|
191
|
+
try:
|
|
192
|
+
validate_agent_directory_name(selected)
|
|
193
|
+
return selected
|
|
194
|
+
except ValueError as e:
|
|
195
|
+
console.print(f"[bold red]Error:[/] {e}", style="bold red")
|
|
196
|
+
console.print(
|
|
197
|
+
"This directory cannot be used as an agent directory. Please select another option."
|
|
198
|
+
)
|
|
199
|
+
console.print()
|
|
200
|
+
# Continue the loop to re-prompt without recursion
|
|
201
|
+
continue
|
|
202
|
+
else:
|
|
203
|
+
console.print(
|
|
204
|
+
f"[bold red]Error:[/] Invalid selection: {choice}", style="bold red"
|
|
205
|
+
)
|
|
206
|
+
console.print("Please choose a valid option from the list.")
|
|
207
|
+
console.print()
|
|
208
|
+
# Continue the loop to re-prompt without recursion
|
|
209
|
+
continue
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
@click.command()
|
|
213
|
+
@click.pass_context
|
|
214
|
+
@click.argument(
|
|
215
|
+
"template_path",
|
|
216
|
+
type=click.Path(path_type=pathlib.Path),
|
|
217
|
+
default=".",
|
|
218
|
+
required=False,
|
|
219
|
+
)
|
|
220
|
+
@click.option(
|
|
221
|
+
"--name",
|
|
222
|
+
"-n",
|
|
223
|
+
help="Project name for templating (defaults to current directory name)",
|
|
224
|
+
)
|
|
225
|
+
@click.option(
|
|
226
|
+
"--base-template",
|
|
227
|
+
"-b",
|
|
228
|
+
help="Base template to inherit from (e.g., adk_base, langgraph_base, agentic_rag)",
|
|
229
|
+
)
|
|
230
|
+
@click.option(
|
|
231
|
+
"--adk",
|
|
232
|
+
is_flag=True,
|
|
233
|
+
help="Shortcut for --base-template adk_base",
|
|
234
|
+
)
|
|
235
|
+
@shared_template_options
|
|
236
|
+
@handle_cli_error
|
|
237
|
+
def enhance(
|
|
238
|
+
ctx: click.Context,
|
|
239
|
+
template_path: pathlib.Path,
|
|
240
|
+
name: str | None,
|
|
241
|
+
deployment_target: str | None,
|
|
242
|
+
cicd_runner: str | None,
|
|
243
|
+
include_data_ingestion: bool,
|
|
244
|
+
datastore: str | None,
|
|
245
|
+
session_type: str | None,
|
|
246
|
+
debug: bool,
|
|
247
|
+
auto_approve: bool,
|
|
248
|
+
region: str,
|
|
249
|
+
skip_checks: bool,
|
|
250
|
+
agent_garden: bool,
|
|
251
|
+
base_template: str | None,
|
|
252
|
+
adk: bool,
|
|
253
|
+
agent_directory: str | None,
|
|
254
|
+
) -> None:
|
|
255
|
+
"""Enhance your existing project with AI agent capabilities.
|
|
256
|
+
|
|
257
|
+
This command is an alias for 'create' with --in-folder mode enabled, designed to
|
|
258
|
+
add agent-starter-pack features to your existing project in-place rather than
|
|
259
|
+
creating a new project directory.
|
|
260
|
+
|
|
261
|
+
For best compatibility, your project should follow the agent-starter-pack structure
|
|
262
|
+
with agent code organized in an agent directory (default: /app, configurable via
|
|
263
|
+
--agent-directory).
|
|
264
|
+
|
|
265
|
+
TEMPLATE_PATH can be:
|
|
266
|
+
- A local directory path (e.g., . for current directory)
|
|
267
|
+
- An agent name (e.g., adk_base)
|
|
268
|
+
- A remote template (e.g., adk@data-science)
|
|
269
|
+
|
|
270
|
+
The command will validate your project structure and provide guidance if needed.
|
|
271
|
+
"""
|
|
272
|
+
|
|
273
|
+
# Display welcome banner for enhance command
|
|
274
|
+
display_welcome_banner(enhance_mode=True)
|
|
275
|
+
|
|
276
|
+
# Handle --adk shortcut
|
|
277
|
+
if adk:
|
|
278
|
+
if base_template:
|
|
279
|
+
raise click.ClickException(
|
|
280
|
+
"Cannot use --adk with --base-template. Use one or the other."
|
|
281
|
+
)
|
|
282
|
+
base_template = "adk_base"
|
|
283
|
+
|
|
284
|
+
# Validate base template if provided
|
|
285
|
+
if base_template and not validate_base_template(base_template):
|
|
286
|
+
available_templates = get_available_base_templates()
|
|
287
|
+
console.print(
|
|
288
|
+
f"Error: Base template '{base_template}' not found.", style="bold red"
|
|
289
|
+
)
|
|
290
|
+
console.print(
|
|
291
|
+
f"Available base templates: {', '.join(available_templates)}",
|
|
292
|
+
style="yellow",
|
|
293
|
+
)
|
|
294
|
+
return
|
|
295
|
+
|
|
296
|
+
# Determine project name
|
|
297
|
+
if name:
|
|
298
|
+
project_name = name
|
|
299
|
+
else:
|
|
300
|
+
# Use current directory name as default
|
|
301
|
+
current_dir = pathlib.Path.cwd()
|
|
302
|
+
project_name = current_dir.name
|
|
303
|
+
console.print(
|
|
304
|
+
f"Using current directory name as project name: {project_name}", style="dim"
|
|
305
|
+
)
|
|
306
|
+
|
|
307
|
+
# Show confirmation prompt for enhancement unless auto-approved
|
|
308
|
+
if not auto_approve:
|
|
309
|
+
current_dir = pathlib.Path.cwd()
|
|
310
|
+
console.print()
|
|
311
|
+
console.print(
|
|
312
|
+
"🚀 [blue]Ready to enhance your project with deployment capabilities[/blue]"
|
|
313
|
+
)
|
|
314
|
+
console.print(f"📂 {current_dir}")
|
|
315
|
+
console.print()
|
|
316
|
+
console.print("[bold]What will happen:[/bold]")
|
|
317
|
+
console.print("• New template files will be added to this directory")
|
|
318
|
+
console.print("• Your existing files will be preserved")
|
|
319
|
+
console.print("• A backup will be created before any changes")
|
|
320
|
+
console.print()
|
|
321
|
+
|
|
322
|
+
if not click.confirm(
|
|
323
|
+
f"Continue with enhancement? {click.style('[Y/n]: ', fg='blue', bold=True)}",
|
|
324
|
+
default=True,
|
|
325
|
+
show_default=False,
|
|
326
|
+
):
|
|
327
|
+
console.print("✋ [yellow]Enhancement cancelled.[/yellow]")
|
|
328
|
+
return
|
|
329
|
+
console.print()
|
|
330
|
+
|
|
331
|
+
# Determine agent specification based on template_path
|
|
332
|
+
if template_path == pathlib.Path("."):
|
|
333
|
+
# Current directory - use local@ syntax
|
|
334
|
+
agent_spec = "local@."
|
|
335
|
+
elif template_path.is_dir():
|
|
336
|
+
# Other local directory
|
|
337
|
+
agent_spec = f"local@{template_path.resolve()}"
|
|
338
|
+
else:
|
|
339
|
+
# Assume it's an agent name or remote spec
|
|
340
|
+
agent_spec = str(template_path)
|
|
341
|
+
|
|
342
|
+
# Show base template inheritance info early for local projects
|
|
343
|
+
if agent_spec.startswith("local@"):
|
|
344
|
+
from ..utils.remote_template import (
|
|
345
|
+
get_base_template_name,
|
|
346
|
+
load_remote_template_config,
|
|
347
|
+
)
|
|
348
|
+
|
|
349
|
+
# Prepare CLI overrides for base template and agent directory
|
|
350
|
+
cli_overrides: dict[str, Any] = {}
|
|
351
|
+
if base_template:
|
|
352
|
+
cli_overrides["base_template"] = base_template
|
|
353
|
+
if agent_directory:
|
|
354
|
+
cli_overrides["settings"] = cli_overrides.get("settings", {})
|
|
355
|
+
cli_overrides["settings"]["agent_directory"] = agent_directory
|
|
356
|
+
|
|
357
|
+
# Load config from current directory for inheritance info
|
|
358
|
+
current_dir = pathlib.Path.cwd()
|
|
359
|
+
source_config = load_remote_template_config(current_dir, cli_overrides)
|
|
360
|
+
original_base_template_name = get_base_template_name(source_config)
|
|
361
|
+
|
|
362
|
+
# Interactive base template selection if not provided via CLI and not auto-approved
|
|
363
|
+
if not base_template and not auto_approve:
|
|
364
|
+
selected_base_template = display_base_template_selection(
|
|
365
|
+
original_base_template_name
|
|
366
|
+
)
|
|
367
|
+
# Always set base_template to the selected value (even if unchanged)
|
|
368
|
+
base_template = selected_base_template
|
|
369
|
+
if selected_base_template != original_base_template_name:
|
|
370
|
+
# Update CLI overrides with the selected base template
|
|
371
|
+
cli_overrides["base_template"] = selected_base_template
|
|
372
|
+
# Preserve agent_directory override if it was set
|
|
373
|
+
if agent_directory:
|
|
374
|
+
cli_overrides["settings"] = cli_overrides.get("settings", {})
|
|
375
|
+
cli_overrides["settings"]["agent_directory"] = agent_directory
|
|
376
|
+
console.print(
|
|
377
|
+
f"✅ Selected base template: [cyan]{selected_base_template}[/cyan]"
|
|
378
|
+
)
|
|
379
|
+
console.print()
|
|
380
|
+
|
|
381
|
+
# Reload config with potential base template override
|
|
382
|
+
if cli_overrides.get("base_template"):
|
|
383
|
+
source_config = load_remote_template_config(current_dir, cli_overrides)
|
|
384
|
+
|
|
385
|
+
base_template_name = get_base_template_name(source_config)
|
|
386
|
+
|
|
387
|
+
# Show current inheritance info
|
|
388
|
+
if not auto_approve or base_template:
|
|
389
|
+
console.print()
|
|
390
|
+
console.print(
|
|
391
|
+
f"Template inherits from base: [cyan][link=https://github.com/GoogleCloudPlatform/agent-starter-pack/tree/main/agents/{base_template_name}]{base_template_name}[/link][/cyan]"
|
|
392
|
+
)
|
|
393
|
+
console.print()
|
|
394
|
+
|
|
395
|
+
# Validate project structure when using current directory template
|
|
396
|
+
if template_path == pathlib.Path("."):
|
|
397
|
+
current_dir = pathlib.Path.cwd()
|
|
398
|
+
|
|
399
|
+
# Determine agent directory: CLI param > pyproject.toml detection > default
|
|
400
|
+
detected_agent_directory = "app" # default
|
|
401
|
+
if not agent_directory: # Only try to detect if not provided via CLI
|
|
402
|
+
pyproject_path = current_dir / "pyproject.toml"
|
|
403
|
+
if pyproject_path.exists():
|
|
404
|
+
try:
|
|
405
|
+
with open(pyproject_path, "rb") as f:
|
|
406
|
+
pyproject_data = tomllib.load(f)
|
|
407
|
+
packages = (
|
|
408
|
+
pyproject_data.get("tool", {})
|
|
409
|
+
.get("hatch", {})
|
|
410
|
+
.get("build", {})
|
|
411
|
+
.get("targets", {})
|
|
412
|
+
.get("wheel", {})
|
|
413
|
+
.get("packages", [])
|
|
414
|
+
)
|
|
415
|
+
if packages:
|
|
416
|
+
# Find the first package that isn't 'frontend'
|
|
417
|
+
for pkg in packages:
|
|
418
|
+
if pkg != "frontend":
|
|
419
|
+
detected_agent_directory = pkg
|
|
420
|
+
break
|
|
421
|
+
except Exception as e:
|
|
422
|
+
if debug:
|
|
423
|
+
console.print(
|
|
424
|
+
f"[dim]Could not auto-detect agent directory: {e}[/dim]"
|
|
425
|
+
)
|
|
426
|
+
pass # Fall back to default
|
|
427
|
+
|
|
428
|
+
# Interactive agent directory selection if not provided via CLI and not auto-approved
|
|
429
|
+
if not agent_directory and not auto_approve:
|
|
430
|
+
selected_agent_directory = display_agent_directory_selection(
|
|
431
|
+
current_dir, detected_agent_directory, base_template
|
|
432
|
+
)
|
|
433
|
+
final_agent_directory = selected_agent_directory
|
|
434
|
+
console.print(
|
|
435
|
+
f"✅ Selected agent directory: [cyan]{selected_agent_directory}[/cyan]"
|
|
436
|
+
)
|
|
437
|
+
console.print()
|
|
438
|
+
else:
|
|
439
|
+
final_agent_directory = agent_directory or detected_agent_directory
|
|
440
|
+
|
|
441
|
+
# Show info about agent directory selection
|
|
442
|
+
if agent_directory:
|
|
443
|
+
console.print(
|
|
444
|
+
f"ℹ️ Using CLI-specified agent directory: [cyan]{agent_directory}[/cyan]"
|
|
445
|
+
)
|
|
446
|
+
elif detected_agent_directory != "app":
|
|
447
|
+
console.print(
|
|
448
|
+
f"ℹ️ Auto-detected agent directory: [cyan]{detected_agent_directory}[/cyan]"
|
|
449
|
+
)
|
|
450
|
+
|
|
451
|
+
agent_folder = current_dir / final_agent_directory
|
|
452
|
+
|
|
453
|
+
if not agent_folder.exists() or not agent_folder.is_dir():
|
|
454
|
+
console.print()
|
|
455
|
+
console.print(
|
|
456
|
+
"━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
457
|
+
)
|
|
458
|
+
console.print("⚠️ [bold yellow]PROJECT STRUCTURE WARNING[/bold yellow] ⚠️")
|
|
459
|
+
console.print(
|
|
460
|
+
"━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
461
|
+
)
|
|
462
|
+
console.print()
|
|
463
|
+
console.print(
|
|
464
|
+
f"📁 [bold]Expected Structure:[/bold] [cyan]/{final_agent_directory}[/cyan] folder containing your agent code"
|
|
465
|
+
)
|
|
466
|
+
console.print(f"📍 [bold]Current Directory:[/bold] {current_dir}")
|
|
467
|
+
console.print(
|
|
468
|
+
f"❌ [bold red]Missing:[/bold red] /{final_agent_directory} folder"
|
|
469
|
+
)
|
|
470
|
+
console.print()
|
|
471
|
+
console.print(
|
|
472
|
+
f"The enhance command can still proceed, but for best compatibility"
|
|
473
|
+
f" your agent code should be organized in a /{final_agent_directory} folder structure."
|
|
474
|
+
)
|
|
475
|
+
console.print()
|
|
476
|
+
|
|
477
|
+
# Ask for confirmation after showing the structure warning
|
|
478
|
+
console.print("💡 Options:")
|
|
479
|
+
console.print(
|
|
480
|
+
f" • Create a /{final_agent_directory} folder and move your agent code there"
|
|
481
|
+
)
|
|
482
|
+
if final_agent_directory == "app":
|
|
483
|
+
console.print(
|
|
484
|
+
" • Use [cyan]--agent-directory <custom_name>[/cyan] if your agent code is in a different directory"
|
|
485
|
+
)
|
|
486
|
+
else:
|
|
487
|
+
console.print(
|
|
488
|
+
" • Use [cyan]--agent-directory <custom_name>[/cyan] to specify your existing agent directory"
|
|
489
|
+
)
|
|
490
|
+
console.print()
|
|
491
|
+
|
|
492
|
+
if not auto_approve:
|
|
493
|
+
if not click.confirm(
|
|
494
|
+
f"Continue with enhancement despite missing /{final_agent_directory} folder?",
|
|
495
|
+
default=True,
|
|
496
|
+
):
|
|
497
|
+
console.print("✋ [yellow]Enhancement cancelled.[/yellow]")
|
|
498
|
+
return
|
|
499
|
+
else:
|
|
500
|
+
# Check for agent.py and validate required object
|
|
501
|
+
agent_py = agent_folder / "agent.py"
|
|
502
|
+
|
|
503
|
+
# Determine required object outside of if/else blocks to avoid NameError
|
|
504
|
+
is_adk = base_template and "adk" in base_template.lower()
|
|
505
|
+
required_object = "root_agent" if is_adk else "agent"
|
|
506
|
+
|
|
507
|
+
if agent_py.exists():
|
|
508
|
+
console.print(
|
|
509
|
+
f"✅ Found [cyan]/{final_agent_directory}/agent.py[/cyan]"
|
|
510
|
+
)
|
|
511
|
+
|
|
512
|
+
try:
|
|
513
|
+
content = agent_py.read_text(encoding="utf-8")
|
|
514
|
+
|
|
515
|
+
# Look for the required object definition using static analysis
|
|
516
|
+
patterns = [
|
|
517
|
+
rf"^\s*{required_object}\s*=", # assignment: root_agent = ...
|
|
518
|
+
rf"^\s*def\s+{required_object}", # function: def root_agent(...)
|
|
519
|
+
rf"from\s+.*\s+import\s+.*{required_object}", # import: from ... import root_agent
|
|
520
|
+
]
|
|
521
|
+
|
|
522
|
+
found = any(
|
|
523
|
+
re.search(pattern, content, re.MULTILINE)
|
|
524
|
+
for pattern in patterns
|
|
525
|
+
)
|
|
526
|
+
|
|
527
|
+
if found:
|
|
528
|
+
console.print(
|
|
529
|
+
f"✅ Found '{required_object}' definition in {final_agent_directory}/agent.py"
|
|
530
|
+
)
|
|
531
|
+
else:
|
|
532
|
+
console.print(
|
|
533
|
+
f"⚠️ [yellow]Missing '{required_object}' variable in {final_agent_directory}/agent.py[/yellow]"
|
|
534
|
+
)
|
|
535
|
+
console.print(
|
|
536
|
+
" This variable should contain your main agent instance for deployment."
|
|
537
|
+
)
|
|
538
|
+
console.print(
|
|
539
|
+
f" Example: [cyan]{required_object} = YourAgentClass()[/cyan]"
|
|
540
|
+
)
|
|
541
|
+
# Show ADK docs link for ADK templates
|
|
542
|
+
if is_adk:
|
|
543
|
+
console.print(
|
|
544
|
+
" 📖 Learn more: [cyan][link=https://google.github.io/adk-docs/get-started/quickstart/#agentpy]ADK agent.py guide[/link][/cyan]"
|
|
545
|
+
)
|
|
546
|
+
console.print()
|
|
547
|
+
if not auto_approve:
|
|
548
|
+
if not click.confirm(
|
|
549
|
+
f"Continue enhancement? (You can add '{required_object}' later)",
|
|
550
|
+
default=True,
|
|
551
|
+
):
|
|
552
|
+
console.print(
|
|
553
|
+
"✋ [yellow]Enhancement cancelled.[/yellow]"
|
|
554
|
+
)
|
|
555
|
+
return
|
|
556
|
+
|
|
557
|
+
except Exception as e:
|
|
558
|
+
console.print(
|
|
559
|
+
f"⚠️ [yellow]Warning: Could not read {final_agent_directory}/agent.py: {e}[/yellow]"
|
|
560
|
+
)
|
|
561
|
+
else:
|
|
562
|
+
console.print(
|
|
563
|
+
f"⚠️ [yellow]Warning: {final_agent_directory}/agent.py not found[/yellow]"
|
|
564
|
+
)
|
|
565
|
+
console.print(
|
|
566
|
+
f" Create {final_agent_directory}/agent.py with your agent logic and define: [cyan]{required_object} = your_agent_instance[/cyan]"
|
|
567
|
+
)
|
|
568
|
+
console.print()
|
|
569
|
+
if not auto_approve:
|
|
570
|
+
if not click.confirm(
|
|
571
|
+
f"Continue enhancement? (An example {final_agent_directory}/agent.py will be created for you)",
|
|
572
|
+
default=True,
|
|
573
|
+
):
|
|
574
|
+
console.print("✋ [yellow]Enhancement cancelled.[/yellow]")
|
|
575
|
+
return
|
|
576
|
+
|
|
577
|
+
# Prepare CLI overrides to pass to create command
|
|
578
|
+
final_cli_overrides: dict[str, Any] = {}
|
|
579
|
+
if base_template:
|
|
580
|
+
final_cli_overrides["base_template"] = base_template
|
|
581
|
+
|
|
582
|
+
# For current directory templates, ensure agent_directory is included in cli_overrides
|
|
583
|
+
# final_agent_directory is set from interactive selection or CLI/detection
|
|
584
|
+
if template_path == pathlib.Path(".") and final_agent_directory:
|
|
585
|
+
final_cli_overrides["settings"] = final_cli_overrides.get("settings", {})
|
|
586
|
+
final_cli_overrides["settings"]["agent_directory"] = final_agent_directory
|
|
587
|
+
|
|
588
|
+
# Call the create command with in-folder mode enabled
|
|
589
|
+
ctx.invoke(
|
|
590
|
+
create,
|
|
591
|
+
project_name=project_name,
|
|
592
|
+
agent=agent_spec,
|
|
593
|
+
deployment_target=deployment_target,
|
|
594
|
+
cicd_runner=cicd_runner,
|
|
595
|
+
include_data_ingestion=include_data_ingestion,
|
|
596
|
+
datastore=datastore,
|
|
597
|
+
session_type=session_type,
|
|
598
|
+
debug=debug,
|
|
599
|
+
output_dir=None, # Use current directory
|
|
600
|
+
auto_approve=auto_approve,
|
|
601
|
+
region=region,
|
|
602
|
+
skip_checks=skip_checks,
|
|
603
|
+
in_folder=True, # Always use in-folder mode for enhance
|
|
604
|
+
agent_directory=final_agent_directory
|
|
605
|
+
if template_path == pathlib.Path(".")
|
|
606
|
+
else agent_directory,
|
|
607
|
+
agent_garden=agent_garden,
|
|
608
|
+
base_template=base_template,
|
|
609
|
+
skip_welcome=True, # Skip welcome message since enhance shows its own
|
|
610
|
+
cli_overrides=final_cli_overrides if final_cli_overrides else None,
|
|
611
|
+
)
|