agent-starter-pack 0.0.1b0__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.

Potentially problematic release.


This version of agent-starter-pack might be problematic. Click here for more details.

Files changed (162) hide show
  1. agent_starter_pack-0.0.1b0.dist-info/METADATA +143 -0
  2. agent_starter_pack-0.0.1b0.dist-info/RECORD +162 -0
  3. agent_starter_pack-0.0.1b0.dist-info/WHEEL +4 -0
  4. agent_starter_pack-0.0.1b0.dist-info/entry_points.txt +2 -0
  5. agent_starter_pack-0.0.1b0.dist-info/licenses/LICENSE +201 -0
  6. agents/agentic_rag_vertexai_search/README.md +22 -0
  7. agents/agentic_rag_vertexai_search/app/agent.py +145 -0
  8. agents/agentic_rag_vertexai_search/app/retrievers.py +79 -0
  9. agents/agentic_rag_vertexai_search/app/templates.py +53 -0
  10. agents/agentic_rag_vertexai_search/notebooks/evaluating_langgraph_agent.ipynb +1561 -0
  11. agents/agentic_rag_vertexai_search/template/.templateconfig.yaml +14 -0
  12. agents/agentic_rag_vertexai_search/tests/integration/test_agent.py +57 -0
  13. agents/crewai_coding_crew/README.md +34 -0
  14. agents/crewai_coding_crew/app/agent.py +86 -0
  15. agents/crewai_coding_crew/app/crew/config/agents.yaml +39 -0
  16. agents/crewai_coding_crew/app/crew/config/tasks.yaml +37 -0
  17. agents/crewai_coding_crew/app/crew/crew.py +71 -0
  18. agents/crewai_coding_crew/notebooks/evaluating_crewai_agent.ipynb +1571 -0
  19. agents/crewai_coding_crew/notebooks/evaluating_langgraph_agent.ipynb +1561 -0
  20. agents/crewai_coding_crew/template/.templateconfig.yaml +12 -0
  21. agents/crewai_coding_crew/tests/integration/test_agent.py +47 -0
  22. agents/langgraph_base_react/README.md +9 -0
  23. agents/langgraph_base_react/app/agent.py +73 -0
  24. agents/langgraph_base_react/notebooks/evaluating_langgraph_agent.ipynb +1561 -0
  25. agents/langgraph_base_react/template/.templateconfig.yaml +13 -0
  26. agents/langgraph_base_react/tests/integration/test_agent.py +48 -0
  27. agents/multimodal_live_api/README.md +50 -0
  28. agents/multimodal_live_api/app/agent.py +86 -0
  29. agents/multimodal_live_api/app/server.py +193 -0
  30. agents/multimodal_live_api/app/templates.py +51 -0
  31. agents/multimodal_live_api/app/vector_store.py +55 -0
  32. agents/multimodal_live_api/template/.templateconfig.yaml +15 -0
  33. agents/multimodal_live_api/tests/integration/test_server_e2e.py +254 -0
  34. agents/multimodal_live_api/tests/load_test/load_test.py +40 -0
  35. agents/multimodal_live_api/tests/unit/test_server.py +143 -0
  36. src/base_template/.gitignore +197 -0
  37. src/base_template/Makefile +37 -0
  38. src/base_template/README.md +91 -0
  39. src/base_template/app/utils/tracing.py +143 -0
  40. src/base_template/app/utils/typing.py +115 -0
  41. src/base_template/deployment/README.md +123 -0
  42. src/base_template/deployment/cd/deploy-to-prod.yaml +98 -0
  43. src/base_template/deployment/cd/staging.yaml +215 -0
  44. src/base_template/deployment/ci/pr_checks.yaml +51 -0
  45. src/base_template/deployment/terraform/apis.tf +34 -0
  46. src/base_template/deployment/terraform/build_triggers.tf +122 -0
  47. src/base_template/deployment/terraform/dev/apis.tf +42 -0
  48. src/base_template/deployment/terraform/dev/iam.tf +90 -0
  49. src/base_template/deployment/terraform/dev/log_sinks.tf +66 -0
  50. src/base_template/deployment/terraform/dev/providers.tf +29 -0
  51. src/base_template/deployment/terraform/dev/storage.tf +76 -0
  52. src/base_template/deployment/terraform/dev/variables.tf +126 -0
  53. src/base_template/deployment/terraform/dev/vars/env.tfvars +21 -0
  54. src/base_template/deployment/terraform/iam.tf +130 -0
  55. src/base_template/deployment/terraform/locals.tf +50 -0
  56. src/base_template/deployment/terraform/log_sinks.tf +72 -0
  57. src/base_template/deployment/terraform/providers.tf +35 -0
  58. src/base_template/deployment/terraform/service_accounts.tf +42 -0
  59. src/base_template/deployment/terraform/storage.tf +100 -0
  60. src/base_template/deployment/terraform/variables.tf +202 -0
  61. src/base_template/deployment/terraform/vars/env.tfvars +43 -0
  62. src/base_template/pyproject.toml +113 -0
  63. src/base_template/tests/unit/test_utils/test_tracing_exporter.py +140 -0
  64. src/cli/commands/create.py +534 -0
  65. src/cli/commands/setup_cicd.py +730 -0
  66. src/cli/main.py +35 -0
  67. src/cli/utils/__init__.py +35 -0
  68. src/cli/utils/cicd.py +662 -0
  69. src/cli/utils/gcp.py +120 -0
  70. src/cli/utils/logging.py +51 -0
  71. src/cli/utils/template.py +644 -0
  72. src/data_ingestion/README.md +79 -0
  73. src/data_ingestion/data_ingestion_pipeline/components/ingest_data.py +175 -0
  74. src/data_ingestion/data_ingestion_pipeline/components/process_data.py +321 -0
  75. src/data_ingestion/data_ingestion_pipeline/pipeline.py +58 -0
  76. src/data_ingestion/data_ingestion_pipeline/submit_pipeline.py +184 -0
  77. src/data_ingestion/pyproject.toml +17 -0
  78. src/data_ingestion/uv.lock +999 -0
  79. src/deployment_targets/agent_engine/app/agent_engine_app.py +238 -0
  80. src/deployment_targets/agent_engine/app/utils/gcs.py +42 -0
  81. src/deployment_targets/agent_engine/deployment_metadata.json +4 -0
  82. src/deployment_targets/agent_engine/notebooks/intro_reasoning_engine.ipynb +869 -0
  83. src/deployment_targets/agent_engine/tests/integration/test_agent_engine_app.py +120 -0
  84. src/deployment_targets/agent_engine/tests/load_test/.results/.placeholder +0 -0
  85. src/deployment_targets/agent_engine/tests/load_test/.results/report.html +264 -0
  86. src/deployment_targets/agent_engine/tests/load_test/.results/results_exceptions.csv +1 -0
  87. src/deployment_targets/agent_engine/tests/load_test/.results/results_failures.csv +1 -0
  88. src/deployment_targets/agent_engine/tests/load_test/.results/results_stats.csv +3 -0
  89. src/deployment_targets/agent_engine/tests/load_test/.results/results_stats_history.csv +22 -0
  90. src/deployment_targets/agent_engine/tests/load_test/README.md +42 -0
  91. src/deployment_targets/agent_engine/tests/load_test/load_test.py +100 -0
  92. src/deployment_targets/agent_engine/tests/unit/test_dummy.py +22 -0
  93. src/deployment_targets/cloud_run/Dockerfile +29 -0
  94. src/deployment_targets/cloud_run/app/server.py +128 -0
  95. src/deployment_targets/cloud_run/deployment/terraform/artifact_registry.tf +22 -0
  96. src/deployment_targets/cloud_run/deployment/terraform/dev/service_accounts.tf +20 -0
  97. src/deployment_targets/cloud_run/tests/integration/test_server_e2e.py +192 -0
  98. src/deployment_targets/cloud_run/tests/load_test/.results/.placeholder +0 -0
  99. src/deployment_targets/cloud_run/tests/load_test/README.md +79 -0
  100. src/deployment_targets/cloud_run/tests/load_test/load_test.py +85 -0
  101. src/deployment_targets/cloud_run/tests/unit/test_server.py +142 -0
  102. src/deployment_targets/cloud_run/uv.lock +6952 -0
  103. src/frontends/live_api_react/frontend/package-lock.json +19405 -0
  104. src/frontends/live_api_react/frontend/package.json +56 -0
  105. src/frontends/live_api_react/frontend/public/favicon.ico +0 -0
  106. src/frontends/live_api_react/frontend/public/index.html +62 -0
  107. src/frontends/live_api_react/frontend/public/robots.txt +3 -0
  108. src/frontends/live_api_react/frontend/src/App.scss +189 -0
  109. src/frontends/live_api_react/frontend/src/App.test.tsx +25 -0
  110. src/frontends/live_api_react/frontend/src/App.tsx +205 -0
  111. src/frontends/live_api_react/frontend/src/components/audio-pulse/AudioPulse.tsx +64 -0
  112. src/frontends/live_api_react/frontend/src/components/audio-pulse/audio-pulse.scss +68 -0
  113. src/frontends/live_api_react/frontend/src/components/control-tray/ControlTray.tsx +217 -0
  114. src/frontends/live_api_react/frontend/src/components/control-tray/control-tray.scss +201 -0
  115. src/frontends/live_api_react/frontend/src/components/logger/Logger.tsx +241 -0
  116. src/frontends/live_api_react/frontend/src/components/logger/logger.scss +133 -0
  117. src/frontends/live_api_react/frontend/src/components/logger/mock-logs.ts +151 -0
  118. src/frontends/live_api_react/frontend/src/components/side-panel/SidePanel.tsx +161 -0
  119. src/frontends/live_api_react/frontend/src/components/side-panel/side-panel.scss +285 -0
  120. src/frontends/live_api_react/frontend/src/contexts/LiveAPIContext.tsx +48 -0
  121. src/frontends/live_api_react/frontend/src/hooks/use-live-api.ts +115 -0
  122. src/frontends/live_api_react/frontend/src/hooks/use-media-stream-mux.ts +23 -0
  123. src/frontends/live_api_react/frontend/src/hooks/use-screen-capture.ts +72 -0
  124. src/frontends/live_api_react/frontend/src/hooks/use-webcam.ts +69 -0
  125. src/frontends/live_api_react/frontend/src/index.css +28 -0
  126. src/frontends/live_api_react/frontend/src/index.tsx +35 -0
  127. src/frontends/live_api_react/frontend/src/multimodal-live-types.ts +242 -0
  128. src/frontends/live_api_react/frontend/src/react-app-env.d.ts +17 -0
  129. src/frontends/live_api_react/frontend/src/reportWebVitals.ts +31 -0
  130. src/frontends/live_api_react/frontend/src/setupTests.ts +21 -0
  131. src/frontends/live_api_react/frontend/src/utils/audio-recorder.ts +111 -0
  132. src/frontends/live_api_react/frontend/src/utils/audio-streamer.ts +270 -0
  133. src/frontends/live_api_react/frontend/src/utils/audioworklet-registry.ts +43 -0
  134. src/frontends/live_api_react/frontend/src/utils/multimodal-live-client.ts +329 -0
  135. src/frontends/live_api_react/frontend/src/utils/store-logger.ts +64 -0
  136. src/frontends/live_api_react/frontend/src/utils/utils.ts +86 -0
  137. src/frontends/live_api_react/frontend/src/utils/worklets/audio-processing.ts +73 -0
  138. src/frontends/live_api_react/frontend/src/utils/worklets/vol-meter.ts +65 -0
  139. src/frontends/live_api_react/frontend/tsconfig.json +25 -0
  140. src/frontends/streamlit/frontend/side_bar.py +213 -0
  141. src/frontends/streamlit/frontend/streamlit_app.py +263 -0
  142. src/frontends/streamlit/frontend/style/app_markdown.py +37 -0
  143. src/frontends/streamlit/frontend/utils/chat_utils.py +67 -0
  144. src/frontends/streamlit/frontend/utils/local_chat_history.py +125 -0
  145. src/frontends/streamlit/frontend/utils/message_editing.py +59 -0
  146. src/frontends/streamlit/frontend/utils/multimodal_utils.py +217 -0
  147. src/frontends/streamlit/frontend/utils/stream_handler.py +282 -0
  148. src/frontends/streamlit/frontend/utils/title_summary.py +77 -0
  149. src/resources/containers/data_processing/Dockerfile +25 -0
  150. src/resources/locks/uv-agentic_rag_vertexai_search-agent_engine.lock +4684 -0
  151. src/resources/locks/uv-agentic_rag_vertexai_search-cloud_run.lock +5799 -0
  152. src/resources/locks/uv-crewai_coding_crew-agent_engine.lock +5509 -0
  153. src/resources/locks/uv-crewai_coding_crew-cloud_run.lock +6688 -0
  154. src/resources/locks/uv-langgraph_base_react-agent_engine.lock +4595 -0
  155. src/resources/locks/uv-langgraph_base_react-cloud_run.lock +5710 -0
  156. src/resources/locks/uv-multimodal_live_api-cloud_run.lock +5665 -0
  157. src/resources/setup_cicd/cicd_variables.tf +36 -0
  158. src/resources/setup_cicd/github.tf +85 -0
  159. src/resources/setup_cicd/providers.tf +39 -0
  160. src/utils/generate_locks.py +135 -0
  161. src/utils/lock_utils.py +82 -0
  162. src/utils/watch_and_rebuild.py +190 -0
