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.
Files changed (255) hide show
  1. agent_starter_pack/agents/README.md +7 -0
  2. agents/langgraph_base_react/template/.templateconfig.yaml → agent_starter_pack/agents/adk_a2a_base/.template/templateconfig.yaml +5 -10
  3. agent_starter_pack/agents/adk_a2a_base/README.md +37 -0
  4. src/deployment_targets/cloud_run/Dockerfile → agent_starter_pack/agents/adk_a2a_base/app/__init__.py +2 -14
  5. agent_starter_pack/agents/adk_a2a_base/app/agent.py +70 -0
  6. agent_starter_pack/agents/adk_a2a_base/notebooks/adk_a2a_app_testing.ipynb +583 -0
  7. agents/crewai_coding_crew/notebooks/evaluating_crewai_agent.ipynb → agent_starter_pack/agents/adk_a2a_base/notebooks/evaluating_adk_agent.ipynb +163 -199
  8. {agents/adk_base → agent_starter_pack/agents/adk_a2a_base}/tests/integration/test_agent.py +2 -2
  9. agents/adk_base/template/.templateconfig.yaml → agent_starter_pack/agents/adk_base/.template/templateconfig.yaml +4 -1
  10. {agents → agent_starter_pack/agents}/adk_base/README.md +1 -1
  11. agent_starter_pack/agents/adk_base/app/__init__.py +17 -0
  12. {agents → agent_starter_pack/agents}/adk_base/app/agent.py +5 -2
  13. {agents → agent_starter_pack/agents}/adk_base/notebooks/adk_app_testing.ipynb +128 -82
  14. agents/langgraph_base_react/notebooks/evaluating_langgraph_agent.ipynb → agent_starter_pack/agents/adk_base/notebooks/evaluating_adk_agent.ipynb +181 -207
  15. agent_starter_pack/agents/adk_base/tests/integration/test_agent.py +58 -0
  16. agents/crewai_coding_crew/template/.templateconfig.yaml → agent_starter_pack/agents/adk_live/.template/templateconfig.yaml +5 -9
  17. agent_starter_pack/agents/adk_live/README.md +32 -0
  18. agent_starter_pack/agents/adk_live/app/__init__.py +17 -0
  19. agent_starter_pack/agents/adk_live/app/agent.py +51 -0
  20. agent_starter_pack/agents/adk_live/tests/unit/test_dummy.py +38 -0
  21. agents/agentic_rag/template/.templateconfig.yaml → agent_starter_pack/agents/agentic_rag/.template/templateconfig.yaml +7 -3
  22. {agents → agent_starter_pack/agents}/agentic_rag/README.md +1 -1
  23. agent_starter_pack/agents/agentic_rag/app/__init__.py +17 -0
  24. {agents → agent_starter_pack/agents}/agentic_rag/app/agent.py +8 -4
  25. {agents → agent_starter_pack/agents}/agentic_rag/notebooks/adk_app_testing.ipynb +128 -82
  26. agent_starter_pack/agents/agentic_rag/notebooks/evaluating_adk_agent.ipynb +1535 -0
  27. {agents → agent_starter_pack/agents}/agentic_rag/tests/integration/test_agent.py +3 -3
  28. agent_starter_pack/agents/langgraph_base/.template/templateconfig.yaml +31 -0
  29. agent_starter_pack/agents/langgraph_base/README.md +30 -0
  30. agent_starter_pack/agents/langgraph_base/app/__init__.py +17 -0
  31. agent_starter_pack/agents/langgraph_base/app/agent.py +34 -0
  32. {agents/crewai_coding_crew → agent_starter_pack/agents/langgraph_base}/notebooks/evaluating_langgraph_agent.ipynb +30 -17
  33. {agents/langgraph_base_react → agent_starter_pack/agents/langgraph_base}/tests/integration/test_agent.py +2 -2
  34. {src → agent_starter_pack}/base_template/.gitignore +5 -3
  35. agent_starter_pack/base_template/GEMINI.md +5 -0
  36. agent_starter_pack/base_template/Makefile +339 -0
  37. agent_starter_pack/base_template/README.md +267 -0
  38. agent_starter_pack/base_template/deployment/README.md +11 -0
  39. {src → agent_starter_pack}/base_template/deployment/terraform/apis.tf +2 -2
  40. {src → agent_starter_pack}/base_template/deployment/terraform/dev/apis.tf +6 -1
  41. {src → agent_starter_pack}/base_template/deployment/terraform/dev/iam.tf +12 -11
  42. {src → agent_starter_pack}/base_template/deployment/terraform/dev/providers.tf +5 -1
  43. {src → agent_starter_pack}/base_template/deployment/terraform/dev/storage.tf +1 -1
  44. {src → agent_starter_pack}/base_template/deployment/terraform/dev/variables.tf +10 -10
  45. agent_starter_pack/base_template/deployment/terraform/dev/{% if cookiecutter.is_adk %}telemetry.tf{% else %}unused_telemetry.tf{% endif %} +193 -0
  46. agent_starter_pack/base_template/deployment/terraform/github.tf +337 -0
  47. {src → agent_starter_pack}/base_template/deployment/terraform/iam.tf +20 -41
  48. {src → agent_starter_pack}/base_template/deployment/terraform/locals.tf +10 -3
  49. {src/resources/setup_cicd → agent_starter_pack/base_template/deployment/terraform}/providers.tf +8 -1
  50. {src → agent_starter_pack}/base_template/deployment/terraform/service_accounts.tf +7 -8
  51. agent_starter_pack/base_template/deployment/terraform/sql/completions.sql +138 -0
  52. {src → agent_starter_pack}/base_template/deployment/terraform/storage.tf +7 -16
  53. {src → agent_starter_pack}/base_template/deployment/terraform/variables.tf +61 -28
  54. {src → agent_starter_pack}/base_template/deployment/terraform/vars/env.tfvars +6 -1
  55. agent_starter_pack/base_template/deployment/terraform/{% if cookiecutter.cicd_runner == 'github_actions' %}wif.tf{% else %}unused_wif.tf{% endif %} +43 -0
  56. 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
  57. agent_starter_pack/base_template/deployment/terraform/{% if cookiecutter.is_adk %}telemetry.tf{% else %}unused_telemetry.tf{% endif %} +206 -0
  58. {src → agent_starter_pack}/base_template/pyproject.toml +24 -37
  59. agent_starter_pack/base_template/{% if cookiecutter.cicd_runner == 'github_actions' %}.github{% else %}unused_github{% endif %}/workflows/deploy-to-prod.yaml +132 -0
  60. agent_starter_pack/base_template/{% if cookiecutter.cicd_runner == 'github_actions' %}.github{% else %}unused_github{% endif %}/workflows/pr_checks.yaml +65 -0
  61. agent_starter_pack/base_template/{% if cookiecutter.cicd_runner == 'github_actions' %}.github{% else %}unused_github{% endif %}/workflows/staging.yaml +259 -0
  62. 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
  63. 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
  64. agent_starter_pack/base_template/{% if cookiecutter.cicd_runner == 'google_cloud_build' %}.cloudbuild{% else %}unused_.cloudbuild{% endif %}/staging.yaml +322 -0
  65. agent_starter_pack/base_template/{{cookiecutter.agent_directory}}/app_utils/telemetry.py +96 -0
  66. {src/base_template/app/utils → agent_starter_pack/base_template/{{cookiecutter.agent_directory}}/app_utils}/typing.py +7 -9
  67. 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
  68. 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
  69. 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
  70. 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
  71. 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
  72. agent_starter_pack/cli/commands/create.py +1256 -0
  73. agent_starter_pack/cli/commands/enhance.py +611 -0
  74. agent_starter_pack/cli/commands/list.py +203 -0
  75. agent_starter_pack/cli/commands/register_gemini_enterprise.py +1070 -0
  76. agent_starter_pack/cli/commands/setup_cicd.py +862 -0
  77. {src → agent_starter_pack}/cli/main.py +10 -2
  78. {src → agent_starter_pack}/cli/utils/cicd.py +139 -48
  79. agent_starter_pack/cli/utils/gcp.py +263 -0
  80. agent_starter_pack/cli/utils/logging.py +103 -0
  81. agent_starter_pack/cli/utils/remote_template.py +677 -0
  82. agent_starter_pack/cli/utils/template.py +1466 -0
  83. {src → agent_starter_pack}/data_ingestion/data_ingestion_pipeline/components/process_data.py +1 -1
  84. {src → agent_starter_pack}/data_ingestion/data_ingestion_pipeline/submit_pipeline.py +20 -6
  85. {src → agent_starter_pack}/data_ingestion/pyproject.toml +1 -0
  86. {src → agent_starter_pack}/data_ingestion/uv.lock +602 -494
  87. agent_starter_pack/deployment_targets/agent_engine/tests/integration/test_agent_engine_app.py +484 -0
  88. agent_starter_pack/deployment_targets/agent_engine/tests/load_test/README.md +84 -0
  89. agent_starter_pack/deployment_targets/agent_engine/tests/load_test/load_test.py +424 -0
  90. agent_starter_pack/deployment_targets/agent_engine/tests/{% if cookiecutter.is_a2a %}helpers.py{% else %}unused_helpers.py{% endif %} +138 -0
  91. agent_starter_pack/deployment_targets/agent_engine/{{cookiecutter.agent_directory}}/agent_engine_app.py +263 -0
  92. agent_starter_pack/deployment_targets/agent_engine/{{cookiecutter.agent_directory}}/app_utils/deploy.py +414 -0
  93. 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
  94. agent_starter_pack/deployment_targets/cloud_run/Dockerfile +51 -0
  95. agent_starter_pack/deployment_targets/cloud_run/deployment/terraform/dev/service.tf +243 -0
  96. agent_starter_pack/deployment_targets/cloud_run/deployment/terraform/service.tf +417 -0
  97. agent_starter_pack/deployment_targets/cloud_run/tests/integration/test_server_e2e.py +705 -0
  98. agent_starter_pack/deployment_targets/cloud_run/tests/load_test/.results/.placeholder +321 -0
  99. agent_starter_pack/deployment_targets/cloud_run/tests/load_test/README.md +165 -0
  100. agent_starter_pack/deployment_targets/cloud_run/tests/load_test/load_test.py +329 -0
  101. agent_starter_pack/deployment_targets/cloud_run/{{cookiecutter.agent_directory}}/fast_api_app.py +556 -0
  102. {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/package-lock.json +79 -1044
  103. {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/package.json +1 -9
  104. agent_starter_pack/frontends/adk_live_react/frontend/src/App.tsx +65 -0
  105. {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/src/components/logger/Logger.tsx +8 -3
  106. {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/src/components/logger/logger.scss +26 -0
  107. agent_starter_pack/frontends/adk_live_react/frontend/src/components/side-panel/SidePanel.tsx +516 -0
  108. agent_starter_pack/frontends/adk_live_react/frontend/src/components/side-panel/side-panel.scss +563 -0
  109. agent_starter_pack/frontends/adk_live_react/frontend/src/components/transcription-preview/TranscriptionPreview.tsx +106 -0
  110. agent_starter_pack/frontends/adk_live_react/frontend/src/components/transcription-preview/transcription-preview.scss +150 -0
  111. {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/src/hooks/use-live-api.ts +8 -2
  112. {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/src/multimodal-live-types.ts +40 -2
  113. {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/src/utils/audio-recorder.ts +1 -1
  114. {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/src/utils/audio-streamer.ts +1 -1
  115. {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/src/utils/multimodal-live-client.ts +210 -24
  116. {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/src/utils/utils.ts +27 -5
  117. agent_starter_pack/resources/docs/adk-cheatsheet.md +1628 -0
  118. agent_starter_pack/resources/locks/uv-adk_a2a_base-agent_engine.lock +4966 -0
  119. agent_starter_pack/resources/locks/uv-adk_a2a_base-cloud_run.lock +5011 -0
  120. agent_starter_pack/resources/locks/uv-adk_base-agent_engine.lock +4946 -0
  121. agent_starter_pack/resources/locks/uv-adk_base-cloud_run.lock +4991 -0
  122. agent_starter_pack/resources/locks/uv-adk_live-agent_engine.lock +4963 -0
  123. agent_starter_pack/resources/locks/uv-adk_live-cloud_run.lock +5006 -0
  124. agent_starter_pack/resources/locks/uv-agentic_rag-agent_engine.lock +5487 -0
  125. agent_starter_pack/resources/locks/uv-agentic_rag-cloud_run.lock +5532 -0
  126. agent_starter_pack/resources/locks/uv-langgraph_base-agent_engine.lock +5788 -0
  127. agent_starter_pack/resources/locks/uv-langgraph_base-cloud_run.lock +5811 -0
  128. {src → agent_starter_pack}/utils/generate_locks.py +15 -12
  129. {src → agent_starter_pack}/utils/lock_utils.py +4 -7
  130. {src → agent_starter_pack}/utils/watch_and_rebuild.py +2 -2
  131. agent_starter_pack-0.21.0.dist-info/METADATA +182 -0
  132. agent_starter_pack-0.21.0.dist-info/RECORD +171 -0
  133. agent_starter_pack-0.21.0.dist-info/entry_points.txt +2 -0
  134. llm.txt +362 -0
  135. agent_starter_pack-0.3.3.dist-info/METADATA +0 -164
  136. agent_starter_pack-0.3.3.dist-info/RECORD +0 -176
  137. agent_starter_pack-0.3.3.dist-info/entry_points.txt +0 -2
  138. agents/crewai_coding_crew/README.md +0 -34
  139. agents/crewai_coding_crew/app/agent.py +0 -86
  140. agents/crewai_coding_crew/app/crew/config/agents.yaml +0 -39
  141. agents/crewai_coding_crew/app/crew/config/tasks.yaml +0 -37
  142. agents/crewai_coding_crew/app/crew/crew.py +0 -71
  143. agents/crewai_coding_crew/tests/integration/test_agent.py +0 -47
  144. agents/langgraph_base_react/README.md +0 -9
  145. agents/langgraph_base_react/app/agent.py +0 -73
  146. agents/live_api/README.md +0 -37
  147. agents/live_api/app/agent.py +0 -78
  148. agents/live_api/app/server.py +0 -196
  149. agents/live_api/app/templates.py +0 -51
  150. agents/live_api/app/vector_store.py +0 -55
  151. agents/live_api/template/.templateconfig.yaml +0 -29
  152. agents/live_api/tests/integration/test_server_e2e.py +0 -254
  153. agents/live_api/tests/load_test/load_test.py +0 -40
  154. agents/live_api/tests/unit/test_server.py +0 -143
  155. src/base_template/Makefile +0 -72
  156. src/base_template/README.md +0 -208
  157. src/base_template/app/__init__.py +0 -3
  158. src/base_template/app/utils/tracing.py +0 -155
  159. src/base_template/deployment/README.md +0 -126
  160. src/base_template/deployment/cd/staging.yaml +0 -216
  161. src/base_template/deployment/terraform/dev/log_sinks.tf +0 -63
  162. src/base_template/deployment/terraform/log_sinks.tf +0 -70
  163. src/base_template/deployment/terraform/providers.tf +0 -37
  164. src/cli/commands/create.py +0 -664
  165. src/cli/commands/setup_cicd.py +0 -829
  166. src/cli/utils/gcp.py +0 -117
  167. src/cli/utils/logging.py +0 -51
  168. src/cli/utils/template.py +0 -737
  169. src/deployment_targets/agent_engine/app/agent_engine_app.py +0 -336
  170. src/deployment_targets/agent_engine/notebooks/intro_agent_engine.ipynb +0 -1025
  171. src/deployment_targets/agent_engine/tests/integration/test_agent_engine_app.py +0 -183
  172. src/deployment_targets/agent_engine/tests/load_test/README.md +0 -42
  173. src/deployment_targets/agent_engine/tests/load_test/load_test.py +0 -107
  174. src/deployment_targets/cloud_run/app/server.py +0 -154
  175. src/deployment_targets/cloud_run/tests/integration/test_server_e2e.py +0 -249
  176. src/deployment_targets/cloud_run/tests/load_test/.results/.placeholder +0 -0
  177. src/deployment_targets/cloud_run/tests/load_test/README.md +0 -83
  178. src/deployment_targets/cloud_run/tests/load_test/load_test.py +0 -118
  179. src/deployment_targets/cloud_run/uv.lock +0 -6952
  180. src/frontends/live_api_react/frontend/src/App.tsx +0 -205
  181. src/frontends/live_api_react/frontend/src/components/control-tray/ControlTray.tsx +0 -217
  182. src/frontends/live_api_react/frontend/src/components/control-tray/control-tray.scss +0 -201
  183. src/frontends/live_api_react/frontend/src/components/side-panel/SidePanel.tsx +0 -161
  184. src/frontends/live_api_react/frontend/src/components/side-panel/side-panel.scss +0 -285
  185. src/frontends/streamlit/frontend/side_bar.py +0 -214
  186. src/frontends/streamlit/frontend/streamlit_app.py +0 -265
  187. src/frontends/streamlit/frontend/style/app_markdown.py +0 -37
  188. src/frontends/streamlit/frontend/utils/chat_utils.py +0 -67
  189. src/frontends/streamlit/frontend/utils/local_chat_history.py +0 -125
  190. src/frontends/streamlit/frontend/utils/message_editing.py +0 -59
  191. src/frontends/streamlit/frontend/utils/multimodal_utils.py +0 -217
  192. src/frontends/streamlit/frontend/utils/stream_handler.py +0 -301
  193. src/frontends/streamlit/frontend/utils/title_summary.py +0 -94
  194. src/frontends/streamlit_adk/frontend/side_bar.py +0 -214
  195. src/frontends/streamlit_adk/frontend/streamlit_app.py +0 -314
  196. src/frontends/streamlit_adk/frontend/style/app_markdown.py +0 -37
  197. src/frontends/streamlit_adk/frontend/utils/chat_utils.py +0 -84
  198. src/frontends/streamlit_adk/frontend/utils/local_chat_history.py +0 -110
  199. src/frontends/streamlit_adk/frontend/utils/message_editing.py +0 -61
  200. src/frontends/streamlit_adk/frontend/utils/multimodal_utils.py +0 -223
  201. src/frontends/streamlit_adk/frontend/utils/stream_handler.py +0 -311
  202. src/frontends/streamlit_adk/frontend/utils/title_summary.py +0 -129
  203. src/resources/containers/data_processing/Dockerfile +0 -27
  204. src/resources/containers/e2e-tests/Dockerfile +0 -19
  205. src/resources/idx/.idx/dev.nix +0 -57
  206. src/resources/idx/idx-template.json +0 -21
  207. src/resources/idx/idx-template.nix +0 -26
  208. src/resources/locks/uv-adk_base-agent_engine.lock +0 -5338
  209. src/resources/locks/uv-adk_base-cloud_run.lock +0 -5930
  210. src/resources/locks/uv-agentic_rag-agent_engine.lock +0 -5528
  211. src/resources/locks/uv-agentic_rag-cloud_run.lock +0 -6120
  212. src/resources/locks/uv-crewai_coding_crew-agent_engine.lock +0 -6231
  213. src/resources/locks/uv-crewai_coding_crew-cloud_run.lock +0 -6839
  214. src/resources/locks/uv-langgraph_base_react-agent_engine.lock +0 -5233
  215. src/resources/locks/uv-langgraph_base_react-cloud_run.lock +0 -5862
  216. src/resources/locks/uv-live_api-cloud_run.lock +0 -5832
  217. src/resources/setup_cicd/cicd_variables.tf +0 -41
  218. src/resources/setup_cicd/github.tf +0 -87
  219. {agents → agent_starter_pack/agents}/agentic_rag/app/retrievers.py +0 -0
  220. {agents → agent_starter_pack/agents}/agentic_rag/app/templates.py +0 -0
  221. {src → agent_starter_pack}/base_template/deployment/terraform/dev/vars/env.tfvars +0 -0
  222. {src → agent_starter_pack}/base_template/tests/unit/test_dummy.py +0 -0
  223. {src/deployment_targets/agent_engine/app/utils → agent_starter_pack/base_template/{{cookiecutter.agent_directory}}/app_utils}/gcs.py +0 -0
  224. {src → agent_starter_pack}/cli/utils/__init__.py +0 -0
  225. {src → agent_starter_pack}/cli/utils/datastores.py +0 -0
  226. {src → agent_starter_pack}/cli/utils/version.py +0 -0
  227. {src → agent_starter_pack}/data_ingestion/README.md +0 -0
  228. {src → agent_starter_pack}/data_ingestion/data_ingestion_pipeline/components/ingest_data.py +0 -0
  229. {src → agent_starter_pack}/data_ingestion/data_ingestion_pipeline/pipeline.py +0 -0
  230. {src → agent_starter_pack}/deployment_targets/agent_engine/deployment_metadata.json +0 -0
  231. {src → agent_starter_pack}/deployment_targets/agent_engine/tests/load_test/.results/.placeholder +0 -0
  232. {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/public/favicon.ico +0 -0
  233. {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/public/index.html +0 -0
  234. {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/public/robots.txt +0 -0
  235. {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/src/App.scss +0 -0
  236. {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/src/App.test.tsx +0 -0
  237. {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/src/components/audio-pulse/AudioPulse.tsx +0 -0
  238. {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/src/components/audio-pulse/audio-pulse.scss +0 -0
  239. {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/src/components/logger/mock-logs.ts +0 -0
  240. {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/src/contexts/LiveAPIContext.tsx +0 -0
  241. {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/src/hooks/use-media-stream-mux.ts +0 -0
  242. {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/src/hooks/use-screen-capture.ts +0 -0
  243. {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/src/hooks/use-webcam.ts +0 -0
  244. {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/src/index.css +0 -0
  245. {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/src/index.tsx +0 -0
  246. {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/src/react-app-env.d.ts +0 -0
  247. {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/src/reportWebVitals.ts +0 -0
  248. {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/src/setupTests.ts +0 -0
  249. {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/src/utils/audioworklet-registry.ts +0 -0
  250. {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/src/utils/store-logger.ts +0 -0
  251. {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/src/utils/worklets/audio-processing.ts +0 -0
  252. {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/src/utils/worklets/vol-meter.ts +0 -0
  253. {src/frontends/live_api_react → agent_starter_pack/frontends/adk_live_react}/frontend/tsconfig.json +0 -0
  254. {agent_starter_pack-0.3.3.dist-info → agent_starter_pack-0.21.0.dist-info}/WHEEL +0 -0
  255. {agent_starter_pack-0.3.3.dist-info → agent_starter_pack-0.21.0.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,267 @@
1
+ # {{cookiecutter.project_name}}
2
+
3
+ {{cookiecutter.agent_description}}
4
+ Agent generated with [`googleCloudPlatform/agent-starter-pack`](https://github.com/GoogleCloudPlatform/agent-starter-pack) version `{{ cookiecutter.package_version }}`
5
+
6
+ ## Project Structure
7
+
8
+ This project is organized as follows:
9
+
10
+ ```
11
+ {{cookiecutter.project_name}}/
12
+ ├── {{cookiecutter.agent_directory}}/ # Core application code
13
+ │ ├── agent.py # Main agent logic
14
+ {%- if cookiecutter.deployment_target == 'cloud_run' %}
15
+ │ ├── fast_api_app.py # FastAPI Backend server
16
+ {%- elif cookiecutter.deployment_target == 'agent_engine' %}
17
+ │ ├── agent_engine_app.py # Agent Engine application logic
18
+ {%- endif %}
19
+ │ └── app_utils/ # App utilities and helpers
20
+ {%- if cookiecutter.is_a2a and cookiecutter.agent_name == 'langgraph_base' %}
21
+ │ ├── executor/ # A2A protocol executor implementation
22
+ │ └── converters/ # Message converters for A2A protocol
23
+ {%- endif %}
24
+ {%- if cookiecutter.cicd_runner == 'google_cloud_build' %}
25
+ ├── .cloudbuild/ # CI/CD pipeline configurations for Google Cloud Build
26
+ {%- elif cookiecutter.cicd_runner == 'github_actions' %}
27
+ ├── .github/ # CI/CD pipeline configurations for GitHub Actions
28
+ {%- endif %}
29
+ ├── deployment/ # Infrastructure and deployment scripts
30
+ ├── notebooks/ # Jupyter notebooks for prototyping and evaluation
31
+ ├── tests/ # Unit, integration, and load tests
32
+ ├── Makefile # Makefile for common commands
33
+ ├── GEMINI.md # AI-assisted development guide
34
+ └── pyproject.toml # Project dependencies and configuration
35
+ ```
36
+
37
+ ## Requirements
38
+
39
+ Before you begin, ensure you have:
40
+ - **uv**: Python package manager (used for all dependency management in this project) - [Install](https://docs.astral.sh/uv/getting-started/installation/) ([add packages](https://docs.astral.sh/uv/concepts/dependencies/) with `uv add <package>`)
41
+ - **Google Cloud SDK**: For GCP services - [Install](https://cloud.google.com/sdk/docs/install)
42
+ - **Terraform**: For infrastructure deployment - [Install](https://developer.hashicorp.com/terraform/downloads)
43
+ - **make**: Build automation tool - [Install](https://www.gnu.org/software/make/) (pre-installed on most Unix-based systems)
44
+
45
+
46
+ ## Quick Start (Local Testing)
47
+
48
+ Install required packages and launch the local development environment:
49
+
50
+ ```bash
51
+ make install && make playground
52
+ ```
53
+
54
+ ## Commands
55
+
56
+ | Command | Description |
57
+ | -------------------- | ------------------------------------------------------------------------------------------- |
58
+ | `make install` | Install all required dependencies using uv |
59
+ {%- if cookiecutter.settings.get("commands", {}).get("extra", {}) %}
60
+ {%- for cmd_name, cmd_value in cookiecutter.settings.get("commands", {}).get("extra", {}).items() %}
61
+ | `make {{ cmd_name }}` | {% if cmd_value is mapping %}{% if cmd_value.description %}{{ cmd_value.description }}{% else %}{% if cookiecutter.deployment_target in cmd_value %}{{ cmd_value[cookiecutter.deployment_target] }}{% else %}{{ cmd_value.command if cmd_value.command is string else "" }}{% endif %}{% endif %}{% else %}{{ cmd_value }}{% endif %} |
62
+ {%- endfor %}
63
+ {%- endif %}
64
+ {%- if cookiecutter.deployment_target == 'cloud_run' %}
65
+ | `make playground` | Launch local development environment with backend and frontend{%- if cookiecutter.is_adk %} - leveraging `adk web` command. {%- endif %}|
66
+ | `make deploy` | Deploy agent to Cloud Run (use `IAP=true` to enable Identity-Aware Proxy, `PORT=8080` to specify container port) |
67
+ | `make local-backend` | Launch local development server with hot-reload |
68
+ {%- elif cookiecutter.deployment_target == 'agent_engine' %}
69
+ | `make playground` | Launch local development environment for testing agent |
70
+ | `make deploy` | Deploy agent to Agent Engine |
71
+ {%- if cookiecutter.is_adk_live %}
72
+ | `make local-backend` | Launch local development server with hot-reload |
73
+ | `make ui` | Start the frontend UI separately for development (requires backend running separately) |
74
+ | `make playground-dev` | Launch dev playground with both frontend and backend hot-reload |
75
+ | `make playground-remote` | Connect to remote deployed agent with local frontend |
76
+ | `make build-frontend` | Build the frontend for production |
77
+ {%- endif %}
78
+ {%- if cookiecutter.is_adk or cookiecutter.is_a2a %}
79
+ | `make register-gemini-enterprise` | Register deployed agent to Gemini Enterprise ([docs](https://googlecloudplatform.github.io/agent-starter-pack/cli/register_gemini_enterprise.html)) |
80
+ {%- endif -%}
81
+ {%- endif -%}
82
+ {%- if cookiecutter.is_a2a %}
83
+ | `make inspector` | Launch A2A Protocol Inspector to test your agent implementation |
84
+ {%- endif %}
85
+ | `make test` | Run unit and integration tests |
86
+ | `make lint` | Run code quality checks (codespell, ruff, mypy) |
87
+ | `make setup-dev-env` | Set up development environment resources using Terraform |
88
+ {%- if cookiecutter.data_ingestion %}
89
+ | `make data-ingestion`| Run data ingestion pipeline in the Dev environment |
90
+ {%- endif %}
91
+
92
+ For full command options and usage, refer to the [Makefile](Makefile).
93
+
94
+ {%- if cookiecutter.is_a2a %}
95
+
96
+ ## Using the A2A Inspector
97
+
98
+ This agent implements the [Agent2Agent (A2A) Protocol](https://a2a-protocol.org/), enabling interoperability with agents across different frameworks and languages.
99
+
100
+ The [A2A Inspector](https://github.com/a2aproject/a2a-inspector) provides the following core features:
101
+ - 🔍 View agent card and capabilities
102
+ - ✅ Validate A2A specification compliance
103
+ - 💬 Test communication with live chat interface
104
+ - 🐛 Debug with the raw message console
105
+
106
+ ### Local Testing
107
+ {%- if cookiecutter.deployment_target == 'cloud_run' %}
108
+
109
+ 1. Start your agent:
110
+ ```bash
111
+ make local-backend
112
+ ```
113
+
114
+ 2. In a separate terminal, launch the A2A Protocol Inspector:
115
+ ```bash
116
+ make inspector
117
+ ```
118
+
119
+ 3. Open http://localhost:5001 and connect to `http://localhost:8000`
120
+ {%- else %}
121
+
122
+ > **Note:** For Agent Engine deployments, local testing with A2A endpoints requires deployment first, as `make playground` uses the ADK web interface. For local development, use `make playground`. To test A2A protocol compliance, follow the Remote Testing instructions below.
123
+ {%- endif %}
124
+
125
+ ### Remote Testing
126
+
127
+ 1. Deploy your agent:
128
+ ```bash
129
+ make deploy
130
+ ```
131
+
132
+ 2. Launch the inspector:
133
+ ```bash
134
+ make inspector
135
+ ```
136
+
137
+ 3. Get an authentication token:
138
+ ```bash
139
+ {%- if cookiecutter.deployment_target == 'cloud_run' %}
140
+ gcloud auth print-identity-token
141
+ {%- else %}
142
+ gcloud auth print-access-token
143
+ {%- endif %}
144
+ ```
145
+
146
+ 4. In the inspector UI at http://localhost:5001:
147
+ - Add an HTTP header with name: `Authorization`
148
+ - Set the value to: `Bearer <your-token-from-step-3>`
149
+ {%- if cookiecutter.deployment_target == 'cloud_run' %}
150
+ - Connect to your deployed Cloud Run URL
151
+ {%- else %}
152
+ - Connect to your Agent Engine URL using this format:
153
+ ```
154
+ https://us-central1-aiplatform.googleapis.com/v1beta1/projects/{PROJECT_ID}/locations/{REGION}/reasoningEngines/{ENGINE_ID}/a2a/v1/card
155
+ ```
156
+ Find your `PROJECT_ID`, `REGION`, and `ENGINE_ID` in the `latest_deployment_metadata.json` file created after deployment.
157
+ {%- endif %}
158
+ {%- endif %}
159
+
160
+ {% if cookiecutter.is_adk_live %}
161
+ ## Usage
162
+
163
+ This template follows a "bring your own agent" approach - you focus on your business logic in `{{cookiecutter.agent_directory}}/agent.py`, and the template handles the surrounding components (UI, infrastructure, deployment, monitoring).
164
+
165
+ Here’s the recommended workflow for local development:
166
+
167
+ 1. **Install Dependencies (if needed):**
168
+ ```bash
169
+ make install
170
+ ```
171
+
172
+ 2. **Start the Full Stack Server:**
173
+ The FastAPI server now serves both the backend API and frontend interface:
174
+ ```bash
175
+ make local-backend
176
+ ```
177
+ The server is ready when you see `INFO: Application startup complete.` The frontend will be available at `http://localhost:8000`.
178
+
179
+ <details>
180
+ <summary><b>Optional: Use AI Studio / API Key instead of Vertex AI</b></summary>
181
+
182
+ By default, the backend uses Vertex AI and Application Default Credentials. If you prefer to use Google AI Studio and an API key:
183
+
184
+ ```bash
185
+ export VERTEXAI=false
186
+ export GOOGLE_API_KEY="your-google-api-key" # Replace with your actual key
187
+ make local-backend
188
+ ```
189
+ Ensure `GOOGLE_API_KEY` is set correctly in your environment.
190
+ </details>
191
+ <br>
192
+
193
+ <details>
194
+ <summary><b>Alternative: Run Frontend Separately</b></summary>
195
+
196
+ If you prefer to run the frontend separately (useful for frontend development), you can still use:
197
+ ```bash
198
+ make ui
199
+ ```
200
+ This launches the frontend application, which connects to the backend server at `http://localhost:8000`.
201
+ </details>
202
+ <br>
203
+
204
+ 3. **Interact and Iterate:**
205
+ * Open your browser and navigate to `http://localhost:8000` to access the integrated frontend.
206
+ * Click the play button in the UI to connect to the backend.
207
+ * Interact with the agent! Try prompts like: *"Using the tool you have, define Governance in the context MLOPs"*
208
+ * Modify the agent logic in `{{cookiecutter.agent_directory}}/agent.py`. The backend server (FastAPI with `uvicorn --reload`) should automatically restart when you save changes. Refresh the frontend if needed to see behavioral changes.
209
+
210
+
211
+ </details>
212
+ {%- else %}
213
+ ## Usage
214
+
215
+ This template follows a "bring your own agent" approach - you focus on your business logic, and the template handles everything else (UI, infrastructure, deployment, monitoring).
216
+
217
+ 1. **Prototype:** Build your Generative AI Agent using the intro notebooks in `notebooks/` for guidance. Use Vertex AI Evaluation to assess performance.
218
+ 2. **Integrate:** Import your agent into the app by editing `{{cookiecutter.agent_directory}}/agent.py`.
219
+ 3. **Test:** Explore your agent functionality using the local playground with `make playground`. The playground automatically reloads your agent on code changes.
220
+ 4. **Deploy:** Set up and initiate the CI/CD pipelines, customizing tests as necessary. Refer to the [deployment section](#deployment) for comprehensive instructions. For streamlined infrastructure deployment, simply run `uvx agent-starter-pack setup-cicd`. Check out the [`agent-starter-pack setup-cicd` CLI command](https://googlecloudplatform.github.io/agent-starter-pack/cli/setup_cicd.html). Currently supports GitHub with both Google Cloud Build and GitHub Actions as CI/CD runners.
221
+ 5. **Monitor:** Track performance and gather insights using BigQuery telemetry data, Cloud Logging, and Cloud Trace to iterate on your application.
222
+
223
+ The project includes a `GEMINI.md` file that provides context for AI tools like Gemini CLI when asking questions about your template.
224
+ {% endif %}
225
+
226
+ ## Deployment
227
+
228
+ > **Note:** For a streamlined one-command deployment of the entire CI/CD pipeline and infrastructure using Terraform, you can use the [`agent-starter-pack setup-cicd` CLI command](https://googlecloudplatform.github.io/agent-starter-pack/cli/setup_cicd.html). Currently supports GitHub with both Google Cloud Build and GitHub Actions as CI/CD runners.
229
+
230
+ ### Dev Environment
231
+
232
+ You can test deployment towards a Dev Environment using the following command:
233
+
234
+ ```bash
235
+ gcloud config set project <your-dev-project-id>
236
+ make deploy
237
+ ```
238
+ {% if cookiecutter.is_adk_live %}
239
+ **Note:** For secure access to your deployed backend, consider using Identity-Aware Proxy (IAP) by running `make deploy IAP=true`.
240
+ {%- endif %}
241
+
242
+ The repository includes a Terraform configuration for the setup of the Dev Google Cloud project.
243
+ See [deployment/README.md](deployment/README.md) for instructions.
244
+
245
+ ### Production Deployment
246
+
247
+ The repository includes a Terraform configuration for the setup of a production Google Cloud project. Refer to [deployment/README.md](deployment/README.md) for detailed instructions on how to deploy the infrastructure and application.
248
+
249
+ {% if not cookiecutter.is_adk_live %}
250
+ ## Monitoring and Observability
251
+
252
+ The application uses [OpenTelemetry GenAI instrumentation](https://opentelemetry.io/docs/specs/semconv/gen-ai/) for comprehensive observability. Telemetry data is automatically captured and exported to:
253
+
254
+ - **Google Cloud Storage**: GenAI telemetry in JSONL format for efficient querying
255
+ - **BigQuery**: External tables and linked datasets provide immediate access to telemetry data via SQL queries
256
+ - **Cloud Logging**: Dedicated logging bucket with 10-year retention for GenAI operation logs
257
+
258
+ **Query your telemetry data:**
259
+
260
+ ```bash
261
+ # Example: Query recent completions
262
+ bq query --use_legacy_sql=false \
263
+ "SELECT * FROM \`{{cookiecutter.project_name}}_telemetry.completions\` LIMIT 10"
264
+ ```
265
+
266
+ For detailed setup instructions, example queries, testing in dev, and optional dashboard visualization, see the [starter pack observability guide](https://googlecloudplatform.github.io/agent-starter-pack/guide/observability.html).
267
+ {%- endif %}
@@ -0,0 +1,11 @@
1
+ # Deployment
2
+
3
+ This directory contains the Terraform configurations for provisioning the necessary Google Cloud infrastructure for your agent.
4
+
5
+ The recommended way to deploy the infrastructure and set up the CI/CD pipeline is by using the `agent-starter-pack setup-cicd` command from the root of your project.
6
+
7
+ However, for a more hands-on approach, you can always apply the Terraform configurations manually for a do-it-yourself setup.
8
+
9
+ For detailed information on the deployment process, infrastructure, and CI/CD pipelines, please refer to the official documentation:
10
+
11
+ **[Agent Starter Pack Deployment Guide](https://googlecloudplatform.github.io/agent-starter-pack/guide/deployment.html)**
@@ -19,9 +19,9 @@ resource "google_project_service" "cicd_services" {
19
19
  disable_on_destroy = false
20
20
  }
21
21
 
22
- resource "google_project_service" "shared_services" {
22
+ resource "google_project_service" "deploy_project_services" {
23
23
  for_each = {
24
- for pair in setproduct(keys(local.deploy_project_ids), local.shared_services) :
24
+ for pair in setproduct(keys(local.deploy_project_ids), local.deploy_project_services) :
25
25
  "${pair[0]}_${replace(pair[1], ".", "_")}" => {
26
26
  project = local.deploy_project_ids[pair[0]]
27
27
  service = pair[1]
@@ -24,7 +24,12 @@ locals {
24
24
  "bigquery.googleapis.com",
25
25
  "serviceusage.googleapis.com",
26
26
  "logging.googleapis.com",
27
- "cloudtrace.googleapis.com"
27
+ "cloudtrace.googleapis.com",
28
+ "telemetry.googleapis.com",
29
+ {%- if cookiecutter.is_adk and cookiecutter.session_type == "cloud_sql" %}
30
+ "sqladmin.googleapis.com",
31
+ "secretmanager.googleapis.com"
32
+ {%- endif %}
28
33
  ]
29
34
  }
30
35
 
@@ -32,18 +32,18 @@ resource "google_project_iam_member" "default_compute_sa_storage_object_creator"
32
32
  depends_on = [resource.google_project_service.services]
33
33
  }
34
34
 
35
- {% if cookiecutter.deployment_target == 'cloud_run' %}
36
- resource "google_service_account" "cloud_run_app_sa" {
37
- account_id = "${var.project_name}-cr"
38
- display_name = "${var.project_name} Cloud Run App Service Account"
35
+ # Agent service account
36
+ resource "google_service_account" "app_sa" {
37
+ account_id = "${var.project_name}-app"
38
+ display_name = "${var.project_name} Agent Service Account"
39
39
  project = var.dev_project_id
40
40
  depends_on = [resource.google_project_service.services]
41
41
  }
42
42
 
43
- # Grant Cloud Run SA the required permissions to run the application
44
- resource "google_project_iam_member" "cloud_run_app_sa_roles" {
43
+ # Grant application SA the required permissions to run the application
44
+ resource "google_project_iam_member" "app_sa_roles" {
45
45
  for_each = {
46
- for pair in setproduct(keys(local.project_ids), var.cloud_run_app_roles) :
46
+ for pair in setproduct(keys(local.project_ids), var.app_sa_roles) :
47
47
  join(",", pair) => {
48
48
  project = local.project_ids[pair[0]]
49
49
  role = pair[1]
@@ -52,14 +52,15 @@ resource "google_project_iam_member" "cloud_run_app_sa_roles" {
52
52
 
53
53
  project = each.value.project
54
54
  role = each.value.role
55
- member = "serviceAccount:${google_service_account.cloud_run_app_sa.email}"
55
+ member = "serviceAccount:${google_service_account.app_sa.email}"
56
56
  depends_on = [resource.google_project_service.services]
57
57
  }
58
- {% elif cookiecutter.deployment_target == 'agent_engine' %}
59
- # Grant required permissions to Vertex AI service account
58
+
59
+ {% if cookiecutter.deployment_target == 'agent_engine' %}
60
+ # Grant required permissions to Vertex AI service account for Agent Engine
60
61
  resource "google_project_iam_member" "vertex_ai_sa_permissions" {
61
62
  for_each = {
62
- for pair in setproduct(keys(local.project_ids), var.agentengine_sa_roles) :
63
+ for pair in setproduct(keys(local.project_ids), var.app_sa_roles) :
63
64
  join(",", pair) => pair[1]
64
65
  }
65
66
 
@@ -17,7 +17,11 @@ terraform {
17
17
  required_providers {
18
18
  google = {
19
19
  source = "hashicorp/google"
20
- version = "< 7.0.0"
20
+ version = "~> 7.10.0"
21
+ }
22
+ random = {
23
+ source = "hashicorp/random"
24
+ version = "~> 3.7.0"
21
25
  }
22
26
  }
23
27
  }
@@ -18,7 +18,7 @@ provider "google" {
18
18
  }
19
19
 
20
20
  resource "google_storage_bucket" "logs_data_bucket" {
21
- name = "${var.dev_project_id}-${var.project_name}-logs-data"
21
+ name = "${var.dev_project_id}-${var.project_name}-logs"
22
22
  location = var.region
23
23
  project = var.dev_project_id
24
24
  uniform_bucket_level_access = true
@@ -32,7 +32,7 @@ variable "region" {
32
32
  variable "telemetry_logs_filter" {
33
33
  type = string
34
34
  description = "Log Sink filter for capturing telemetry data. Captures logs with the `traceloop.association.properties.log_type` attribute set to `tracing`."
35
- {%- if "adk" in cookiecutter.tags %}
35
+ {%- if cookiecutter.is_adk %}
36
36
  default = "labels.service_name=\"{{cookiecutter.project_name}}\" labels.type=\"agent_telemetry\""
37
37
  {%- else %}
38
38
  default = "jsonPayload.attributes.\"traceloop.association.properties.log_type\"=\"tracing\" jsonPayload.resource.attributes.\"service.name\"=\"{{cookiecutter.project_name}}\""
@@ -45,23 +45,23 @@ variable "feedback_logs_filter" {
45
45
  default = "jsonPayload.log_type=\"feedback\" jsonPayload.service_name=\"{{cookiecutter.project_name}}\""
46
46
  }
47
47
 
48
- {% if cookiecutter.deployment_target == 'cloud_run' %}
49
- variable "cloud_run_app_roles" {
50
- description = "List of roles to assign to the Cloud Run app service account"
51
- {% elif cookiecutter.deployment_target == 'agent_engine' %}
52
- variable "agentengine_sa_roles" {
53
- description = "List of roles to assign to the Agent Engine app service account"
54
- {% endif %}
48
+ variable "app_sa_roles" {
49
+ description = "List of roles to assign to the application service account"
55
50
  type = list(string)
56
51
  default = [
52
+
57
53
  "roles/aiplatform.user",
58
54
  "roles/discoveryengine.editor",
59
55
  "roles/logging.logWriter",
60
56
  "roles/cloudtrace.agent",
61
- "roles/storage.admin"
57
+ "roles/storage.admin",
58
+ "roles/serviceusage.serviceUsageConsumer",
59
+ {%- if cookiecutter.session_type == "cloud_sql" %}
60
+ "roles/cloudsql.client",
61
+ "roles/secretmanager.secretAccessor",
62
+ {%- endif %}
62
63
  ]
63
64
  }
64
-
65
65
  {% if cookiecutter.data_ingestion %}
66
66
 
67
67
  variable "pipelines_roles" {
@@ -0,0 +1,193 @@
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
+ # BigQuery dataset for telemetry external tables
16
+ resource "google_bigquery_dataset" "telemetry_dataset" {
17
+ project = var.dev_project_id
18
+ dataset_id = replace("${var.project_name}_telemetry", "-", "_")
19
+ friendly_name = "${var.project_name} Telemetry"
20
+ location = var.region
21
+ description = "Dataset for GenAI telemetry data stored in GCS"
22
+ depends_on = [google_project_service.services]
23
+ }
24
+
25
+ # BigQuery connection for accessing GCS telemetry data
26
+ resource "google_bigquery_connection" "genai_telemetry_connection" {
27
+ project = var.dev_project_id
28
+ location = var.region
29
+ connection_id = "${var.project_name}-genai-telemetry"
30
+ friendly_name = "${var.project_name} GenAI Telemetry Connection"
31
+
32
+ cloud_resource {}
33
+
34
+ depends_on = [google_project_service.services]
35
+ }
36
+
37
+ # Wait for the BigQuery connection service account to propagate in IAM
38
+ resource "time_sleep" "wait_for_bq_connection_sa" {
39
+ create_duration = "10s"
40
+
41
+ depends_on = [google_bigquery_connection.genai_telemetry_connection]
42
+ }
43
+
44
+ # Grant the BigQuery connection service account access to read from the logs bucket
45
+ resource "google_storage_bucket_iam_member" "telemetry_connection_access" {
46
+ bucket = google_storage_bucket.logs_data_bucket.name
47
+ role = "roles/storage.objectViewer"
48
+ member = "serviceAccount:${google_bigquery_connection.genai_telemetry_connection.cloud_resource[0].service_account_id}"
49
+
50
+ depends_on = [time_sleep.wait_for_bq_connection_sa]
51
+ }
52
+
53
+ # ====================================================================
54
+ # Dedicated Cloud Logging Bucket for GenAI Telemetry
55
+ # ====================================================================
56
+
57
+ # Create a custom Cloud Logging bucket for GenAI telemetry logs with long-term retention
58
+ resource "google_logging_project_bucket_config" "genai_telemetry_bucket" {
59
+ project = var.dev_project_id
60
+ location = var.region
61
+ bucket_id = "${var.project_name}-genai-telemetry"
62
+ retention_days = 3650 # 10 years retention (maximum allowed)
63
+ enable_analytics = true # Required for linked datasets
64
+ description = "Dedicated Cloud Logging bucket for ${var.project_name} GenAI telemetry with 10 year retention"
65
+
66
+ depends_on = [google_project_service.services]
67
+ }
68
+
69
+ # Log sink to route only GenAI telemetry logs to the dedicated bucket
70
+ # Filter by bucket name in the GCS path (which includes project_name) to isolate this agent's logs
71
+ resource "google_logging_project_sink" "genai_logs_to_bucket" {
72
+ name = "${var.project_name}-genai-logs"
73
+ project = var.dev_project_id
74
+ destination = "logging.googleapis.com/projects/${var.dev_project_id}/locations/${var.region}/buckets/${google_logging_project_bucket_config.genai_telemetry_bucket.bucket_id}"
75
+ filter = "log_name=\"projects/${var.dev_project_id}/logs/gen_ai.client.inference.operation.details\" AND (labels.\"gen_ai.input.messages_ref\" =~ \".*${var.project_name}.*\" OR labels.\"gen_ai.output.messages_ref\" =~ \".*${var.project_name}.*\")"
76
+
77
+ unique_writer_identity = true
78
+ depends_on = [google_logging_project_bucket_config.genai_telemetry_bucket]
79
+ }
80
+
81
+ # Create a linked dataset to the GenAI telemetry logs bucket for querying via BigQuery
82
+ resource "google_logging_linked_dataset" "genai_logs_linked_dataset" {
83
+ link_id = replace("${var.project_name}_genai_telemetry_logs", "-", "_")
84
+ bucket = google_logging_project_bucket_config.genai_telemetry_bucket.bucket_id
85
+ description = "Linked dataset for ${var.project_name} GenAI telemetry Cloud Logging bucket"
86
+ location = var.region
87
+ parent = "projects/${var.dev_project_id}"
88
+
89
+ depends_on = [
90
+ google_logging_project_bucket_config.genai_telemetry_bucket,
91
+ google_logging_project_sink.genai_logs_to_bucket
92
+ ]
93
+ }
94
+
95
+ # Wait for linked dataset to fully propagate
96
+ resource "time_sleep" "wait_for_linked_dataset" {
97
+ create_duration = "10s"
98
+
99
+ depends_on = [google_logging_linked_dataset.genai_logs_linked_dataset]
100
+ }
101
+
102
+ # ====================================================================
103
+ # Feedback Logs to Cloud Logging Bucket
104
+ # ====================================================================
105
+
106
+ # Log sink for user feedback logs - routes to the same Cloud Logging bucket
107
+ resource "google_logging_project_sink" "feedback_logs_to_bucket" {
108
+ name = "${var.project_name}-feedback"
109
+ project = var.dev_project_id
110
+ destination = "logging.googleapis.com/projects/${var.dev_project_id}/locations/${var.region}/buckets/${google_logging_project_bucket_config.genai_telemetry_bucket.bucket_id}"
111
+ filter = var.feedback_logs_filter
112
+
113
+ unique_writer_identity = true
114
+ depends_on = [google_logging_project_bucket_config.genai_telemetry_bucket]
115
+ }
116
+
117
+ # ====================================================================
118
+ # Completions External Table (GCS-based)
119
+ # ====================================================================
120
+
121
+ # External table for completions data (messages/parts) stored in GCS
122
+ resource "google_bigquery_table" "completions_external_table" {
123
+ project = var.dev_project_id
124
+ dataset_id = google_bigquery_dataset.telemetry_dataset.dataset_id
125
+ table_id = "completions"
126
+ deletion_protection = false
127
+
128
+ external_data_configuration {
129
+ autodetect = false
130
+ source_format = "NEWLINE_DELIMITED_JSON"
131
+ source_uris = ["gs://${google_storage_bucket.logs_data_bucket.name}/completions/*"]
132
+ connection_id = google_bigquery_connection.genai_telemetry_connection.name
133
+ ignore_unknown_values = true
134
+ max_bad_records = 1000
135
+ }
136
+
137
+ # Schema matching the ADK completions format
138
+ schema = jsonencode([
139
+ {
140
+ name = "parts"
141
+ type = "RECORD"
142
+ mode = "REPEATED"
143
+ fields = [
144
+ { name = "type", type = "STRING", mode = "NULLABLE" },
145
+ { name = "content", type = "STRING", mode = "NULLABLE" },
146
+ { name = "mime_type", type = "STRING", mode = "NULLABLE" },
147
+ { name = "uri", type = "STRING", mode = "NULLABLE" },
148
+ { name = "data", type = "BYTES", mode = "NULLABLE" },
149
+ { name = "id", type = "STRING", mode = "NULLABLE" },
150
+ { name = "name", type = "STRING", mode = "NULLABLE" },
151
+ { name = "arguments", type = "JSON", mode = "NULLABLE" },
152
+ { name = "response", type = "JSON", mode = "NULLABLE" }
153
+ ]
154
+ },
155
+ { name = "role", type = "STRING", mode = "NULLABLE" },
156
+ { name = "index", type = "INTEGER", mode = "NULLABLE" }
157
+ ])
158
+
159
+ depends_on = [
160
+ google_storage_bucket.logs_data_bucket,
161
+ google_bigquery_connection.genai_telemetry_connection,
162
+ google_storage_bucket_iam_member.telemetry_connection_access
163
+ ]
164
+ }
165
+
166
+ # ====================================================================
167
+ # Completions View (Joins Logs with GCS Data)
168
+ # ====================================================================
169
+
170
+ # View that joins Cloud Logging data with GCS-stored completions data
171
+ resource "google_bigquery_table" "completions_view" {
172
+ project = var.dev_project_id
173
+ dataset_id = google_bigquery_dataset.telemetry_dataset.dataset_id
174
+ table_id = "completions_view"
175
+ description = "View of GenAI completion logs joined with the GCS prompt/response external table"
176
+ deletion_protection = false
177
+
178
+ view {
179
+ query = templatefile("${path.module}/../sql/completions.sql", {
180
+ project_id = var.dev_project_id
181
+ dataset_id = google_bigquery_dataset.telemetry_dataset.dataset_id
182
+ completions_external_table = google_bigquery_table.completions_external_table.table_id
183
+ logs_link_id = google_logging_linked_dataset.genai_logs_linked_dataset.link_id
184
+ })
185
+ use_legacy_sql = false
186
+ }
187
+
188
+ depends_on = [
189
+ google_logging_linked_dataset.genai_logs_linked_dataset,
190
+ google_bigquery_table.completions_external_table,
191
+ time_sleep.wait_for_linked_dataset
192
+ ]
193
+ }