agent-starter-pack 0.18.0__py3-none-any.whl → 0.18.2__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.
@@ -156,9 +156,9 @@ playground-dev:
156
156
 
157
157
  # Deploy the agent remotely
158
158
  {%- if cookiecutter.deployment_target == 'cloud_run' %}
159
- # Usage: make backend [IAP=true] [PORT=8080] - Set IAP=true to enable Identity-Aware Proxy, PORT to specify container port
159
+ # Usage: make deploy [IAP=true] [PORT=8080] - Set IAP=true to enable Identity-Aware Proxy, PORT to specify container port
160
160
  {%- endif %}
161
- backend:
161
+ deploy:
162
162
  {%- if cookiecutter.deployment_target == 'cloud_run' %}
163
163
  PROJECT_ID=$$(gcloud config get-value project) && \
164
164
  gcloud beta run deploy {{cookiecutter.project_name}} \
@@ -179,6 +179,9 @@ backend:
179
179
  uv export --no-hashes --no-header --no-dev --no-emit-project > .requirements.txt && uv run {{cookiecutter.agent_directory}}/agent_engine_app.py
180
180
  {%- endif %}
181
181
 
182
+ # Alias for 'make deploy' for backward compatibility
183
+ backend: deploy
184
+
182
185
 
183
186
  # ==============================================================================
184
187
  # Infrastructure Setup
@@ -235,13 +238,8 @@ lint:
235
238
  # ==============================================================================
236
239
 
237
240
  # Register the deployed agent to Gemini Enterprise
238
- # Usage: make register-gemini-enterprise GEMINI_ENTERPRISE_APP_ID=projects/{project_number}/locations/{location}/collections/{collection}/engines/{engine_id} [AGENT_ENGINE_ID=<id>] # Defaults to deployment_metadata.json
241
+ # Usage: make register-gemini-enterprise ARGS="--gemini-enterprise-app-id=xxx --display-name='My Agent'"
242
+ # Or set environment variables: GEMINI_ENTERPRISE_APP_ID, GEMINI_DISPLAY_NAME, GEMINI_DESCRIPTION, etc.
239
243
  register-gemini-enterprise:
240
- uvx --from agent-starter-pack agent-starter-pack-register-gemini-enterprise \
241
- $(if $(GEMINI_ENTERPRISE_APP_ID),--gemini-enterprise-app-id="$(GEMINI_ENTERPRISE_APP_ID)",) \
242
- $(if $(AGENT_ENGINE_ID),--agent-engine-id="$(AGENT_ENGINE_ID)",) \
243
- $(if $(GEMINI_DISPLAY_NAME),--display-name="$(GEMINI_DISPLAY_NAME)",) \
244
- $(if $(GEMINI_DESCRIPTION),--description="$(GEMINI_DESCRIPTION)",) \
245
- $(if $(GEMINI_TOOL_DESCRIPTION),--tool-description="$(GEMINI_TOOL_DESCRIPTION)",) \
246
- $(if $(GEMINI_AUTHORIZATION_ID),--authorization-id="$(GEMINI_AUTHORIZATION_ID)",)
244
+ uvx --from agent-starter-pack agent-starter-pack-register-gemini-enterprise $(ARGS)
247
245
  {%- endif %}
@@ -59,11 +59,11 @@ make install && make playground
59
59
  {%- endif %}
60
60
  {%- if cookiecutter.deployment_target == 'cloud_run' %}
61
61
  | `make playground` | Launch local development environment with backend and frontend{%- if cookiecutter.is_adk %} - leveraging `adk web` command. {%- endif %}|
62
- | `make backend` | Deploy agent to Cloud Run (use `IAP=true` to enable Identity-Aware Proxy, `PORT=8080` to specify container port) |
62
+ | `make deploy` | Deploy agent to Cloud Run (use `IAP=true` to enable Identity-Aware Proxy, `PORT=8080` to specify container port) |
63
63
  | `make local-backend` | Launch local development server with hot-reload |
64
64
  {%- elif cookiecutter.deployment_target == 'agent_engine' %}
65
65
  | `make playground` | Launch Streamlit interface for testing agent locally and remotely |
66
- | `make backend` | Deploy agent to Agent Engine |
66
+ | `make deploy` | Deploy agent to Agent Engine |
67
67
  {%- if cookiecutter.is_adk_live %}
68
68
  | `make local-backend` | Launch local development server with hot-reload |
69
69
  | `make ui` | Start the frontend UI separately for development (requires backend running separately) |
@@ -160,10 +160,10 @@ You can test deployment towards a Dev Environment using the following command:
160
160
 
161
161
  ```bash
162
162
  gcloud config set project <your-dev-project-id>
163
- make backend
163
+ make deploy
164
164
  ```
165
165
  {% if cookiecutter.is_adk_live %}
