agent-starter-pack 0.0.4b0__py3-none-any.whl → 0.0.6b0__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.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: agent-starter-pack
3
- Version: 0.0.4b0
3
+ Version: 0.0.6b0
4
4
  Summary: CLI tool to create GCP-based AI agent projects from templates
5
5
  Author-email: Google LLC <agent-starter-pack@google.com>
6
6
  License: Apache-2.0
@@ -57,7 +57,7 @@ src/base_template/deployment/terraform/dev/vars/env.tfvars,sha256=xz5cYG29ZIgqM1
57
57
  src/base_template/deployment/terraform/vars/env.tfvars,sha256=2dxWRDzeolN2f7eKSHXcBiBt9fRcIMO6VH-2MAZevLQ,1633
58
58
  src/base_template/tests/unit/test_utils/test_tracing_exporter.py,sha256=JAb0vIB7wNFPm_kaDaHcxtPKNReypDHjdsMQyzpuePQ,4687
59
59
  src/cli/main.py,sha256=134KpcOQlexr_vR-KT3D3B1jKh1Y6S3qHGJ-9uD9Kkg,950
60
- src/cli/commands/create.py,sha256=KkGte-FAvuSwkivuTLJ8s_HqpAJ35senyWA04VUKllA,16898
60
+ src/cli/commands/create.py,sha256=oupbVv8zfMho4JowBCvgr0YpS2I7mYWCDR3We8VxqjI,18497
61
61
  src/cli/commands/setup_cicd.py,sha256=EgVkDdA94npDHHPTuYDmWNIiRscnsXtN7CbTuelrTVU,28347
62
62
  src/cli/utils/__init__.py,sha256=x-k6jfcv68_zYS88LrA1mr0yB5y5SekJ0nc5Tvt6iDA,1064
63
63
  src/cli/utils/cicd.py,sha256=x-8PKp4aevkUwAmtbEZVwu0UlrA6ifXGbouxICu1D0o,25664
@@ -135,7 +135,7 @@ src/frontends/streamlit/frontend/utils/local_chat_history.py,sha256=9wc8L8j4tk10
135
135
  src/frontends/streamlit/frontend/utils/message_editing.py,sha256=YWoPe2KeWMuL3YVTm0am6MK3kzjEIYVmdkdwTQpmGdQ,2263
136
136
  src/frontends/streamlit/frontend/utils/multimodal_utils.py,sha256=v6YbCkz_YcnEo-9YvRjwBNt0SzU4M39bYxJGmKk69vE,7313
137
137
  src/frontends/streamlit/frontend/utils/stream_handler.py,sha256=J7MMsOR2GvDEsyJbsv8VQeZbMs7mNySrclZNfuzsZD4,11578
138
- src/frontends/streamlit/frontend/utils/title_summary.py,sha256=JtFnPzS3JcEcZRrRmFVz5wZacORVLtN86MEjCTqP-wA,2405
138
+ src/frontends/streamlit/frontend/utils/title_summary.py,sha256=8yaatgn86wwzc9wXY83tubUxxC-Cu-8LY9O5xo3IaJA,2526
139
139
  src/resources/containers/data_processing/Dockerfile,sha256=uXjqDiSrr7YpoX-vtzaIJIVXZ2qeUpu1Nzju9qWZ9oI,859
140
140
  src/resources/locks/uv-agentic_rag_vertexai_search-agent_engine.lock,sha256=6muWlgt4dduqGDiGUvTg-d2zzY5rgW9zP9DbDnt3krc,474353
141
141
  src/resources/locks/uv-agentic_rag_vertexai_search-cloud_run.lock,sha256=ViUzp35RGWZiiQvvVi6ntFTT-bEbHg4_HDDQznD4ML8,756574
@@ -150,8 +150,8 @@ src/resources/setup_cicd/providers.tf,sha256=Km4z6IJt7x7PLaa0kyZbBrO2m3lpuIJZFD5
150
150
  src/utils/generate_locks.py,sha256=xu5IAhGGBPkVQGSJX4kk7_JNDwWJUEaXAHbmaQIohbg,4386
