google-cloud-agentplatform 1.165.1.dev0__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.
- agentplatform/__init__.py +72 -0
- agentplatform/_genai/__init__.py +43 -0
- agentplatform/_genai/_agent_engines_utils.py +2341 -0
- agentplatform/_genai/_bigquery_utils.py +49 -0
- agentplatform/_genai/_datasets_utils.py +344 -0
- agentplatform/_genai/_evals_builtin_tools.py +209 -0
- agentplatform/_genai/_evals_common.py +4268 -0
- agentplatform/_genai/_evals_constant.py +122 -0
- agentplatform/_genai/_evals_data_converters.py +926 -0
- agentplatform/_genai/_evals_metric_handlers.py +1783 -0
- agentplatform/_genai/_evals_metric_loaders.py +401 -0
- agentplatform/_genai/_evals_utils.py +1043 -0
- agentplatform/_genai/_evals_visualization.py +2070 -0
- agentplatform/_genai/_gcs_utils.py +262 -0
- agentplatform/_genai/_logging_utils.py +47 -0
- agentplatform/_genai/_memory_bank_utils.py +206 -0
- agentplatform/_genai/_observability_data_converter.py +186 -0
- agentplatform/_genai/_operations_utils.py +94 -0
- agentplatform/_genai/_prompt_management_utils.py +147 -0
- agentplatform/_genai/_prompt_optimizer_utils.py +215 -0
- agentplatform/_genai/_skills_utils.py +69 -0
- agentplatform/_genai/_transformers.py +628 -0
- agentplatform/_genai/a2a_task_events.py +509 -0
- agentplatform/_genai/a2a_tasks.py +861 -0
- agentplatform/_genai/agent_engines.py +3931 -0
- agentplatform/_genai/client.py +519 -0
- agentplatform/_genai/datasets.py +3045 -0
- agentplatform/_genai/endpoints.py +1149 -0
- agentplatform/_genai/evals.py +6883 -0
- agentplatform/_genai/example_stores.py +1445 -0
- agentplatform/_genai/feedback_contexts.py +700 -0
- agentplatform/_genai/feedback_entries.py +1644 -0
- agentplatform/_genai/live.py +64 -0
- agentplatform/_genai/live_agent_engines.py +179 -0
- agentplatform/_genai/memories.py +2962 -0
- agentplatform/_genai/memory_banks.py +1927 -0
- agentplatform/_genai/memory_revisions.py +465 -0
- agentplatform/_genai/model_garden.py +2638 -0
- agentplatform/_genai/prompt_optimizer.py +995 -0
- agentplatform/_genai/prompts.py +4515 -0
- agentplatform/_genai/rag.py +4961 -0
- agentplatform/_genai/runtime_revisions.py +1257 -0
- agentplatform/_genai/runtimes.py +78 -0
- agentplatform/_genai/sandbox_snapshots.py +1015 -0
- agentplatform/_genai/sandbox_templates.py +1088 -0
- agentplatform/_genai/sandboxes.py +1604 -0
- agentplatform/_genai/session_events.py +543 -0
- agentplatform/_genai/sessions.py +1449 -0
- agentplatform/_genai/skill_revisions.py +377 -0
- agentplatform/_genai/skills.py +1708 -0
- agentplatform/_genai/types/__init__.py +4695 -0
- agentplatform/_genai/types/agent_engines.py +16 -0
- agentplatform/_genai/types/common.py +32784 -0
- agentplatform/_genai/types/evals.py +1031 -0
- agentplatform/_genai/types/prompt_optimizer.py +107 -0
- agentplatform/_genai/types/prompts.py +107 -0
- agentplatform/version.py +17 -0
- google_cloud_agentplatform-1.165.1.dev0.dist-info/METADATA +79 -0
- google_cloud_agentplatform-1.165.1.dev0.dist-info/RECORD +62 -0
- google_cloud_agentplatform-1.165.1.dev0.dist-info/WHEEL +5 -0
- google_cloud_agentplatform-1.165.1.dev0.dist-info/licenses/LICENSE +202 -0
- google_cloud_agentplatform-1.165.1.dev0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,509 @@
|
|
|
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
|
+
|
|
16
|
+
# Code generated by the Google Gen AI SDK generator DO NOT EDIT.
|
|
17
|
+
|
|
18
|
+
import builtins
|
|
19
|
+
import functools
|
|
20
|
+
import json
|
|
21
|
+
import logging
|
|
22
|
+
from typing import Any, Iterator, Optional, Union
|
|
23
|
+
from urllib.parse import urlencode
|
|
24
|
+
|
|
25
|
+
from google.genai import _api_module
|
|
26
|
+
from google.genai import _common
|
|
27
|
+
from google.genai._common import get_value_by_path as getv
|
|
28
|
+
from google.genai._common import set_value_by_path as setv
|
|
29
|
+
from google.genai.pagers import AsyncPager, Pager
|
|
30
|
+
|
|
31
|
+
from . import types
|
|
32
|
+
|
|
33
|
+
logger = logging.getLogger("agentplatform_genai.a2ataskevents")
|
|
34
|
+
|
|
35
|
+
logger.setLevel(logging.INFO)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def _AppendAgentEngineTaskEventRequestParameters_to_vertex(
|
|
39
|
+
from_object: Union[dict[str, Any], object],
|
|
40
|
+
parent_object: Optional[dict[str, Any]] = None,
|
|
41
|
+
) -> dict[str, Any]:
|
|
42
|
+
to_object: dict[str, Any] = {}
|
|
43
|
+
if getv(from_object, ["name"]) is not None:
|
|
44
|
+
setv(to_object, ["_url", "name"], getv(from_object, ["name"]))
|
|
45
|
+
|
|
46
|
+
if getv(from_object, ["task_events"]) is not None:
|
|
47
|
+
setv(
|
|
48
|
+
to_object,
|
|
49
|
+
["taskEvents"],
|
|
50
|
+
[item for item in getv(from_object, ["task_events"])],
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
return to_object
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def _AppendAgentEngineTaskEventResponse_from_vertex(
|
|
57
|
+
from_object: Union[dict[str, Any], object],
|
|
58
|
+
parent_object: Optional[dict[str, Any]] = None,
|
|
59
|
+
) -> dict[str, Any]:
|
|
60
|
+
to_object: dict[str, Any] = {}
|
|
61
|
+
|
|
62
|
+
return to_object
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def _ListAgentEngineTaskEventsConfig_to_vertex(
|
|
66
|
+
from_object: Union[dict[str, Any], object],
|
|
67
|
+
parent_object: Optional[dict[str, Any]] = None,
|
|
68
|
+
) -> dict[str, Any]:
|
|
69
|
+
to_object: dict[str, Any] = {}
|
|
70
|
+
|
|
71
|
+
if getv(from_object, ["page_size"]) is not None:
|
|
72
|
+
setv(parent_object, ["_query", "pageSize"], getv(from_object, ["page_size"]))
|
|
73
|
+
|
|
74
|
+
if getv(from_object, ["page_token"]) is not None:
|
|
75
|
+
setv(parent_object, ["_query", "pageToken"], getv(from_object, ["page_token"]))
|
|
76
|
+
|
|
77
|
+
if getv(from_object, ["filter"]) is not None:
|
|
78
|
+
setv(parent_object, ["_query", "filter"], getv(from_object, ["filter"]))
|
|
79
|
+
|
|
80
|
+
if getv(from_object, ["order_by"]) is not None:
|
|
81
|
+
setv(parent_object, ["_query", "orderBy"], getv(from_object, ["order_by"]))
|
|
82
|
+
|
|
83
|
+
return to_object
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
def _ListAgentEngineTaskEventsRequestParameters_to_vertex(
|
|
87
|
+
from_object: Union[dict[str, Any], object],
|
|
88
|
+
parent_object: Optional[dict[str, Any]] = None,
|
|
89
|
+
) -> dict[str, Any]:
|
|
90
|
+
to_object: dict[str, Any] = {}
|
|
91
|
+
if getv(from_object, ["name"]) is not None:
|
|
92
|
+
setv(to_object, ["_url", "name"], getv(from_object, ["name"]))
|
|
93
|
+
|
|
94
|
+
if getv(from_object, ["config"]) is not None:
|
|
95
|
+
_ListAgentEngineTaskEventsConfig_to_vertex(
|
|
96
|
+
getv(from_object, ["config"]), to_object
|
|
97
|
+
)
|
|
98
|
+
|
|
99
|
+
return to_object
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
class A2aTaskEvents(_api_module.BaseModule):
|
|
103
|
+
|
|
104
|
+
def append(
|
|
105
|
+
self,
|
|
106
|
+
*,
|
|
107
|
+
name: str,
|
|
108
|
+
task_events: builtins.list[types.TaskEventOrDict],
|
|
109
|
+
config: Optional[types.AppendAgentEngineTaskEventConfigOrDict] = None,
|
|
110
|
+
) -> types.AppendAgentEngineTaskEventResponse:
|
|
111
|
+
"""
|
|
112
|
+
Adds events to an Agent Engine task.
|
|
113
|
+
|
|
114
|
+
Args:
|
|
115
|
+
name (str): Required. The name of the Agent Engine task to append the events to. Format:
|
|
116
|
+
`projects/{project}/locations/{location}/reasoningEngines/{resource_id}/a2aTasks/{a2a_task_id}`.
|
|
117
|
+
task_events (list[TaskEvent]):
|
|
118
|
+
Required. The events to append to the task.
|
|
119
|
+
|
|
120
|
+
Returns:
|
|
121
|
+
AppendAgentEngineTaskEventResponse: The response for appending the task events.
|
|
122
|
+
|
|
123
|
+
"""
|
|
124
|
+
|
|
125
|
+
parameter_model = types._AppendAgentEngineTaskEventRequestParameters(
|
|
126
|
+
name=name,
|
|
127
|
+
task_events=task_events,
|
|
128
|
+
config=config,
|
|
129
|
+
)
|
|
130
|
+
|
|
131
|
+
request_url_dict: Optional[dict[str, str]]
|
|
132
|
+
if not self._api_client.vertexai:
|
|
133
|
+
raise ValueError(
|
|
134
|
+
"This method is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode."
|
|
135
|
+
)
|
|
136
|
+
else:
|
|
137
|
+
request_dict = _AppendAgentEngineTaskEventRequestParameters_to_vertex(
|
|
138
|
+
parameter_model
|
|
139
|
+
)
|
|
140
|
+
request_url_dict = request_dict.get("_url")
|
|
141
|
+
if request_url_dict:
|
|
142
|
+
path = "{name}:appendEvents".format_map(request_url_dict)
|
|
143
|
+
else:
|
|
144
|
+
path = "{name}:appendEvents"
|
|
145
|
+
|
|
146
|
+
query_params = request_dict.get("_query")
|
|
147
|
+
if query_params:
|
|
148
|
+
path = f"{path}?{urlencode(query_params)}"
|
|
149
|
+
# TODO: remove the hack that pops config.
|
|
150
|
+
request_dict.pop("config", None)
|
|
151
|
+
|
|
152
|
+
http_options: Optional[types.HttpOptions] = None
|
|
153
|
+
if (
|
|
154
|
+
parameter_model.config is not None
|
|
155
|
+
and parameter_model.config.http_options is not None
|
|
156
|
+
):
|
|
157
|
+
http_options = parameter_model.config.http_options
|
|
158
|
+
|
|
159
|
+
request_dict = _common.convert_to_dict(request_dict)
|
|
160
|
+
request_dict = _common.encode_unserializable_types(request_dict)
|
|
161
|
+
|
|
162
|
+
response = self._api_client.request("post", path, request_dict, http_options)
|
|
163
|
+
|
|
164
|
+
response_dict = {} if not response.body else json.loads(response.body)
|
|
165
|
+
|
|
166
|
+
if self._api_client.vertexai:
|
|
167
|
+
response_dict = _AppendAgentEngineTaskEventResponse_from_vertex(
|
|
168
|
+
response_dict
|
|
169
|
+
)
|
|
170
|
+
|
|
171
|
+
return_value = types.AppendAgentEngineTaskEventResponse._from_response(
|
|
172
|
+
response=response_dict,
|
|
173
|
+
kwargs=(
|
|
174
|
+
{
|
|
175
|
+
"config": {
|
|
176
|
+
"response_schema": getattr(
|
|
177
|
+
parameter_model.config, "response_schema", None
|
|
178
|
+
),
|
|
179
|
+
"response_json_schema": getattr(
|
|
180
|
+
parameter_model.config, "response_json_schema", None
|
|
181
|
+
),
|
|
182
|
+
"include_all_fields": getattr(
|
|
183
|
+
parameter_model.config, "include_all_fields", None
|
|
184
|
+
),
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
if getattr(parameter_model, "config", None)
|
|
188
|
+
else {}
|
|
189
|
+
),
|
|
190
|
+
)
|
|
191
|
+
|
|
192
|
+
self._api_client._verify_response(return_value)
|
|
193
|
+
return return_value
|
|
194
|
+
|
|
195
|
+
def _list(
|
|
196
|
+
self,
|
|
197
|
+
*,
|
|
198
|
+
name: str,
|
|
199
|
+
config: Optional[types.ListAgentEngineTaskEventsConfigOrDict] = None,
|
|
200
|
+
) -> types.ListAgentEngineTaskEventsResponse:
|
|
201
|
+
"""
|
|
202
|
+
Lists Agent Engine task events.
|
|
203
|
+
|
|
204
|
+
Args:
|
|
205
|
+
name (str): Required. The name of the Agent Engine task to list events for. Format:
|
|
206
|
+
`projects/{project}/locations/{location}/reasoningEngines/{resource_id}/a2aTasks/{a2a_task_id}`.
|
|
207
|
+
config (ListAgentEngineTaskEventsConfig):
|
|
208
|
+
Optional. Additional configurations for listing the Agent Engine tasks.
|
|
209
|
+
|
|
210
|
+
Returns:
|
|
211
|
+
ListAgentEngineTaskEventsResponse: The requested Agent Engine tasks.
|
|
212
|
+
|
|
213
|
+
"""
|
|
214
|
+
|
|
215
|
+
parameter_model = types._ListAgentEngineTaskEventsRequestParameters(
|
|
216
|
+
name=name,
|
|
217
|
+
config=config,
|
|
218
|
+
)
|
|
219
|
+
|
|
220
|
+
request_url_dict: Optional[dict[str, str]]
|
|
221
|
+
if not self._api_client.vertexai:
|
|
222
|
+
raise ValueError(
|
|
223
|
+
"This method is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode."
|
|
224
|
+
)
|
|
225
|
+
else:
|
|
226
|
+
request_dict = _ListAgentEngineTaskEventsRequestParameters_to_vertex(
|
|
227
|
+
parameter_model
|
|
228
|
+
)
|
|
229
|
+
request_url_dict = request_dict.get("_url")
|
|
230
|
+
if request_url_dict:
|
|
231
|
+
path = "{name}/events".format_map(request_url_dict)
|
|
232
|
+
else:
|
|
233
|
+
path = "{name}/events"
|
|
234
|
+
|
|
235
|
+
query_params = request_dict.get("_query")
|
|
236
|
+
if query_params:
|
|
237
|
+
path = f"{path}?{urlencode(query_params)}"
|
|
238
|
+
# TODO: remove the hack that pops config.
|
|
239
|
+
request_dict.pop("config", None)
|
|
240
|
+
|
|
241
|
+
http_options: Optional[types.HttpOptions] = None
|
|
242
|
+
if (
|
|
243
|
+
parameter_model.config is not None
|
|
244
|
+
and parameter_model.config.http_options is not None
|
|
245
|
+
):
|
|
246
|
+
http_options = parameter_model.config.http_options
|
|
247
|
+
|
|
248
|
+
request_dict = _common.convert_to_dict(request_dict)
|
|
249
|
+
request_dict = _common.encode_unserializable_types(request_dict)
|
|
250
|
+
|
|
251
|
+
response = self._api_client.request("get", path, request_dict, http_options)
|
|
252
|
+
|
|
253
|
+
response_dict = {} if not response.body else json.loads(response.body)
|
|
254
|
+
|
|
255
|
+
return_value = types.ListAgentEngineTaskEventsResponse._from_response(
|
|
256
|
+
response=response_dict,
|
|
257
|
+
kwargs=(
|
|
258
|
+
{
|
|
259
|
+
"config": {
|
|
260
|
+
"response_schema": getattr(
|
|
261
|
+
parameter_model.config, "response_schema", None
|
|
262
|
+
),
|
|
263
|
+
"response_json_schema": getattr(
|
|
264
|
+
parameter_model.config, "response_json_schema", None
|
|
265
|
+
),
|
|
266
|
+
"include_all_fields": getattr(
|
|
267
|
+
parameter_model.config, "include_all_fields", None
|
|
268
|
+
),
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
if getattr(parameter_model, "config", None)
|
|
272
|
+
else {}
|
|
273
|
+
),
|
|
274
|
+
)
|
|
275
|
+
|
|
276
|
+
self._api_client._verify_response(return_value)
|
|
277
|
+
return return_value
|
|
278
|
+
|
|
279
|
+
def list(
|
|
280
|
+
self,
|
|
281
|
+
*,
|
|
282
|
+
name: str,
|
|
283
|
+
config: Optional[types.ListAgentEngineTaskEventsConfigOrDict] = None,
|
|
284
|
+
) -> Iterator[types.TaskEvent]:
|
|
285
|
+
"""Lists the A2A tasks of an Agent Engine.
|
|
286
|
+
|
|
287
|
+
Args:
|
|
288
|
+
name (str):
|
|
289
|
+
Required. The name of the agent engine to list tasks for.
|
|
290
|
+
config (List):
|
|
291
|
+
Optional. The configuration for the tasks to list.
|
|
292
|
+
|
|
293
|
+
Returns:
|
|
294
|
+
Iterable[TaskEvent]: An iterable of Task events.
|
|
295
|
+
"""
|
|
296
|
+
|
|
297
|
+
return Pager(
|
|
298
|
+
"taskEvents",
|
|
299
|
+
functools.partial(self._list, name=name),
|
|
300
|
+
self._list(name=name, config=config),
|
|
301
|
+
config,
|
|
302
|
+
)
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
class AsyncA2aTaskEvents(_api_module.BaseModule):
|
|
306
|
+
|
|
307
|
+
async def append(
|
|
308
|
+
self,
|
|
309
|
+
*,
|
|
310
|
+
name: str,
|
|
311
|
+
task_events: builtins.list[types.TaskEventOrDict],
|
|
312
|
+
config: Optional[types.AppendAgentEngineTaskEventConfigOrDict] = None,
|
|
313
|
+
) -> types.AppendAgentEngineTaskEventResponse:
|
|
314
|
+
"""
|
|
315
|
+
Adds events to an Agent Engine task.
|
|
316
|
+
|
|
317
|
+
Args:
|
|
318
|
+
name (str): Required. The name of the Agent Engine task to append the events to. Format:
|
|
319
|
+
`projects/{project}/locations/{location}/reasoningEngines/{resource_id}/a2aTasks/{a2a_task_id}`.
|
|
320
|
+
task_events (list[TaskEvent]):
|
|
321
|
+
Required. The events to append to the task.
|
|
322
|
+
|
|
323
|
+
Returns:
|
|
324
|
+
AppendAgentEngineTaskEventResponse: The response for appending the task events.
|
|
325
|
+
|
|
326
|
+
"""
|
|
327
|
+
|
|
328
|
+
parameter_model = types._AppendAgentEngineTaskEventRequestParameters(
|
|
329
|
+
name=name,
|
|
330
|
+
task_events=task_events,
|
|
331
|
+
config=config,
|
|
332
|
+
)
|
|
333
|
+
|
|
334
|
+
request_url_dict: Optional[dict[str, str]]
|
|
335
|
+
if not self._api_client.vertexai:
|
|
336
|
+
raise ValueError(
|
|
337
|
+
"This method is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode."
|
|
338
|
+
)
|
|
339
|
+
else:
|
|
340
|
+
request_dict = _AppendAgentEngineTaskEventRequestParameters_to_vertex(
|
|
341
|
+
parameter_model
|
|
342
|
+
)
|
|
343
|
+
request_url_dict = request_dict.get("_url")
|
|
344
|
+
if request_url_dict:
|
|
345
|
+
path = "{name}:appendEvents".format_map(request_url_dict)
|
|
346
|
+
else:
|
|
347
|
+
path = "{name}:appendEvents"
|
|
348
|
+
|
|
349
|
+
query_params = request_dict.get("_query")
|
|
350
|
+
if query_params:
|
|
351
|
+
path = f"{path}?{urlencode(query_params)}"
|
|
352
|
+
# TODO: remove the hack that pops config.
|
|
353
|
+
request_dict.pop("config", None)
|
|
354
|
+
|
|
355
|
+
http_options: Optional[types.HttpOptions] = None
|
|
356
|
+
if (
|
|
357
|
+
parameter_model.config is not None
|
|
358
|
+
and parameter_model.config.http_options is not None
|
|
359
|
+
):
|
|
360
|
+
http_options = parameter_model.config.http_options
|
|
361
|
+
|
|
362
|
+
request_dict = _common.convert_to_dict(request_dict)
|
|
363
|
+
request_dict = _common.encode_unserializable_types(request_dict)
|
|
364
|
+
|
|
365
|
+
response = await self._api_client.async_request(
|
|
366
|
+
"post", path, request_dict, http_options
|
|
367
|
+
)
|
|
368
|
+
|
|
369
|
+
response_dict = {} if not response.body else json.loads(response.body)
|
|
370
|
+
|
|
371
|
+
if self._api_client.vertexai:
|
|
372
|
+
response_dict = _AppendAgentEngineTaskEventResponse_from_vertex(
|
|
373
|
+
response_dict
|
|
374
|
+
)
|
|
375
|
+
|
|
376
|
+
return_value = types.AppendAgentEngineTaskEventResponse._from_response(
|
|
377
|
+
response=response_dict,
|
|
378
|
+
kwargs=(
|
|
379
|
+
{
|
|
380
|
+
"config": {
|
|
381
|
+
"response_schema": getattr(
|
|
382
|
+
parameter_model.config, "response_schema", None
|
|
383
|
+
),
|
|
384
|
+
"response_json_schema": getattr(
|
|
385
|
+
parameter_model.config, "response_json_schema", None
|
|
386
|
+
),
|
|
387
|
+
"include_all_fields": getattr(
|
|
388
|
+
parameter_model.config, "include_all_fields", None
|
|
389
|
+
),
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
if getattr(parameter_model, "config", None)
|
|
393
|
+
else {}
|
|
394
|
+
),
|
|
395
|
+
)
|
|
396
|
+
|
|
397
|
+
self._api_client._verify_response(return_value)
|
|
398
|
+
return return_value
|
|
399
|
+
|
|
400
|
+
async def _list(
|
|
401
|
+
self,
|
|
402
|
+
*,
|
|
403
|
+
name: str,
|
|
404
|
+
config: Optional[types.ListAgentEngineTaskEventsConfigOrDict] = None,
|
|
405
|
+
) -> types.ListAgentEngineTaskEventsResponse:
|
|
406
|
+
"""
|
|
407
|
+
Lists Agent Engine task events.
|
|
408
|
+
|
|
409
|
+
Args:
|
|
410
|
+
name (str): Required. The name of the Agent Engine task to list events for. Format:
|
|
411
|
+
`projects/{project}/locations/{location}/reasoningEngines/{resource_id}/a2aTasks/{a2a_task_id}`.
|
|
412
|
+
config (ListAgentEngineTaskEventsConfig):
|
|
413
|
+
Optional. Additional configurations for listing the Agent Engine tasks.
|
|
414
|
+
|
|
415
|
+
Returns:
|
|
416
|
+
ListAgentEngineTaskEventsResponse: The requested Agent Engine tasks.
|
|
417
|
+
|
|
418
|
+
"""
|
|
419
|
+
|
|
420
|
+
parameter_model = types._ListAgentEngineTaskEventsRequestParameters(
|
|
421
|
+
name=name,
|
|
422
|
+
config=config,
|
|
423
|
+
)
|
|
424
|
+
|
|
425
|
+
request_url_dict: Optional[dict[str, str]]
|
|
426
|
+
if not self._api_client.vertexai:
|
|
427
|
+
raise ValueError(
|
|
428
|
+
"This method is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode."
|
|
429
|
+
)
|
|
430
|
+
else:
|
|
431
|
+
request_dict = _ListAgentEngineTaskEventsRequestParameters_to_vertex(
|
|
432
|
+
parameter_model
|
|
433
|
+
)
|
|
434
|
+
request_url_dict = request_dict.get("_url")
|
|
435
|
+
if request_url_dict:
|
|
436
|
+
path = "{name}/events".format_map(request_url_dict)
|
|
437
|
+
else:
|
|
438
|
+
path = "{name}/events"
|
|
439
|
+
|
|
440
|
+
query_params = request_dict.get("_query")
|
|
441
|
+
if query_params:
|
|
442
|
+
path = f"{path}?{urlencode(query_params)}"
|
|
443
|
+
# TODO: remove the hack that pops config.
|
|
444
|
+
request_dict.pop("config", None)
|
|
445
|
+
|
|
446
|
+
http_options: Optional[types.HttpOptions] = None
|
|
447
|
+
if (
|
|
448
|
+
parameter_model.config is not None
|
|
449
|
+
and parameter_model.config.http_options is not None
|
|
450
|
+
):
|
|
451
|
+
http_options = parameter_model.config.http_options
|
|
452
|
+
|
|
453
|
+
request_dict = _common.convert_to_dict(request_dict)
|
|
454
|
+
request_dict = _common.encode_unserializable_types(request_dict)
|
|
455
|
+
|
|
456
|
+
response = await self._api_client.async_request(
|
|
457
|
+
"get", path, request_dict, http_options
|
|
458
|
+
)
|
|
459
|
+
|
|
460
|
+
response_dict = {} if not response.body else json.loads(response.body)
|
|
461
|
+
|
|
462
|
+
return_value = types.ListAgentEngineTaskEventsResponse._from_response(
|
|
463
|
+
response=response_dict,
|
|
464
|
+
kwargs=(
|
|
465
|
+
{
|
|
466
|
+
"config": {
|
|
467
|
+
"response_schema": getattr(
|
|
468
|
+
parameter_model.config, "response_schema", None
|
|
469
|
+
),
|
|
470
|
+
"response_json_schema": getattr(
|
|
471
|
+
parameter_model.config, "response_json_schema", None
|
|
472
|
+
),
|
|
473
|
+
"include_all_fields": getattr(
|
|
474
|
+
parameter_model.config, "include_all_fields", None
|
|
475
|
+
),
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
if getattr(parameter_model, "config", None)
|
|
479
|
+
else {}
|
|
480
|
+
),
|
|
481
|
+
)
|
|
482
|
+
|
|
483
|
+
self._api_client._verify_response(return_value)
|
|
484
|
+
return return_value
|
|
485
|
+
|
|
486
|
+
async def list(
|
|
487
|
+
self,
|
|
488
|
+
*,
|
|
489
|
+
name: str,
|
|
490
|
+
config: Optional[types.ListAgentEngineTaskEventsConfigOrDict] = None,
|
|
491
|
+
) -> AsyncPager[types.TaskEvent]:
|
|
492
|
+
"""Lists the A2A tasks of an Agent Engine.
|
|
493
|
+
|
|
494
|
+
Args:
|
|
495
|
+
name (str):
|
|
496
|
+
Required. The name of the agent engine to list tasks for.
|
|
497
|
+
config (List):
|
|
498
|
+
Optional. The configuration for the tasks to list.
|
|
499
|
+
|
|
500
|
+
Returns:
|
|
501
|
+
AsyncPager[TaskEvent]: An async pager of Task events.
|
|
502
|
+
"""
|
|
503
|
+
|
|
504
|
+
return AsyncPager(
|
|
505
|
+
"taskEvents",
|
|
506
|
+
functools.partial(self._list, name=name),
|
|
507
|
+
await self._list(name=name, config=config),
|
|
508
|
+
config,
|
|
509
|
+
)
|