166
- **Note:** For secure access to your deployed backend, consider using Identity-Aware Proxy (IAP) by running `make backend IAP=true`.
166
+ **Note:** For secure access to your deployed backend, consider using Identity-Aware Proxy (IAP) by running `make deploy IAP=true`.
167
167
  {%- endif %}
168
168
 
169
169
  The repository includes a Terraform configuration for the setup of the Dev Google Cloud project.
@@ -276,6 +276,20 @@ data "google_secret_manager_secret" "github_pat" {
276
276
  secret_id = var.github_pat_secret_id
277
277
  }
278
278
 
279
+ # Get CICD project data for Cloud Build service account
280
+ data "google_project" "cicd_project" {
281
+ project_id = var.cicd_runner_project_id
282
+ }
283
+
284
+ # Grant Cloud Build service account access to GitHub PAT secret
285
+ resource "google_secret_manager_secret_iam_member" "cloudbuild_secret_accessor" {
286
+ project = var.cicd_runner_project_id
287
+ secret_id = data.google_secret_manager_secret.github_pat.secret_id
288
+ role = "roles/secretmanager.secretAccessor"
289
+ member = "serviceAccount:service-${data.google_project.cicd_project.number}@gcp-sa-cloudbuild.iam.gserviceaccount.com"
290
+ depends_on = [resource.google_project_service.cicd_services]
291
+ }
292
+
279
293
  # Create the GitHub connection (fallback for manual Terraform usage)
280
294
  resource "google_cloudbuildv2_connection" "github_connection" {
281
295
  count = var.create_cb_connection ? 0 : 1
@@ -289,7 +303,11 @@ resource "google_cloudbuildv2_connection" "github_connection" {
289
303
  oauth_token_secret_version = "${data.google_secret_manager_secret.github_pat.id}/versions/latest"
290
304
  }
291
305
  }
292
- depends_on = [resource.google_project_service.cicd_services, resource.google_project_service.deploy_project_services]
306
+ depends_on = [
307
+ resource.google_project_service.cicd_services,
308
+ resource.google_project_service.deploy_project_services,
309
+ resource.google_secret_manager_secret_iam_member.cloudbuild_secret_accessor
310
+ ]
293
311
  }
294
312
 
295
313
 
@@ -17,6 +17,7 @@ import logging
17
17
  import os
18
18
  import sys
19
19
 
20
+ import backoff
20
21
  from data_ingestion_pipeline.pipeline import pipeline
21
22
  from google.cloud import aiplatform
22
23
  from kfp import compiler
@@ -136,6 +137,22 @@ def parse_args() -> argparse.Namespace:
136
137
  return parsed_args
137
138
 
138
139
 
140
+ @backoff.on_exception(
141
+ backoff.expo,
142
+ Exception,
143
+ max_tries=3,
144
+ max_time=3600,
145
+ on_backoff=lambda details: logging.warning(
146
+ f"Pipeline attempt {details['tries']} failed, retrying in {details['wait']:.1f}s..."
147
+ ),
148
+ )
149
+ def submit_and_wait_pipeline(pipeline_job_params: dict, service_account: str) -> None:
150
+ """Submit pipeline job and wait for completion with retry logic."""
151
+ job = aiplatform.PipelineJob(**pipeline_job_params)
152
+ job.submit(service_account=service_account)
153
+ job.wait()
154
+
155
+
139
156
  if __name__ == "__main__":
140
157
  args = parse_args()
141
158
 
@@ -182,17 +199,14 @@ if __name__ == "__main__":
182
199
  )
183
200
  {%- endif %}
184
201
 
185
- # Create pipeline job instance
186
- job = aiplatform.PipelineJob(**pipeline_job_params)
187
-
188
202
  if not args.schedule_only:
189
203
  logging.info("Running pipeline and waiting for completion...")
190
- job.submit(service_account=args.service_account)
191
- job.wait()
204
+ submit_and_wait_pipeline(pipeline_job_params, args.service_account)
192
205
  logging.info("Pipeline completed!")
193
206
 
194
207
  if args.cron_schedule and args.schedule_only:
195
- # No need to create new job instance since we already have one with the same params
208
+ # Create pipeline job instance for scheduling
209
+ job = aiplatform.PipelineJob(**pipeline_job_params)
196
210
  pipeline_job_schedule = aiplatform.PipelineJobSchedule(
197
211
  pipeline_job=job,
198
212
  display_name=f"{args.pipeline_name} Weekly Ingestion Job",
@@ -5,6 +5,7 @@ description = "Data ingestion pipeline for RAG retriever"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.9, <=3.13"
7
7
  dependencies = [
8
+ "backoff>=2.2.0",
8
9
  "google-cloud-aiplatform>=1.80.0",
9
10
  "google-cloud-pipeline-components>=2.19.0",
10
11
  "kfp>=1.4.0",