google-cloud-agentplatform 2.6.0__tar.gz → 2.7.0__tar.gz

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 (74) hide show
  1. {google_cloud_agentplatform-2.6.0/google_cloud_agentplatform.egg-info → google_cloud_agentplatform-2.7.0}/PKG-INFO +1 -1
  2. {google_cloud_agentplatform-2.6.0 → google_cloud_agentplatform-2.7.0}/agentplatform/_genai/_runtimes_utils.py +0 -5
  3. {google_cloud_agentplatform-2.6.0 → google_cloud_agentplatform-2.7.0}/agentplatform/_genai/model_garden.py +42 -3
  4. {google_cloud_agentplatform-2.6.0 → google_cloud_agentplatform-2.7.0}/agentplatform/_genai/sandboxes.py +5 -4
  5. {google_cloud_agentplatform-2.6.0 → google_cloud_agentplatform-2.7.0}/agentplatform/_genai/types/common.py +7 -2
  6. {google_cloud_agentplatform-2.6.0 → google_cloud_agentplatform-2.7.0}/agentplatform/frameworks/adk.py +15 -4
  7. {google_cloud_agentplatform-2.6.0 → google_cloud_agentplatform-2.7.0}/agentplatform/version.py +1 -1
  8. {google_cloud_agentplatform-2.6.0 → google_cloud_agentplatform-2.7.0/google_cloud_agentplatform.egg-info}/PKG-INFO +1 -1
  9. {google_cloud_agentplatform-2.6.0 → google_cloud_agentplatform-2.7.0}/LICENSE +0 -0
  10. {google_cloud_agentplatform-2.6.0 → google_cloud_agentplatform-2.7.0}/README.md +0 -0
  11. {google_cloud_agentplatform-2.6.0 → google_cloud_agentplatform-2.7.0}/agentplatform/__init__.py +0 -0
  12. {google_cloud_agentplatform-2.6.0 → google_cloud_agentplatform-2.7.0}/agentplatform/_genai/__init__.py +0 -0
  13. {google_cloud_agentplatform-2.6.0 → google_cloud_agentplatform-2.7.0}/agentplatform/_genai/_bigquery_utils.py +0 -0
  14. {google_cloud_agentplatform-2.6.0 → google_cloud_agentplatform-2.7.0}/agentplatform/_genai/_datasets_utils.py +0 -0
  15. {google_cloud_agentplatform-2.6.0 → google_cloud_agentplatform-2.7.0}/agentplatform/_genai/_evals_builtin_tools.py +0 -0
  16. {google_cloud_agentplatform-2.6.0 → google_cloud_agentplatform-2.7.0}/agentplatform/_genai/_evals_common.py +0 -0
  17. {google_cloud_agentplatform-2.6.0 → google_cloud_agentplatform-2.7.0}/agentplatform/_genai/_evals_constant.py +0 -0
  18. {google_cloud_agentplatform-2.6.0 → google_cloud_agentplatform-2.7.0}/agentplatform/_genai/_evals_data_converters.py +0 -0
  19. {google_cloud_agentplatform-2.6.0 → google_cloud_agentplatform-2.7.0}/agentplatform/_genai/_evals_metric_handlers.py +0 -0
  20. {google_cloud_agentplatform-2.6.0 → google_cloud_agentplatform-2.7.0}/agentplatform/_genai/_evals_metric_loaders.py +0 -0
  21. {google_cloud_agentplatform-2.6.0 → google_cloud_agentplatform-2.7.0}/agentplatform/_genai/_evals_utils.py +0 -0
  22. {google_cloud_agentplatform-2.6.0 → google_cloud_agentplatform-2.7.0}/agentplatform/_genai/_evals_visualization.py +0 -0
  23. {google_cloud_agentplatform-2.6.0 → google_cloud_agentplatform-2.7.0}/agentplatform/_genai/_gcs_utils.py +0 -0
  24. {google_cloud_agentplatform-2.6.0 → google_cloud_agentplatform-2.7.0}/agentplatform/_genai/_logging_utils.py +0 -0
  25. {google_cloud_agentplatform-2.6.0 → google_cloud_agentplatform-2.7.0}/agentplatform/_genai/_memory_bank_utils.py +0 -0
  26. {google_cloud_agentplatform-2.6.0 → google_cloud_agentplatform-2.7.0}/agentplatform/_genai/_observability_data_converter.py +0 -0
  27. {google_cloud_agentplatform-2.6.0 → google_cloud_agentplatform-2.7.0}/agentplatform/_genai/_operations_utils.py +0 -0
  28. {google_cloud_agentplatform-2.6.0 → google_cloud_agentplatform-2.7.0}/agentplatform/_genai/_prompt_management_utils.py +0 -0
  29. {google_cloud_agentplatform-2.6.0 → google_cloud_agentplatform-2.7.0}/agentplatform/_genai/_prompt_optimizer_utils.py +0 -0
  30. {google_cloud_agentplatform-2.6.0 → google_cloud_agentplatform-2.7.0}/agentplatform/_genai/_skills_utils.py +0 -0
  31. {google_cloud_agentplatform-2.6.0 → google_cloud_agentplatform-2.7.0}/agentplatform/_genai/_transformers.py +0 -0
  32. {google_cloud_agentplatform-2.6.0 → google_cloud_agentplatform-2.7.0}/agentplatform/_genai/a2a_task_events.py +0 -0
  33. {google_cloud_agentplatform-2.6.0 → google_cloud_agentplatform-2.7.0}/agentplatform/_genai/a2a_tasks.py +0 -0
  34. {google_cloud_agentplatform-2.6.0 → google_cloud_agentplatform-2.7.0}/agentplatform/_genai/client.py +0 -0
  35. {google_cloud_agentplatform-2.6.0 → google_cloud_agentplatform-2.7.0}/agentplatform/_genai/datasets.py +0 -0
  36. {google_cloud_agentplatform-2.6.0 → google_cloud_agentplatform-2.7.0}/agentplatform/_genai/endpoints.py +0 -0
  37. {google_cloud_agentplatform-2.6.0 → google_cloud_agentplatform-2.7.0}/agentplatform/_genai/evals.py +0 -0
  38. {google_cloud_agentplatform-2.6.0 → google_cloud_agentplatform-2.7.0}/agentplatform/_genai/example_stores.py +0 -0
  39. {google_cloud_agentplatform-2.6.0 → google_cloud_agentplatform-2.7.0}/agentplatform/_genai/feedback_contexts.py +0 -0
  40. {google_cloud_agentplatform-2.6.0 → google_cloud_agentplatform-2.7.0}/agentplatform/_genai/feedback_entries.py +0 -0
  41. {google_cloud_agentplatform-2.6.0 → google_cloud_agentplatform-2.7.0}/agentplatform/_genai/live.py +0 -0
  42. {google_cloud_agentplatform-2.6.0 → google_cloud_agentplatform-2.7.0}/agentplatform/_genai/live_runtimes.py +0 -0
  43. {google_cloud_agentplatform-2.6.0 → google_cloud_agentplatform-2.7.0}/agentplatform/_genai/memories.py +0 -0
  44. {google_cloud_agentplatform-2.6.0 → google_cloud_agentplatform-2.7.0}/agentplatform/_genai/memory_banks.py +0 -0
  45. {google_cloud_agentplatform-2.6.0 → google_cloud_agentplatform-2.7.0}/agentplatform/_genai/memory_revisions.py +0 -0
  46. {google_cloud_agentplatform-2.6.0 → google_cloud_agentplatform-2.7.0}/agentplatform/_genai/prompt_optimizer.py +0 -0
  47. {google_cloud_agentplatform-2.6.0 → google_cloud_agentplatform-2.7.0}/agentplatform/_genai/prompts.py +0 -0
  48. {google_cloud_agentplatform-2.6.0 → google_cloud_agentplatform-2.7.0}/agentplatform/_genai/rag.py +0 -0
  49. {google_cloud_agentplatform-2.6.0 → google_cloud_agentplatform-2.7.0}/agentplatform/_genai/runtime_revisions.py +0 -0
  50. {google_cloud_agentplatform-2.6.0 → google_cloud_agentplatform-2.7.0}/agentplatform/_genai/runtimes.py +0 -0
  51. {google_cloud_agentplatform-2.6.0 → google_cloud_agentplatform-2.7.0}/agentplatform/_genai/sandbox_snapshots.py +0 -0
  52. {google_cloud_agentplatform-2.6.0 → google_cloud_agentplatform-2.7.0}/agentplatform/_genai/sandbox_templates.py +0 -0
  53. {google_cloud_agentplatform-2.6.0 → google_cloud_agentplatform-2.7.0}/agentplatform/_genai/serving_profiles.py +0 -0
  54. {google_cloud_agentplatform-2.6.0 → google_cloud_agentplatform-2.7.0}/agentplatform/_genai/session_events.py +0 -0
  55. {google_cloud_agentplatform-2.6.0 → google_cloud_agentplatform-2.7.0}/agentplatform/_genai/sessions.py +0 -0
  56. {google_cloud_agentplatform-2.6.0 → google_cloud_agentplatform-2.7.0}/agentplatform/_genai/skill_revisions.py +0 -0
  57. {google_cloud_agentplatform-2.6.0 → google_cloud_agentplatform-2.7.0}/agentplatform/_genai/skills.py +0 -0
  58. {google_cloud_agentplatform-2.6.0 → google_cloud_agentplatform-2.7.0}/agentplatform/_genai/types/__init__.py +0 -0
  59. {google_cloud_agentplatform-2.6.0 → google_cloud_agentplatform-2.7.0}/agentplatform/_genai/types/agent_engines.py +0 -0
  60. {google_cloud_agentplatform-2.6.0 → google_cloud_agentplatform-2.7.0}/agentplatform/_genai/types/evals.py +0 -0
  61. {google_cloud_agentplatform-2.6.0 → google_cloud_agentplatform-2.7.0}/agentplatform/_genai/types/prompt_optimizer.py +0 -0
  62. {google_cloud_agentplatform-2.6.0 → google_cloud_agentplatform-2.7.0}/agentplatform/_genai/types/prompts.py +0 -0
  63. {google_cloud_agentplatform-2.6.0 → google_cloud_agentplatform-2.7.0}/agentplatform/frameworks/__init__.py +0 -0
  64. {google_cloud_agentplatform-2.6.0 → google_cloud_agentplatform-2.7.0}/agentplatform/frameworks/a2a.py +0 -0
  65. {google_cloud_agentplatform-2.6.0 → google_cloud_agentplatform-2.7.0}/agentplatform/frameworks/ag2.py +0 -0
  66. {google_cloud_agentplatform-2.6.0 → google_cloud_agentplatform-2.7.0}/agentplatform/frameworks/langchain.py +0 -0
  67. {google_cloud_agentplatform-2.6.0 → google_cloud_agentplatform-2.7.0}/agentplatform/frameworks/langgraph.py +0 -0
  68. {google_cloud_agentplatform-2.6.0 → google_cloud_agentplatform-2.7.0}/agentplatform/frameworks/llama_index.py +0 -0
  69. {google_cloud_agentplatform-2.6.0 → google_cloud_agentplatform-2.7.0}/google_cloud_agentplatform.egg-info/SOURCES.txt +0 -0
  70. {google_cloud_agentplatform-2.6.0 → google_cloud_agentplatform-2.7.0}/google_cloud_agentplatform.egg-info/dependency_links.txt +0 -0
  71. {google_cloud_agentplatform-2.6.0 → google_cloud_agentplatform-2.7.0}/google_cloud_agentplatform.egg-info/requires.txt +0 -0
  72. {google_cloud_agentplatform-2.6.0 → google_cloud_agentplatform-2.7.0}/google_cloud_agentplatform.egg-info/top_level.txt +0 -0
  73. {google_cloud_agentplatform-2.6.0 → google_cloud_agentplatform-2.7.0}/pyproject.toml +0 -0
  74. {google_cloud_agentplatform-2.6.0 → google_cloud_agentplatform-2.7.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: google-cloud-agentplatform
3
- Version: 2.6.0
3
+ Version: 2.7.0
4
4
  Summary: Google Cloud Agent Platform Client Library
5
5
  Author-email: Google LLC <googleapis-packages@google.com>
6
6
  License: Apache-2.0
@@ -1294,11 +1294,6 @@ def _upload_runtime(
1294
1294
  "`from a2a import types`."
1295
1295
  )
1296
1296
  raise TypeError(error_msg) from e
1297
- with blob.open("rb") as f:
1298
- try:
1299
- _ = cloudpickle.load(f)
1300
- except Exception as e:
1301
- raise TypeError("agent runtime serialized to an invalid format") from e
1302
1297
  dir_name = f"gs://{gcs_bucket.name}/{gcs_dir_name}"
1303
1298
  logger.info(f"Wrote to {dir_name}/{_BLOB_FILENAME}")
1304
1299
 
@@ -1157,6 +1157,33 @@ class ModelGarden(_api_module.BaseModule):
1157
1157
  _DEFAULT_DEPLOY_TIMEOUT_SECONDS = 2 * 60 * 60
1158
1158
  _DEFAULT_DEPLOY_POLL_INTERVAL_SECONDS = 30
1159
1159
 
1160
+ # Model Garden catalog reads (ListPublisherModels, GetPublisherModel) are
1161
+ # served from us-central1, as in vertexai.model_garden. Other regional
1162
+ # endpoints return a partial catalog (e.g. no deploy configs for models that
1163
+ # deploy fine there, since Deploy reads the global model configs).
1164
+ _CATALOG_BASE_URL = "https://us-central1-aiplatform.googleapis.com/"
1165
+
1166
+ @staticmethod
1167
+ def _catalog_http_options(
1168
+ api_client: Any,
1169
+ ) -> Optional[genai_types.HttpOptions]:
1170
+ """Returns ``http_options`` that send catalog reads to us-central1.
1171
+
1172
+ Only the catalog reads are routed this way; deploy, export and batch
1173
+ requests still go to the client's location.
1174
+
1175
+ Args:
1176
+ api_client: The client's API client.
1177
+
1178
+ Returns:
1179
+ ``HttpOptions`` with the us-central1 base URL, or None when the client
1180
+ was created with a custom ``base_url`` (e.g. a proxy or private
1181
+ endpoint), which is then left unchanged.
1182
+ """
1183
+ if api_client.custom_base_url:
1184
+ return None
1185
+ return genai_types.HttpOptions(base_url=ModelGarden._CATALOG_BASE_URL)
1186
+
1160
1187
  @staticmethod
1161
1188
  def _build_filter_str(
1162
1189
  model_filter: Optional[str],
@@ -1573,9 +1600,11 @@ class ModelGarden(_api_module.BaseModule):
1573
1600
  endpoint_config = types.DeployRequestEndpointConfig(
1574
1601
  endpoint_display_name=config.endpoint_display_name,
1575
1602
  )
1576
- disabled = config.dedicated_endpoint_disabled
1577
- if disabled is not None:
1578
- endpoint_config.dedicated_endpoint_enabled = not disabled
1603
+ # Send the current field, as vertexai.model_garden does. The deprecated
1604
+ # dedicated_endpoint_enabled cannot express "off": False is its proto3
1605
+ # default, so the backend would keep its default (dedicated endpoint on).
1606
+ if config.dedicated_endpoint_disabled:
1607
+ endpoint_config.dedicated_endpoint_disabled = True
1579
1608
  if config.enable_private_service_connect:
1580
1609
  endpoint_config.private_service_connect_config = (
1581
1610
  types.PrivateServiceConnectConfig(
@@ -1598,6 +1627,10 @@ class ModelGarden(_api_module.BaseModule):
1598
1627
  max_replica_count=config.max_replica_count,
1599
1628
  spot=config.spot,
1600
1629
  )
1630
+ elif config.spot:
1631
+ # Without a machine shape the backend deploys the model's default
1632
+ # verified config and applies spot to it, as with vertexai.model_garden.
1633
+ deploy_config.dedicated_resources = types.DedicatedResources(spot=True)
1601
1634
 
1602
1635
  return model_config, endpoint_config, deploy_config
1603
1636
 
@@ -1710,6 +1743,7 @@ class ModelGarden(_api_module.BaseModule):
1710
1743
  filter=api_config.filter,
1711
1744
  list_all_versions=api_config.list_all_versions,
1712
1745
  page_token=page_token,
1746
+ http_options=api_config.http_options,
1713
1747
  )
1714
1748
  response = self._list_publisher_models(
1715
1749
  parent="publishers/*",
@@ -1746,6 +1780,7 @@ class ModelGarden(_api_module.BaseModule):
1746
1780
  api_config = types.ListPublisherModelsConfig(
1747
1781
  filter=filter_str,
1748
1782
  list_all_versions=True,
1783
+ http_options=ModelGarden._catalog_http_options(self._api_client),
1749
1784
  )
1750
1785
 
1751
1786
  models = self._list_all_publisher_models(api_config)
@@ -1859,6 +1894,7 @@ class ModelGarden(_api_module.BaseModule):
1859
1894
  get_publisher_model_config = types.GetPublisherModelConfig(
1860
1895
  is_hugging_face_model=self._is_hugging_face_model(model),
1861
1896
  include_equivalent_model_garden_model_deployment_configs=True,
1897
+ http_options=ModelGarden._catalog_http_options(self._api_client),
1862
1898
  )
1863
1899
  publisher_model = self._get_publisher_model(
1864
1900
  name=self._reconcile_model_name(model),
@@ -3189,6 +3225,7 @@ class AsyncModelGarden(_api_module.BaseModule):
3189
3225
  filter=api_config.filter,
3190
3226
  list_all_versions=api_config.list_all_versions,
3191
3227
  page_token=page_token,
3228
+ http_options=api_config.http_options,
3192
3229
  )
3193
3230
  response = await self._list_publisher_models(
3194
3231
  parent="publishers/*",
@@ -3225,6 +3262,7 @@ class AsyncModelGarden(_api_module.BaseModule):
3225
3262
  api_config = types.ListPublisherModelsConfig(
3226
3263
  filter=filter_str,
3227
3264
  list_all_versions=True,
3265
+ http_options=ModelGarden._catalog_http_options(self._api_client),
3228
3266
  )
3229
3267
 
3230
3268
  models = await self._list_all_publisher_models(api_config)
@@ -3336,6 +3374,7 @@ class AsyncModelGarden(_api_module.BaseModule):
3336
3374
  api_config = types.GetPublisherModelConfig(
3337
3375
  is_hugging_face_model=ModelGarden._is_hugging_face_model(model),
3338
3376
  include_equivalent_model_garden_model_deployment_configs=True,
3377
+ http_options=ModelGarden._catalog_http_options(self._api_client),
3339
3378
  )
3340
3379
  publisher_model = await self._get_publisher_model(
3341
3380
  name=ModelGarden._reconcile_model_name(model), config=api_config
@@ -1403,9 +1403,9 @@ class Sandboxes(_api_module.BaseModule):
1403
1403
  if not connection_info:
1404
1404
  raise ValueError("Connection info is not available.")
1405
1405
  if psc_endpoint:
1406
- # VPC-SC path: caller has provisioned a PSC endpoint against
1407
- # connection_info.service_attachment and passes its host here.
1408
- endpoint = "https://" + psc_endpoint
1406
+ # VPC-SC path: PSC endpoint routes to the router pod, which serves
1407
+ # plain HTTP on `port`.
1408
+ endpoint = f"http://{psc_endpoint}:{port}"
1409
1409
  elif connection_info.load_balancer_hostname:
1410
1410
  endpoint = "https://" + connection_info.load_balancer_hostname
1411
1411
  elif connection_info.load_balancer_ip:
@@ -1489,7 +1489,8 @@ class Sandboxes(_api_module.BaseModule):
1489
1489
 
1490
1490
  connection_info = sandbox_environment.connection_info
1491
1491
  if psc_endpoint:
1492
- ws_base_url = "wss://" + psc_endpoint
1492
+ # VPC-SC path: see send_command for rationale.
1493
+ ws_base_url = f"ws://{psc_endpoint}:{port}"
1493
1494
  elif connection_info.load_balancer_hostname:
1494
1495
  ws_base_url = "wss://" + connection_info.load_balancer_hostname
1495
1496
  elif connection_info.load_balancer_ip:
@@ -32128,7 +32128,11 @@ class DeployPublisherModelConfig(_common.BaseModel):
32128
32128
  accelerator_count: Optional[int] = Field(
32129
32129
  default=None, description="""Number of accelerators per replica."""
32130
32130
  )
32131
- spot: Optional[bool] = Field(default=None, description="""Schedule on Spot VMs.""")
32131
+ spot: Optional[bool] = Field(
32132
+ default=None,
32133
+ description="""Schedule on Spot VMs. Without ``machine_type``, applies to the
32134
+ model's default machine.""",
32135
+ )
32132
32136
  dedicated_endpoint_disabled: Optional[bool] = Field(
32133
32137
  default=None,
32134
32138
  description="""Set True to serve predictions via the shared endpoint DNS
@@ -32217,7 +32221,8 @@ class DeployPublisherModelConfigDict(TypedDict, total=False):
32217
32221
  """Number of accelerators per replica."""
32218
32222
 
32219
32223
  spot: Optional[bool]
32220
- """Schedule on Spot VMs."""
32224
+ """Schedule on Spot VMs. Without ``machine_type``, applies to the
32225
+ model's default machine."""
32221
32226
 
32222
32227
  dedicated_endpoint_disabled: Optional[bool]
32223
32228
  """Set True to serve predictions via the shared endpoint DNS
@@ -114,6 +114,7 @@ if TYPE_CHECKING:
114
114
 
115
115
  _DEFAULT_APP_NAME = "default_app_name"
116
116
  _DEFAULT_USER_ID = "default-user-id"
117
+ _UPSTREAM_SESSION_ID_KEY = "agent_engine:upstream_session_id"
117
118
  _TELEMETRY_API_DISABLED_WARNING = """\
118
119
  Tracing integration for Agent Engine has migrated to a new API.
119
120
  The 'telemetry.googleapis.com' has not been enabled in project %s.
@@ -984,14 +985,18 @@ class AdkApp:
984
985
  session_service: "BaseSessionService",
985
986
  artifact_service: "BaseArtifactService",
986
987
  request: _StreamRunRequest,
988
+ state: Optional[Dict[str, Any]] = None,
987
989
  ):
988
990
  """Initializes the session, and returns the session id."""
989
991
  from google.adk.events.event import Event
990
992
 
991
- session = await session_service.create_session(
992
- app_name=self._app_name(),
993
- user_id=request.user_id,
994
- )
993
+ create_session_kwargs: Dict[str, Any] = {
994
+ "app_name": self._app_name(),
995
+ "user_id": request.user_id,
996
+ }
997
+ if state is not None:
998
+ create_session_kwargs["state"] = state
999
+ session = await session_service.create_session(**create_session_kwargs)
995
1000
  if not session:
996
1001
  raise RuntimeError("Create session failed.")
997
1002
  if request.events:
@@ -1530,6 +1535,11 @@ class AdkApp:
1530
1535
  you have defined for the AdkApp. This method is primarily meant for
1531
1536
  invocation from AgentSpace.
1532
1537
 
1538
+ When `request_json` includes a `session_id` that is not found in
1539
+ `session_service`, a new fallback session is created and the caller's
1540
+ `session_id` is stored in `session.state` under
1541
+ `agent_engine:upstream_session_id` (`_UPSTREAM_SESSION_ID_KEY`).
1542
+
1533
1543
  Args:
1534
1544
  request_json (str):
1535
1545
  Required. The request to stream responses for.
@@ -1594,6 +1604,7 @@ class AdkApp:
1594
1604
  session_service=session_service,
1595
1605
  artifact_service=artifact_service,
1596
1606
  request=request,
1607
+ state={_UPSTREAM_SESSION_ID_KEY: request.session_id},
1597
1608
  )
1598
1609
  else:
1599
1610
  # Not providing a session ID will create a new in-memory session.
@@ -14,4 +14,4 @@
14
14
  #
15
15
  """Version file for agentplatform."""
16
16
 
17
- __version__ = "2.6.0"
17
+ __version__ = "2.7.0"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: google-cloud-agentplatform
3
- Version: 2.6.0
3
+ Version: 2.7.0
4
4
  Summary: Google Cloud Agent Platform Client Library
5
5
  Author-email: Google LLC <googleapis-packages@google.com>
6
6
  License: Apache-2.0