151
151
  src/utils/lock_utils.py,sha256=plw3vWkRViCMxBK3IrLRHtF_I0kbbP043T9KIYxcb20,2423
152
152
  src/utils/watch_and_rebuild.py,sha256=IdbTLReYknTXXu5KWPz3sc7Zg5HTEMS5UVlMSnuhs5E,6067
153
- agent_starter_pack-0.0.4b0.dist-info/METADATA,sha256=_m-NtcmnQH_6wZWro1uVIG6dBJTQia3GEuh1AlSblVE,6805
154
- agent_starter_pack-0.0.4b0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
155
- agent_starter_pack-0.0.4b0.dist-info/entry_points.txt,sha256=U7uCxR7YulIhZ0L8R8Hui0Bsy6J7oyESBeDYJYMrQjA,56
156
- agent_starter_pack-0.0.4b0.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
157
- agent_starter_pack-0.0.4b0.dist-info/RECORD,,
153
+ agent_starter_pack-0.0.6b0.dist-info/METADATA,sha256=yYnMdi49WWJ3JG27GPtJmM1oU08-QScuGDxF_R5u4iY,6805
154
+ agent_starter_pack-0.0.6b0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
155
+ agent_starter_pack-0.0.6b0.dist-info/entry_points.txt,sha256=U7uCxR7YulIhZ0L8R8Hui0Bsy6J7oyESBeDYJYMrQjA,56
156
+ agent_starter_pack-0.0.6b0.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
157
+ agent_starter_pack-0.0.6b0.dist-info/RECORD,,
@@ -13,6 +13,7 @@
13
13
  # limitations under the License.
14
14
 
15
15
  import logging
16
+ import os
16
17
  import pathlib
17
18
  import subprocess
18
19
 