@@ -0,0 +1,215 @@
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
+ steps:
16
+ {%- if cookiecutter.data_ingestion %}
17
+ - name: "python:3.11"
18
+ id: deploy-data-ingestion-pipeline-prod
19
+ entrypoint: bash
20
+ args:
21
+ - -c
22
+ - |
23
+ cd data_ingestion && pip install uv --user && uv sync --frozen && \
24
+ uv run python data_ingestion_pipeline/submit_pipeline.py
25
+ env:
26
+ - "PIPELINE_ROOT=${_PIPELINE_GCS_ROOT}"
27
+ - "REGION=${_REGION}"
28
+ - "DATA_STORE_REGION=${_DATA_STORE_REGION}"
29
+ - "DATA_STORE_ID=${_DATA_STORE_ID}"
30
+ - "PROJECT_ID=${_STAGING_PROJECT_ID}"
31
+ - "SERVICE_ACCOUNT=${_PIPELINE_SA_EMAIL}"
32
+ - "PIPELINE_NAME=${_PIPELINE_NAME}"
33
+ - 'PATH=/usr/local/bin:/usr/bin:~/.local/bin'
34
+ {%- endif %}
35
+ {%- if cookiecutter.deployment_target == 'cloud_run' %}
36
+ # Build and Push
37
+ - name: "gcr.io/cloud-builders/docker"
38
+ args:
39
+ [
40
+ "build",
41
+ "-t",
42
+ "$_REGION-docker.pkg.dev/$PROJECT_ID/$_ARTIFACT_REGISTRY_REPO_NAME/$_CONTAINER_NAME",
43
+ ".",
44
+ ]
45
+ - name: "gcr.io/cloud-builders/docker"
46
+ args:
47
+ [
48
+ "push",
49
+ "$_REGION-docker.pkg.dev/$PROJECT_ID/$_ARTIFACT_REGISTRY_REPO_NAME/$_CONTAINER_NAME",
50
+ ]
51
+
52
+ # Deploy to Staging
53
+ - name: "gcr.io/cloud-builders/gcloud"
54
+ id: deploy-staging
55
+ entrypoint: gcloud
56
+ args:
57
+ - "run"
58
+ - "deploy"
59
+ - "{{cookiecutter.project_name}}"
60
+ - "--image"
61
+ - "$_REGION-docker.pkg.dev/$PROJECT_ID/$_ARTIFACT_REGISTRY_REPO_NAME/$_CONTAINER_NAME"
62
+ - "--region"
63
+ - "${_REGION}"
64
+ - "--project"
65
+ - "${_STAGING_PROJECT_ID}"
66
+ - "--min-instances"
67
+ - "1"
68
+ - "--no-cpu-throttling"
69
+ - "--cpu"
70
+ - "4"
71
+ - "--memory"
72
+ - "4Gi"
73
+ - "--concurrency"
74
+ - "40"
75
+ - "--service-account"
76
+ - "${_CLOUD_RUN_APP_SA_NAME}@${_STAGING_PROJECT_ID}.iam.gserviceaccount.com"
77
+ - "--set-env-vars"
78
+ - "COMMIT_SHA=${COMMIT_SHA}{%- if cookiecutter.data_ingestion %},DATA_STORE_ID=${_DATA_STORE_ID},DATA_STORE_REGION=${_DATA_STORE_REGION}{%- endif %}"
79
+
80
+ # Fetch Staging Service URL
81
+ - name: "gcr.io/cloud-builders/gcloud"
82
+ id: fetch-staging-url
83
+ entrypoint: /bin/bash
84
+ args:
85
+ - "-c"
86
+ - |
87
+ echo $(gcloud run services describe {{cookiecutter.project_name}} \
88
+ --region ${_REGION} --project ${_STAGING_PROJECT_ID} --format="value(status.url)") > staging_url.txt
89
+
90
+ # Fetch ID Token
91
+ - name: gcr.io/cloud-builders/gcloud
92
+ id: fetch-id-token
93
+ entrypoint: /bin/bash
94
+ args:
95
+ - "-c"
96
+ - |
97
+ echo $(gcloud auth print-identity-token -q) > id_token.txt
98
+ {%- elif cookiecutter.deployment_target == 'agent_engine' %}
99
+ - name: "python:3.11"
100
+ id: install-dependencies
101
+ entrypoint: /bin/bash
102
+ args:
103
+ - "-c"
104
+ - |
105
+ pip install uv --user && uv sync --frozen
106
+ env:
107
+ - 'PATH=/usr/local/bin:/usr/bin:~/.local/bin'
108
+
109
+ - name: "python:3.11"
110
+ id: deploy-staging
111
+ entrypoint: /bin/bash
112
+ args:
113
+ - "-c"
114
+ - |
115
+ uv export --no-hashes --no-sources --no-header --no-emit-project --frozen > .requirements.txt
116
+ uv run app/agent_engine_app.py \
117
+ --project ${_STAGING_PROJECT_ID} \
118
+ --location ${_REGION} \
119
+ --set-env-vars COMMIT_SHA=${COMMIT_SHA}{%- if cookiecutter.data_ingestion %},DATA_STORE_ID=${_DATA_STORE_ID},DATA_STORE_REGION=${_DATA_STORE_REGION}{%- endif %}
120
+ env:
121
+ - 'PATH=/usr/local/bin:/usr/bin:~/.local/bin'
122
+
123
+
124
+ - name: gcr.io/cloud-builders/gcloud
125
+ id: fetch-auth-token
126
+ entrypoint: /bin/bash
127
+ args:
128
+ - "-c"
129
+ - |
130
+ echo $(gcloud auth print-access-token -q) > auth_token.txt
131
+ {%- endif %}
132
+
133
+ # Load Testing
134
+ - name: "python:3.11"
135
+ id: load_test
136
+ entrypoint: /bin/bash
137
+ args:
138
+ - "-c"
139
+ - |
140
+ {%- if cookiecutter.deployment_target == 'cloud_run' %}
141
+ export _ID_TOKEN=$(cat id_token.txt)
142
+ export _STAGING_URL=$(cat staging_url.txt)
143
+ pip install uv --user && uv sync --frozen
144
+ {%- elif cookiecutter.deployment_target == 'agent_engine' %}
145
+ export _AUTH_TOKEN=$(cat auth_token.txt)
146
+ {%- endif %}
147
+ uv add locust==2.32.6
148
+ uv run locust -f tests/load_test/load_test.py \
149
+ --headless \
150
+ {%- if cookiecutter.deployment_target == 'cloud_run' %}
151
+ -H $$_STAGING_URL \
152
+ -t 30s -u 10 -r 0.5 \
153
+ {%- elif cookiecutter.deployment_target == 'agent_engine' %}
154
+ -t 30s -u 2 -r 0.5 \
155
+ {%- endif %}
156
+ --csv=tests/load_test/.results/results \
157
+ --html=tests/load_test/.results/report.html
158
+ env:
159
+ - 'PATH=/usr/local/bin:/usr/bin:~/.local/bin'
160
+
161
+ # Export Load Test Results to GCS
162
+ - name: gcr.io/cloud-builders/gcloud
163
+ id: export-results-to-gcs
164
+ entrypoint: /bin/bash
165
+ args:
166
+ - "-c"
167
+ - |
168
+ export _TIMESTAMP=$(date +%Y%m%d-%H%M%S)
169
+ gsutil -m cp -r tests/load_test/.results gs://${_BUCKET_NAME_LOAD_TEST_RESULTS}/results-$${_TIMESTAMP}
170
+ echo "_________________________________________________________________________"
171
+ echo "Load test results copied to gs://${_BUCKET_NAME_LOAD_TEST_RESULTS}/results-$${_TIMESTAMP}"
172
+ echo "HTTP link: https://console.cloud.google.com/storage/browser/${_BUCKET_NAME_LOAD_TEST_RESULTS}/results-$${_TIMESTAMP}"
173
+ echo "_________________________________________________________________________"
174
+
175
+ # Trigger Prod Deployment
176
+ - name: gcr.io/cloud-builders/gcloud
177
+ id: trigger-prod-deployment
178
+ entrypoint: gcloud
179
+ args:
180
+ - "beta"
181
+ - "builds"
182
+ - "triggers"
183
+ - "run"
184
+ - "deploy-to-prod-pipeline"
185
+ - "--region"
186
+ - "$LOCATION"
187
+ - "--project"
188
+ - "$PROJECT_ID"
189
+ - "--sha"
190
+ - $COMMIT_SHA
191
+
192
+ - name: gcr.io/cloud-builders/gcloud
193
+ id: echo-view-build-trigger-link
194
+ entrypoint: /bin/bash
195
+ args:
196
+ - "-c"
197
+ - |
198
+ echo "_________________________________________________________________________"
199
+ echo "Production deployment triggered. View progress and / or approve on the Cloud Build Console:"
200
+ echo "https://console.cloud.google.com/cloud-build/builds;region=$LOCATION"
201
+ echo "_________________________________________________________________________"
202
+
203
+ substitutions:
204
+ _STAGING_PROJECT_ID: YOUR_STAGING_PROJECT_ID
205
+ _BUCKET_NAME_LOAD_TEST_RESULTS: ${PROJECT_ID}-cicd-load-test-results
206
+ _REGION: us-central1
207
+ {%- if cookiecutter.data_ingestion %}
208
+ _DATA_STORE_REGION: us
209
+ _PIPELINE_NAME: genai_sample_data_ingestion
210
+ {%- endif %}
211
+
212
+ logsBucket: gs://${PROJECT_ID}-logs-data/build-logs
213
+ options:
214
+ substitutionOption: ALLOW_LOOSE
215
+ defaultLogsBucketBehavior: REGIONAL_USER_OWNED_BUCKET
@@ -0,0 +1,51 @@
1
+ # Copyright 2025 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ steps:
16
+ # Install uv package manager and sync dependencies
17
+ - name: "python:3.11"
18
+ id: install-dependencies
19
+ entrypoint: /bin/bash
20
+ args:
21
+ - "-c"
22
+ - |
23
+ pip install uv --user && uv sync --frozen
24
+ env:
25
+ - 'PATH=/usr/local/bin:/usr/bin:~/.local/bin'
26
+
27
+ # Run unit tests using pytest
28
+ - name: "python:3.11"
29
+ id: unit-tests
30
+ entrypoint: /bin/bash
31
+ args:
32
+ - "-c"
33
+ - |
34
+ uv run pytest tests/unit
35
+ env:
36
+ - 'PATH=/usr/local/bin:/usr/bin:~/.local/bin'
37
+
38
+ # Run integration tests
39
+ - name: "python:3.11"
40
+ id: integration-tests
41
+ entrypoint: /bin/bash
42
+ args:
43
+ - "-c"
44
+ - |
45
+ uv run pytest tests/integration
46
+ env:
47
+ - 'PATH=/usr/local/bin:/usr/bin:~/.local/bin'
48
+
49
+ logsBucket: gs://${PROJECT_ID}-logs-data/build-logs
50
+ options:
51
+ defaultLogsBucketBehavior: REGIONAL_USER_OWNED_BUCKET
@@ -0,0 +1,34 @@
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
+ resource "google_project_service" "cicd_services" {
16
+ count = length(local.cicd_services)
17
+ project = var.cicd_runner_project_id
18
+ service = local.cicd_services[count.index]
19
+ disable_on_destroy = false
20
+ }
21
+
22
+ resource "google_project_service" "shared_services" {
23
+ for_each = {
24
+ for pair in setproduct(keys(local.deploy_project_ids), local.shared_services) :
25
+ "${pair[0]}_${replace(pair[1], ".", "_")}" => {
26
+ project = local.deploy_project_ids[pair[0]]
27
+ service = pair[1]
28
+ }
29
+ }
30
+ project = each.value.project
31
+ service = each.value.service
32
+ disable_on_destroy = false
33
+ }
34
+
@@ -0,0 +1,122 @@
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
+ # a. Create PR checks trigger
16
+ resource "google_cloudbuild_trigger" "pr_checks" {
17
+ name = "pr-checks"
18
+ project = var.cicd_runner_project_id
19
+ location = var.region
20
+ description = "Trigger for PR checks"
21
+ service_account = resource.google_service_account.cicd_runner_sa.id
22
+
23
+ repository_event_config {
24
+ repository = "projects/${var.cicd_runner_project_id}/locations/${var.region}/connections/${var.host_connection_name}/repositories/${var.repository_name}"
25
+ pull_request {
26
+ branch = "main"
27
+ }
28
+ }
29
+
30
+ filename = "deployment/ci/pr_checks.yaml"
31
+ included_files = [
32
+ "app/**",
33
+ "data_ingestion/**",
34
+ "tests/**",
35
+ "deployment/**",
36
+ "poetry.lock",
37
+ {%- if cookiecutter.data_ingestion %}
38
+ "data_ingestion/**",
39
+ {%- endif %}
40
+ ]
41
+ depends_on = [resource.google_project_service.cicd_services, resource.google_project_service.shared_services]
42
+ }
43
+
44
+ # b. Create CD pipeline trigger
45
+ resource "google_cloudbuild_trigger" "cd_pipeline" {
46
+ name = "cd-pipeline"
47
+ project = var.cicd_runner_project_id
48
+ location = var.region
49
+ service_account = resource.google_service_account.cicd_runner_sa.id
50
+ description = "Trigger for CD pipeline"
51
+
52
+ repository_event_config {
53
+ repository = "projects/${var.cicd_runner_project_id}/locations/${var.region}/connections/${var.host_connection_name}/repositories/${var.repository_name}"
54
+ push {
55
+ branch = "main"
56
+ }
57
+ }
58
+
59
+ filename = "deployment/cd/staging.yaml"
60
+ included_files = [
61
+ "app/**",
62
+ "data_ingestion/**",
63
+ "tests/**",
64
+ "deployment/**",
65
+ "poetry.lock"
66
+ ]
67
+ substitutions = {
68
+ _STAGING_PROJECT_ID = var.staging_project_id
69
+ _BUCKET_NAME_LOAD_TEST_RESULTS = resource.google_storage_bucket.bucket_load_test_results.name
70
+ _REGION = var.region
71
+ {%- if cookiecutter.deployment_target == 'cloud_run' %}
72
+ _CONTAINER_NAME = var.cloud_run_app_sa_name
73
+ _ARTIFACT_REGISTRY_REPO_NAME = var.artifact_registry_repo_name
74
+ _CLOUD_RUN_APP_SA_NAME = var.cloud_run_app_sa_name
75
+ {%- endif %}
76
+ {%- if cookiecutter.data_ingestion %}
77
+ _PIPELINE_GCS_ROOT = "gs://${resource.google_storage_bucket.data_ingestion_pipeline_gcs_root["staging"].name}"
78
+ _PIPELINE_SA_EMAIL = "${var.vertexai_pipeline_sa_name}@${var.staging_project_id}.iam.gserviceaccount.com"
79
+ _PIPELINE_CRON_SCHEDULE = var.pipeline_cron_schedule
80
+ _DATA_STORE_ID = resource.google_discovery_engine_data_store.data_store_staging.data_store_id
81
+ _DATA_STORE_REGION = var.data_store_region
82
+ {%- endif %}
83
+ # Your other CD Pipeline substitutions
84
+ }
85
+ depends_on = [resource.google_project_service.cicd_services, resource.google_project_service.shared_services]
86
+
87
+ }
88
+
89
+ # c. Create Deploy to production trigger
90
+ resource "google_cloudbuild_trigger" "deploy_to_prod_pipeline" {
91
+ name = "deploy-to-prod-pipeline"
92
+ project = var.cicd_runner_project_id
93
+ location = var.region
94
+ description = "Trigger for deployment to production"
95
+ service_account = resource.google_service_account.cicd_runner_sa.id
96
+ repository_event_config {
97
+ repository = "projects/${var.cicd_runner_project_id}/locations/${var.region}/connections/${var.host_connection_name}/repositories/${var.repository_name}"
98
+ }
99
+ filename = "deployment/cd/deploy-to-prod.yaml"
100
+ approval_config {
101
+ approval_required = true
102
+ }
103
+ substitutions = {
104
+ _PROD_PROJECT_ID = var.prod_project_id
105
+ _REGION = var.region
106
+ {%- if cookiecutter.deployment_target == 'cloud_run' %}
107
+ _CONTAINER_NAME = var.cloud_run_app_sa_name
108
+ _ARTIFACT_REGISTRY_REPO_NAME = var.artifact_registry_repo_name
109
+ _CLOUD_RUN_APP_SA_NAME = var.cloud_run_app_sa_name
110
+ {%- endif %}
111
+ {%- if cookiecutter.data_ingestion %}
112
+ _PIPELINE_GCS_ROOT = "gs://${resource.google_storage_bucket.data_ingestion_pipeline_gcs_root["prod"].name}"
113
+ _PIPELINE_SA_EMAIL = "${var.vertexai_pipeline_sa_name}@${var.prod_project_id}.iam.gserviceaccount.com"
114
+ _PIPELINE_CRON_SCHEDULE = var.pipeline_cron_schedule
115
+ _DATA_STORE_ID = resource.google_discovery_engine_data_store.data_store_prod.data_store_id
116
+ _DATA_STORE_REGION = var.data_store_region
117
+ {%- endif %}
118
+ # Your other Deploy to Prod Pipeline substitutions
119
+ }
120
+ depends_on = [resource.google_project_service.cicd_services, resource.google_project_service.shared_services]
121
+
122
+ }
@@ -0,0 +1,42 @@
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
+ locals {
16
+ services = [
17
+ "aiplatform.googleapis.com",
18
+ "cloudbuild.googleapis.com",
19
+ "run.googleapis.com",
20
+ "bigquery.googleapis.com",
21
+ "discoveryengine.googleapis.com",
22
+ "cloudresourcemanager.googleapis.com",
23
+ "iam.googleapis.com",
24
+ "bigquery.googleapis.com",
25
+ "serviceusage.googleapis.com",
26
+ "logging.googleapis.com",
27
+ "cloudtrace.googleapis.com"
28
+ ]
29
+ }
30
+
31
+ resource "google_project_service" "services" {
32
+ count = length(local.services)
33
+ project = var.dev_project_id
34
+ service = local.services[count.index]
35
+ disable_on_destroy = false
36
+ }
37
+
38
+ resource "google_project_service_identity" "vertex_sa" {
39
+ provider = google-beta
40
+ project = var.dev_project_id
41
+ service = "aiplatform.googleapis.com"
42
+ }
@@ -0,0 +1,90 @@
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
+ locals {
16
+ project_ids = {
17
+ dev = var.dev_project_id
18
+ }
19
+ }
20
+
21
+
22
+ # Get the project number for the dev project
23
+ data "google_project" "dev_project" {
24
+ project_id = var.dev_project_id
25
+ }
26
+
27
+ # Grant Storage Object Creator role to default compute service account
28
+ resource "google_project_iam_member" "default_compute_sa_storage_object_creator" {
29
+ project = var.dev_project_id
30
+ role = "roles/cloudbuild.builds.builder"
31
+ member = "serviceAccount:${data.google_project.dev_project.number}-compute@developer.gserviceaccount.com"
32
+ depends_on = [resource.google_project_service.services]
33
+ }
34
+
35
+ {%- if cookiecutter.deployment_target == 'cloud_run' %}
36
+ # Grant Cloud Run SA the required permissions to run the application
37
+ resource "google_project_iam_member" "cloud_run_app_sa_roles" {
38
+ for_each = {
39
+ for pair in setproduct(keys(local.project_ids), var.cloud_run_app_roles) :
40
+ join(",", pair) => {
41
+ project = local.project_ids[pair[0]]
42
+ role = pair[1]
43
+ }
44
+ }
45
+
46
+ project = each.value.project
47
+ role = each.value.role
48
+ member = "serviceAccount:${google_service_account.cloud_run_app_sa.email}"
49
+ depends_on = [resource.google_project_service.services]
50
+ }
51
+ {%- elif cookiecutter.deployment_target == 'agent_engine' %}
52
+ # Grant required permissions to Vertex AI service account
53
+ resource "google_project_iam_member" "vertex_ai_sa_permissions" {
54
+ for_each = {
55
+ for pair in setproduct(keys(local.project_ids), var.agentengine_sa_roles) :
56
+ join(",", pair) => pair[1]
57
+ }
58
+
59
+ project = var.dev_project_id
60
+ role = each.value
61
+ member = google_project_service_identity.vertex_sa.member
62
+ depends_on = [resource.google_project_service.services]
63
+ }
64
+ {%- endif %}
65
+ {%- if cookiecutter.data_ingestion %}
66
+ # Service account to run Vertex AI pipeline
67
+ resource "google_service_account" "vertexai_pipeline_app_sa" {
68
+ for_each = local.project_ids
69
+
70
+ account_id = var.vertexai_pipeline_sa_name
71
+ display_name = "Vertex AI Pipeline app SA"
72
+ project = each.value
73
+ depends_on = [resource.google_project_service.services]
74
+ }
75
+
76
+ resource "google_project_iam_member" "vertexai_pipeline_sa_roles" {
77
+ for_each = {
78
+ for pair in setproduct(keys(local.project_ids), var.pipelines_roles) :
79
+ join(",", pair) => {
80
+ project = local.project_ids[pair[0]]
81
+ role = pair[1]
82
+ }
83
+ }
84
+
85
+ project = each.value.project
86
+ role = each.value.role
87
+ member = "serviceAccount:${google_service_account.vertexai_pipeline_app_sa[split(",", each.key)[0]].email}"
88
+ depends_on = [resource.google_project_service.services]
89
+ }
90
+ {%- endif %}
@@ -0,0 +1,66 @@
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
+ resource "google_project_iam_member" "bigquery_data_editor" {
16
+
17
+ project = var.dev_project_id
18
+ role = "roles/bigquery.dataEditor"
19
+ member = module.log_export_to_bigquery.writer_identity
20
+ }
21
+
22
+
23
+ module "log_export_to_bigquery" {
24
+
25
+ source = "terraform-google-modules/log-export/google"
26
+ version = "10.0.0"
27
+
28
+ log_sink_name = var.telemetry_sink_name
29
+ parent_resource_type = "project"
30
+ parent_resource_id = var.dev_project_id
31
+ destination_uri = "bigquery.googleapis.com/projects/${var.dev_project_id}/datasets/${var.telemetry_bigquery_dataset_id}"
32
+ filter = var.telemetry_logs_filter
33
+ bigquery_options = { use_partitioned_tables = true }
34
+ unique_writer_identity = true
35
+ depends_on = [resource.google_project_service.services]
36
+ }
37
+
38
+ resource "google_bigquery_dataset" "feedback_dataset" {
39
+ project = var.dev_project_id
40
+ dataset_id = var.feedback_bigquery_dataset_id
41
+ friendly_name = var.feedback_bigquery_dataset_id
42
+ location = var.region
43
+ depends_on = [resource.google_project_service.services]
44
+ }
45
+
46
+ module "feedback_export_to_bigquery" {
47
+ source = "terraform-google-modules/log-export/google"
48
+ version = "10.0.0"
49
+ log_sink_name = var.feedback_sink_name
50
+ parent_resource_type = "project"
51
+ parent_resource_id = var.dev_project_id
52
+ destination_uri = "bigquery.googleapis.com/projects/${var.dev_project_id}/datasets/${var.feedback_bigquery_dataset_id}"
53
+ filter = var.feedback_logs_filter
54
+ bigquery_options = { use_partitioned_tables = true }
55
+ unique_writer_identity = true
56
+ depends_on = [resource.google_project_service.services]
57
+
58
+ }
59
+
60
+ resource "google_bigquery_dataset" "telemetry_logs_dataset" {
61
+ project = var.dev_project_id
62
+ dataset_id = var.telemetry_bigquery_dataset_id
63
+ friendly_name = var.telemetry_bigquery_dataset_id
64
+ location = var.region
65
+ depends_on = [resource.google_project_service.services]
66
+ }
@@ -0,0 +1,29 @@
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
+ terraform {
16
+ required_version = ">= 1.0.0"
17
+ required_providers {
18
+ google = {
19
+ source = "hashicorp/google"
20
+ version = "< 7.0.0"
21
+ }
22
+ }
23
+ }
24
+
25
+ provider "google" {
26
+ alias = "dev_billing_override"
27
+ billing_project = var.dev_project_id
28
+ user_project_override = true
29
+ }