@@ -161,18 +162,22 @@ def create(
161
162
 
162
163
  # GCP Setup
163
164
  logging.debug("Setting up GCP...")
164
-
165
+
165
166
  # Check for uv installation if not skipping checks
166
167
  if not skip_checks:
167
168
  check_and_install_uv()
168
-
169
+
169
170
  # Set up GCP environment
170
- setup_gcp_environment(
171
- auto_approve=auto_approve,
172
- skip_checks=skip_checks,
173
- region=region,
174
- debug=debug
175
- )
171
+ try:
172
+ setup_gcp_environment(
173
+ auto_approve=auto_approve,
174
+ skip_checks=skip_checks,
175
+ region=region,
176
+ debug=debug,
177
+ )
178
+ except Exception as e:
179
+ if debug:
180
+ logging.warning(f"GCP environment setup failed: {e}")
176
181
 
177
182
  # Process template
178
183
  template_path = get_template_path(final_agent, debug=debug)
@@ -259,122 +264,172 @@ def display_agent_selection(deployment_target: str | None = None) -> str:
259
264
  return agents[choice]["name"]
260
265
 
261
266
 
262
- def set_project_quota(project_id: str) -> None:
263
- """Set the GCP project and application default quota project.
264
-
267
+ def set_gcp_project(project_id: str, set_quota_project: bool = True) -> None:
268
+ """Set the GCP project and optionally the application default quota project.
269
+
265
270
  Args:
266
- project_id: The GCP project ID to set
271
+ project_id: The GCP project ID to set.
272
+ set_quota_project: Whether to set the application default quota project.
267
273
  """
268
274
  try:
269
275
  subprocess.run(
270
- ["gcloud", "config", "set", "project", project_id], check=True, capture_output=True, text=True
276
+ ["gcloud", "config", "set", "project", project_id],
277
+ check=True,
278
+ capture_output=True,
279
+ text=True,
271
280
  )
272
281
  except subprocess.CalledProcessError as e:
273
282
  console.print(f"\n> Error setting project to {project_id}:")
274
283
  console.print(e.stderr)
275
284
  raise
276
285
 
277
- try:
278
- subprocess.run(
279
- ["gcloud", "auth", "application-default", "set-quota-project", project_id],
280
- check=True, capture_output=True, text=True
281
- )
282
- except subprocess.CalledProcessError as e:
283
- console.print(f"> Error setting application default quota project:")
284
- console.print(e.stderr)
285
- raise
286
-
286
+ if set_quota_project:
287
+ try:
288
+ subprocess.run(
289
+ [
290
+ "gcloud",
291
+ "auth",
292
+ "application-default",
293
+ "set-quota-project",
294
+ project_id,
295
+ ],
296
+ check=True,
297
+ capture_output=True,
298
+ text=True,
299
+ )
300
+ except subprocess.CalledProcessError as e:
301
+ console.print("> Error setting application default quota project:")
302
+ console.print(e.stderr)
303
+ raise
304
+
287
305
  console.print(f"> Successfully configured project: {project_id}")
288
306
 
289
307
 
290
308
  def setup_gcp_environment(
291
- auto_approve: bool,
292
- skip_checks: bool,
293
- region: str,
294
- debug: bool
309
+ auto_approve: bool, skip_checks: bool, region: str, debug: bool
295
310
  ) -> dict:
296
311
  """Set up the GCP environment with proper credentials and project.
297
-
312
+
298
313
  Args:
299
314
  auto_approve: Whether to skip confirmation prompts
300
315
  skip_checks: Whether to skip verification checks
301
316
  region: GCP region for deployment
302
317
  debug: Whether debug logging is enabled
303
-
318
+
304
319
  Returns:
305
320
  Dictionary with credential information
306
321
  """
322
+ # Skip all verification if requested
307
323
  if skip_checks:
308
324
  if debug:
309
325
  logging.debug("Skipping verification checks due to --skip-checks flag")
310
326
  console.print("> Skipping verification checks", style="yellow")
311
- # Set a default creds_info when skipping checks
312
327
  return {"project": "unknown"}
313
-
328
+
314
329
  # Verify current GCP credentials
315
330
  if debug:
316
331
  logging.debug("Verifying GCP credentials...")
317
332
  creds_info = verify_credentials()
318
-
333
+
334
+ # Handle credential verification and project selection
319
335
  if not auto_approve:
320
- # Ask user if current credentials are correct
321
- change_creds = (
336
+ creds_info = _handle_credential_verification(creds_info)
337
+ else:
338
+ # Even with auto_approve, we should still set the GCP project
339
+ set_gcp_project(creds_info["project"], set_quota_project=True)
340
+
341
+ # Test Vertex AI connection
342
+ _test_vertex_ai_connection(creds_info["project"], region)
343
+
344
+ return creds_info
345
+
346
+
347
+ def _handle_credential_verification(creds_info: dict) -> dict:
348
+ """Handle verification of credentials and project selection.
349
+
350
+ Args:
351
+ creds_info: Current credential information
352
+
353
+ Returns:
354
+ Updated credential information
355
+ """
356
+ # Check if running in Cloud Shell
357
+ if os.environ.get("CLOUD_SHELL") == "true":
358
+ if creds_info["project"] == "":
359
+ console.print("> It looks like you are running in Cloud Shell.")
360
+ console.print(
361
+ "> You need to set up a project ID to continue, but you haven't setup a project yet."
362
+ )
363
+ new_project = Prompt.ask("\n> Enter a project ID")
364
+ creds_info["project"] = new_project
365
+ set_gcp_project(creds_info["project"], set_quota_project=False)
366
+ return creds_info
367
+
368
+ # Ask user if current credentials are correct
369
+ change_creds = (
370
+ Prompt.ask(
371
+ f"\n> You are logged in with account '{creds_info['account']}' "
372
+ f"and using project '{creds_info['project']}'. "
373
+ "Is this correct?",
374
+ choices=["Y", "n"],
375
+ default="Y",
376
+ ).lower()
377
+ == "n"
378
+ )
379
+
380
+ if change_creds:
381
+ # Handle credential change
382
+ console.print("\n> Initiating new login...")
383
+ subprocess.run(["gcloud", "auth", "login", "--update-adc"], check=True)
384
+ console.print("> Login successful. Verifying new credentials...")
385
+
386
+ # Re-verify credentials after login
387
+ creds_info = verify_credentials()
388
+
389
+ # Prompt for project change
390
+ change_project = (
322
391
  Prompt.ask(
323
- f"\n> You are logged in with account '{creds_info['account']}' "
324
- f"and using project '{creds_info['project']}'. "
392
+ f"\n> You are now logged in with account '{creds_info['account']}'. "
393
+ f"Current project is '{creds_info['project']}'. "
325
394
  "Is this correct?",
326
- choices=["Y", "n"],
327
- default="Y",
328
- ).lower() == "n"
395
+ choices=["y", "n"],
396
+ default="y",
397
+ ).lower()
398
+ == "n"
329
399
  )
330
-
331
- if change_creds:
332
- # Handle credential change
333
- console.print("\n> Initiating new login...")
334
- subprocess.run(["gcloud", "auth", "login", "--update-adc"], check=True)
335
- console.print("> Login successful. Verifying new credentials...")
336
-
337
- # Re-verify credentials after login
338
- creds_info = verify_credentials()
339
-
340
- # Prompt for project change
341
- change_project = (
342
- Prompt.ask(
343
- f"\n> You are now logged in with account '{creds_info['account']}'. "
344
- f"Current project is '{creds_info['project']}'. "
345
- "Do you wish to change the project?",
346
- choices=["y", "n"],
347
- default="n",
348
- ).lower() == "y"
349
- )
350
-
351
- if change_project:
352
- # Prompt for new project ID
353
- new_project = Prompt.ask("\n> Enter the new project ID")
354
- creds_info["project"] = new_project
355
-
356
- # Always set project and quota, regardless of whether credentials were changed
357
- set_project_quota(creds_info["project"])
358
-
359
- # Test Vertex AI connection
400
+
401
+ if change_project:
402
+ # Prompt for new project ID
403
+ new_project = Prompt.ask("\n> Enter the new project ID")
404
+ creds_info["project"] = new_project
405
+
406
+ set_gcp_project(creds_info["project"], set_quota_project=True)
407
+ return creds_info
408
+
409
+
410
+ def _test_vertex_ai_connection(project_id: str, region: str) -> None:
411
+ """Test connection to Vertex AI.
412
+
413
+ Args:
414
+ project_id: GCP project ID
415
+ region: GCP region for deployment
416
+ """
360
417
  console.print("> Testing GCP and Vertex AI Connection...")
361
418
  try:
362
419
  verify_vertex_connection(
363
- project_id=creds_info["project"],
420
+ project_id=project_id,
364
421
  location=region,
365
422
  )
366
423
  console.print(
367
- f"> ✓ Successfully verified connection to Vertex AI in project {creds_info['project']}"
424
+ f"> ✓ Successfully verified connection to Vertex AI in project {project_id}"
368
425
  )
369
426
  except Exception as e:
370
427
  console.print(
371
428
  f"> ✗ Failed to connect to Vertex AI: {e!s}\n"
372
429
  f"> Please check your authentication settings and permissions. "
373
- f"Visit https://cloud.google.com/vertex-ai/docs/authentication for help.",
374
- style="bold red"
430
+ f"Visit https://cloud.google.com/vertex-ai/docs/authentication for help.",
431
+ style="bold red",
375
432
  )
376
-
377
- return creds_info
378
433
 
379
434
 
380
435
  def replace_region_in_files(
@@ -12,14 +12,19 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
+ import google.auth
15
16
  import os
16
17
 
17
18
  from langchain_core.prompts import ChatPromptTemplate, MessagesPlaceholder
18
19
  from langchain_google_vertexai import ChatVertexAI
19
20
 
21
+ # Get default project from credentials
22
+ _, project_id = google.auth.default()
23
+
20
24
  llm = ChatVertexAI(
21
25
  model_name="gemini-2.0-flash-001",
22
26
  temperature=0,
27
+ project=project_id,
23
28
  location=os.getenv("LOCATION", "us-central1"),
24
29
  )
25
30