agenta 0.27.6a3__py3-none-any.whl → 0.27.7__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 agenta might be problematic. Click here for more details.

Files changed (61) hide show
  1. agenta/cli/main.py +4 -51
  2. agenta/client/backend/__init__.py +63 -0
  3. agenta/client/backend/apps/client.py +12 -58
  4. agenta/client/backend/client.py +22 -22
  5. agenta/client/backend/core/http_client.py +15 -7
  6. agenta/client/backend/evaluations/client.py +0 -11
  7. agenta/client/backend/observability/client.py +4 -4
  8. agenta/client/backend/observability_v_1/__init__.py +5 -0
  9. agenta/client/backend/observability_v_1/client.py +560 -0
  10. agenta/client/backend/observability_v_1/types/__init__.py +6 -0
  11. agenta/client/backend/observability_v_1/types/format.py +5 -0
  12. agenta/client/backend/observability_v_1/types/query_traces_response.py +11 -0
  13. agenta/client/backend/testsets/client.py +8 -40
  14. agenta/client/backend/types/__init__.py +58 -0
  15. agenta/client/backend/types/agenta_node_dto.py +48 -0
  16. agenta/client/backend/types/agenta_node_dto_nodes_value.py +6 -0
  17. agenta/client/backend/types/agenta_nodes_response.py +30 -0
  18. agenta/client/backend/types/agenta_root_dto.py +30 -0
  19. agenta/client/backend/types/agenta_roots_response.py +30 -0
  20. agenta/client/backend/types/agenta_tree_dto.py +30 -0
  21. agenta/client/backend/types/agenta_trees_response.py +30 -0
  22. agenta/client/backend/types/collect_status_response.py +22 -0
  23. agenta/client/backend/types/exception_dto.py +26 -0
  24. agenta/client/backend/types/link_dto.py +24 -0
  25. agenta/client/backend/types/node_dto.py +24 -0
  26. agenta/client/backend/types/node_type.py +19 -0
  27. agenta/client/backend/types/o_tel_context_dto.py +22 -0
  28. agenta/client/backend/types/o_tel_event_dto.py +23 -0
  29. agenta/client/backend/types/o_tel_extra_dto.py +26 -0
  30. agenta/client/backend/types/o_tel_link_dto.py +23 -0
  31. agenta/client/backend/types/o_tel_span_dto.py +37 -0
  32. agenta/client/backend/types/o_tel_span_kind.py +15 -0
  33. agenta/client/backend/types/o_tel_spans_response.py +24 -0
  34. agenta/client/backend/types/o_tel_status_code.py +8 -0
  35. agenta/client/backend/types/parent_dto.py +21 -0
  36. agenta/client/backend/types/root_dto.py +21 -0
  37. agenta/client/backend/types/span_dto.py +54 -0
  38. agenta/client/backend/types/span_dto_nodes_value.py +9 -0
  39. agenta/client/backend/types/status_code.py +5 -0
  40. agenta/client/backend/types/status_dto.py +23 -0
  41. agenta/client/backend/types/time_dto.py +23 -0
  42. agenta/client/backend/types/tree_dto.py +23 -0
  43. agenta/client/backend/types/tree_type.py +5 -0
  44. agenta/client/backend/variants/client.py +24 -16
  45. agenta/sdk/__init__.py +2 -0
  46. agenta/sdk/agenta_init.py +4 -9
  47. agenta/sdk/decorators/routing.py +34 -53
  48. agenta/sdk/litellm/litellm.py +30 -75
  49. agenta/sdk/middleware/auth.py +10 -7
  50. agenta/sdk/tracing/context.py +6 -6
  51. agenta/sdk/tracing/inline.py +48 -151
  52. agenta/sdk/tracing/processors.py +1 -3
  53. agenta/sdk/tracing/tracing.py +1 -5
  54. agenta/sdk/types.py +5 -2
  55. agenta/sdk/utils/exceptions.py +15 -9
  56. agenta/sdk/utils/logging.py +5 -1
  57. {agenta-0.27.6a3.dist-info → agenta-0.27.7.dist-info}/METADATA +1 -1
  58. {agenta-0.27.6a3.dist-info → agenta-0.27.7.dist-info}/RECORD +60 -27
  59. agenta/sdk/utils/debug.py +0 -68
  60. {agenta-0.27.6a3.dist-info → agenta-0.27.7.dist-info}/WHEEL +0 -0
  61. {agenta-0.27.6a3.dist-info → agenta-0.27.7.dist-info}/entry_points.txt +0 -0
@@ -26,7 +26,6 @@ class EvaluationsClient:
26
26
  def fetch_evaluation_ids(
27
27
  self,
28
28
  *,
29
- app_id: str,
30
29
  resource_type: str,
31
30
  resource_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
32
31
  request_options: typing.Optional[RequestOptions] = None,
@@ -35,7 +34,6 @@ class EvaluationsClient:
35
34
  Fetches evaluation ids for a given resource type and id.
36
35
 
37
36
  Arguments:
38
- app_id (str): The ID of the app for which to fetch evaluations.
39
37
  resource_type (str): The type of resource for which to fetch evaluations.
40
38
  resource_ids List[ObjectId]: The IDs of resource for which to fetch evaluations.
41
39
 
@@ -47,8 +45,6 @@ class EvaluationsClient:
47
45
 
48
46
  Parameters
49
47
  ----------
50
- app_id : str
51
-
52
48
  resource_type : str
53
49
 
54
50
  resource_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
@@ -70,7 +66,6 @@ class EvaluationsClient:
70
66
  base_url="https://yourhost.com/path/to/api",
71
67
  )
72
68
  client.evaluations.fetch_evaluation_ids(
73
- app_id="app_id",
74
69
  resource_type="resource_type",
75
70
  )
76
71
  """
@@ -78,7 +73,6 @@ class EvaluationsClient:
78
73
  "evaluations/by_resource",
79
74
  method="GET",
80
75
  params={
81
- "app_id": app_id,
82
76
  "resource_type": resource_type,
83
77
  "resource_ids": resource_ids,
84
78
  },
@@ -714,7 +708,6 @@ class AsyncEvaluationsClient:
714
708
  async def fetch_evaluation_ids(
715
709
  self,
716
710
  *,
717
- app_id: str,
718
711
  resource_type: str,
719
712
  resource_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
720
713
  request_options: typing.Optional[RequestOptions] = None,
@@ -723,7 +716,6 @@ class AsyncEvaluationsClient:
723
716
  Fetches evaluation ids for a given resource type and id.
724
717
 
725
718
  Arguments:
726
- app_id (str): The ID of the app for which to fetch evaluations.
727
719
  resource_type (str): The type of resource for which to fetch evaluations.
728
720
  resource_ids List[ObjectId]: The IDs of resource for which to fetch evaluations.
729
721
 
@@ -735,7 +727,6 @@ class AsyncEvaluationsClient:
735
727
 
736
728
  Parameters
737
729
  ----------
738
- app_id : str
739
730
 
740
731
  resource_type : str
741
732
 
@@ -763,7 +754,6 @@ class AsyncEvaluationsClient:
763
754
 
764
755
  async def main() -> None:
765
756
  await client.evaluations.fetch_evaluation_ids(
766
- app_id="app_id",
767
757
  resource_type="resource_type",
768
758
  )
769
759
 
@@ -774,7 +764,6 @@ class AsyncEvaluationsClient:
774
764
  "evaluations/by_resource",
775
765
  method="GET",
776
766
  params={
777
- "app_id": app_id,
778
767
  "resource_type": resource_type,
779
768
  "resource_ids": resource_ids,
780
769
  },
@@ -280,7 +280,7 @@ class ObservabilityClient:
280
280
  raise ApiError(status_code=_response.status_code, body=_response.text)
281
281
  raise ApiError(status_code=_response.status_code, body=_response_json)
282
282
 
283
- def delete_traces(
283
+ def delete_traces_legacy(
284
284
  self,
285
285
  *,
286
286
  request: typing.Sequence[str],
@@ -307,7 +307,7 @@ class ObservabilityClient:
307
307
  api_key="YOUR_API_KEY",
308
308
  base_url="https://yourhost.com/path/to/api",
309
309
  )
310
- client.observability.delete_traces(
310
+ client.observability.delete_traces_legacy(
311
311
  request=["string"],
312
312
  )
313
313
  """
@@ -901,7 +901,7 @@ class AsyncObservabilityClient:
901
901
  raise ApiError(status_code=_response.status_code, body=_response.text)
902
902
  raise ApiError(status_code=_response.status_code, body=_response_json)
903
903
 
904
- async def delete_traces(
904
+ async def delete_traces_legacy(
905
905
  self,
906
906
  *,
907
907
  request: typing.Sequence[str],
@@ -933,7 +933,7 @@ class AsyncObservabilityClient:
933
933
 
934
934
 
935
935
  async def main() -> None:
936
- await client.observability.delete_traces(
936
+ await client.observability.delete_traces_legacy(
937
937
  request=["string"],
938
938
  )
939
939
 
@@ -0,0 +1,5 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from .types import Format, QueryTracesResponse
4
+
5
+ __all__ = ["Format", "QueryTracesResponse"]
@@ -0,0 +1,560 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from ..core.client_wrapper import SyncClientWrapper
4
+ import typing
5
+ from ..core.request_options import RequestOptions
6
+ from ..types.collect_status_response import CollectStatusResponse
7
+ from ..core.pydantic_utilities import parse_obj_as
8
+ from json.decoder import JSONDecodeError
9
+ from ..core.api_error import ApiError
10
+ from .types.format import Format
11
+ from .types.query_traces_response import QueryTracesResponse
12
+ from ..errors.unprocessable_entity_error import UnprocessableEntityError
13
+ from ..types.http_validation_error import HttpValidationError
14
+ from ..core.client_wrapper import AsyncClientWrapper
15
+
16
+
17
+ class ObservabilityV1Client:
18
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
19
+ self._client_wrapper = client_wrapper
20
+
21
+ def otlp_status(
22
+ self, *, request_options: typing.Optional[RequestOptions] = None
23
+ ) -> CollectStatusResponse:
24
+ """
25
+ Status of OTLP endpoint.
26
+
27
+ Parameters
28
+ ----------
29
+ request_options : typing.Optional[RequestOptions]
30
+ Request-specific configuration.
31
+
32
+ Returns
33
+ -------
34
+ CollectStatusResponse
35
+ Successful Response
36
+
37
+ Examples
38
+ --------
39
+ from agenta import AgentaApi
40
+
41
+ client = AgentaApi(
42
+ api_key="YOUR_API_KEY",
43
+ base_url="https://yourhost.com/path/to/api",
44
+ )
45
+ client.observability_v_1.otlp_status()
46
+ """
47
+ _response = self._client_wrapper.httpx_client.request(
48
+ "observability/v1/otlp/traces",
49
+ method="GET",
50
+ request_options=request_options,
51
+ )
52
+ try:
53
+ if 200 <= _response.status_code < 300:
54
+ return typing.cast(
55
+ CollectStatusResponse,
56
+ parse_obj_as(
57
+ type_=CollectStatusResponse, # type: ignore
58
+ object_=_response.json(),
59
+ ),
60
+ )
61
+ _response_json = _response.json()
62
+ except JSONDecodeError:
63
+ raise ApiError(status_code=_response.status_code, body=_response.text)
64
+ raise ApiError(status_code=_response.status_code, body=_response_json)
65
+
66
+ def otlp_receiver(
67
+ self, *, request_options: typing.Optional[RequestOptions] = None
68
+ ) -> CollectStatusResponse:
69
+ """
70
+ Receive traces via OTLP.
71
+
72
+ Parameters
73
+ ----------
74
+ request_options : typing.Optional[RequestOptions]
75
+ Request-specific configuration.
76
+
77
+ Returns
78
+ -------
79
+ CollectStatusResponse
80
+ Successful Response
81
+
82
+ Examples
83
+ --------
84
+ from agenta import AgentaApi
85
+
86
+ client = AgentaApi(
87
+ api_key="YOUR_API_KEY",
88
+ base_url="https://yourhost.com/path/to/api",
89
+ )
90
+ client.observability_v_1.otlp_receiver()
91
+ """
92
+ _response = self._client_wrapper.httpx_client.request(
93
+ "observability/v1/otlp/traces",
94
+ method="POST",
95
+ request_options=request_options,
96
+ )
97
+ try:
98
+ if 200 <= _response.status_code < 300:
99
+ return typing.cast(
100
+ CollectStatusResponse,
101
+ parse_obj_as(
102
+ type_=CollectStatusResponse, # type: ignore
103
+ object_=_response.json(),
104
+ ),
105
+ )
106
+ _response_json = _response.json()
107
+ except JSONDecodeError:
108
+ raise ApiError(status_code=_response.status_code, body=_response.text)
109
+ raise ApiError(status_code=_response.status_code, body=_response_json)
110
+
111
+ def query_traces(
112
+ self,
113
+ *,
114
+ format: typing.Optional[Format] = None,
115
+ focus: typing.Optional[str] = None,
116
+ oldest: typing.Optional[str] = None,
117
+ newest: typing.Optional[str] = None,
118
+ filtering: typing.Optional[str] = None,
119
+ page: typing.Optional[int] = None,
120
+ size: typing.Optional[int] = None,
121
+ next: typing.Optional[str] = None,
122
+ stop: typing.Optional[str] = None,
123
+ request_options: typing.Optional[RequestOptions] = None,
124
+ ) -> QueryTracesResponse:
125
+ """
126
+ Query traces, with optional grouping, windowing, filtering, and pagination.
127
+
128
+ Parameters
129
+ ----------
130
+ format : typing.Optional[Format]
131
+
132
+ focus : typing.Optional[str]
133
+
134
+ oldest : typing.Optional[str]
135
+
136
+ newest : typing.Optional[str]
137
+
138
+ filtering : typing.Optional[str]
139
+
140
+ page : typing.Optional[int]
141
+
142
+ size : typing.Optional[int]
143
+
144
+ next : typing.Optional[str]
145
+
146
+ stop : typing.Optional[str]
147
+
148
+ request_options : typing.Optional[RequestOptions]
149
+ Request-specific configuration.
150
+
151
+ Returns
152
+ -------
153
+ QueryTracesResponse
154
+ Successful Response
155
+
156
+ Examples
157
+ --------
158
+ from agenta import AgentaApi
159
+
160
+ client = AgentaApi(
161
+ api_key="YOUR_API_KEY",
162
+ base_url="https://yourhost.com/path/to/api",
163
+ )
164
+ client.observability_v_1.query_traces()
165
+ """
166
+ _response = self._client_wrapper.httpx_client.request(
167
+ "observability/v1/traces",
168
+ method="GET",
169
+ params={
170
+ "format": format,
171
+ "focus": focus,
172
+ "oldest": oldest,
173
+ "newest": newest,
174
+ "filtering": filtering,
175
+ "page": page,
176
+ "size": size,
177
+ "next": next,
178
+ "stop": stop,
179
+ },
180
+ request_options=request_options,
181
+ )
182
+ try:
183
+ if 200 <= _response.status_code < 300:
184
+ return typing.cast(
185
+ QueryTracesResponse,
186
+ parse_obj_as(
187
+ type_=QueryTracesResponse, # type: ignore
188
+ object_=_response.json(),
189
+ ),
190
+ )
191
+ if _response.status_code == 422:
192
+ raise UnprocessableEntityError(
193
+ typing.cast(
194
+ HttpValidationError,
195
+ parse_obj_as(
196
+ type_=HttpValidationError, # type: ignore
197
+ object_=_response.json(),
198
+ ),
199
+ )
200
+ )
201
+ _response_json = _response.json()
202
+ except JSONDecodeError:
203
+ raise ApiError(status_code=_response.status_code, body=_response.text)
204
+ raise ApiError(status_code=_response.status_code, body=_response_json)
205
+
206
+ def delete_traces(
207
+ self,
208
+ *,
209
+ node_id: typing.Optional[str] = None,
210
+ node_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
211
+ request_options: typing.Optional[RequestOptions] = None,
212
+ ) -> CollectStatusResponse:
213
+ """
214
+ Delete trace.
215
+
216
+ Parameters
217
+ ----------
218
+ node_id : typing.Optional[str]
219
+
220
+ node_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
221
+
222
+ request_options : typing.Optional[RequestOptions]
223
+ Request-specific configuration.
224
+
225
+ Returns
226
+ -------
227
+ CollectStatusResponse
228
+ Successful Response
229
+
230
+ Examples
231
+ --------
232
+ from agenta import AgentaApi
233
+
234
+ client = AgentaApi(
235
+ api_key="YOUR_API_KEY",
236
+ base_url="https://yourhost.com/path/to/api",
237
+ )
238
+ client.observability_v_1.delete_traces()
239
+ """
240
+ _response = self._client_wrapper.httpx_client.request(
241
+ "observability/v1/traces",
242
+ method="DELETE",
243
+ params={
244
+ "node_id": node_id,
245
+ "node_ids": node_ids,
246
+ },
247
+ request_options=request_options,
248
+ )
249
+ try:
250
+ if 200 <= _response.status_code < 300:
251
+ return typing.cast(
252
+ CollectStatusResponse,
253
+ parse_obj_as(
254
+ type_=CollectStatusResponse, # type: ignore
255
+ object_=_response.json(),
256
+ ),
257
+ )
258
+ if _response.status_code == 422:
259
+ raise UnprocessableEntityError(
260
+ typing.cast(
261
+ HttpValidationError,
262
+ parse_obj_as(
263
+ type_=HttpValidationError, # type: ignore
264
+ object_=_response.json(),
265
+ ),
266
+ )
267
+ )
268
+ _response_json = _response.json()
269
+ except JSONDecodeError:
270
+ raise ApiError(status_code=_response.status_code, body=_response.text)
271
+ raise ApiError(status_code=_response.status_code, body=_response_json)
272
+
273
+
274
+ class AsyncObservabilityV1Client:
275
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
276
+ self._client_wrapper = client_wrapper
277
+
278
+ async def otlp_status(
279
+ self, *, request_options: typing.Optional[RequestOptions] = None
280
+ ) -> CollectStatusResponse:
281
+ """
282
+ Status of OTLP endpoint.
283
+
284
+ Parameters
285
+ ----------
286
+ request_options : typing.Optional[RequestOptions]
287
+ Request-specific configuration.
288
+
289
+ Returns
290
+ -------
291
+ CollectStatusResponse
292
+ Successful Response
293
+
294
+ Examples
295
+ --------
296
+ import asyncio
297
+
298
+ from agenta import AsyncAgentaApi
299
+
300
+ client = AsyncAgentaApi(
301
+ api_key="YOUR_API_KEY",
302
+ base_url="https://yourhost.com/path/to/api",
303
+ )
304
+
305
+
306
+ async def main() -> None:
307
+ await client.observability_v_1.otlp_status()
308
+
309
+
310
+ asyncio.run(main())
311
+ """
312
+ _response = await self._client_wrapper.httpx_client.request(
313
+ "observability/v1/otlp/traces",
314
+ method="GET",
315
+ request_options=request_options,
316
+ )
317
+ try:
318
+ if 200 <= _response.status_code < 300:
319
+ return typing.cast(
320
+ CollectStatusResponse,
321
+ parse_obj_as(
322
+ type_=CollectStatusResponse, # type: ignore
323
+ object_=_response.json(),
324
+ ),
325
+ )
326
+ _response_json = _response.json()
327
+ except JSONDecodeError:
328
+ raise ApiError(status_code=_response.status_code, body=_response.text)
329
+ raise ApiError(status_code=_response.status_code, body=_response_json)
330
+
331
+ async def otlp_receiver(
332
+ self, *, request_options: typing.Optional[RequestOptions] = None
333
+ ) -> CollectStatusResponse:
334
+ """
335
+ Receive traces via OTLP.
336
+
337
+ Parameters
338
+ ----------
339
+ request_options : typing.Optional[RequestOptions]
340
+ Request-specific configuration.
341
+
342
+ Returns
343
+ -------
344
+ CollectStatusResponse
345
+ Successful Response
346
+
347
+ Examples
348
+ --------
349
+ import asyncio
350
+
351
+ from agenta import AsyncAgentaApi
352
+
353
+ client = AsyncAgentaApi(
354
+ api_key="YOUR_API_KEY",
355
+ base_url="https://yourhost.com/path/to/api",
356
+ )
357
+
358
+
359
+ async def main() -> None:
360
+ await client.observability_v_1.otlp_receiver()
361
+
362
+
363
+ asyncio.run(main())
364
+ """
365
+ _response = await self._client_wrapper.httpx_client.request(
366
+ "observability/v1/otlp/traces",
367
+ method="POST",
368
+ request_options=request_options,
369
+ )
370
+ try:
371
+ if 200 <= _response.status_code < 300:
372
+ return typing.cast(
373
+ CollectStatusResponse,
374
+ parse_obj_as(
375
+ type_=CollectStatusResponse, # type: ignore
376
+ object_=_response.json(),
377
+ ),
378
+ )
379
+ _response_json = _response.json()
380
+ except JSONDecodeError:
381
+ raise ApiError(status_code=_response.status_code, body=_response.text)
382
+ raise ApiError(status_code=_response.status_code, body=_response_json)
383
+
384
+ async def query_traces(
385
+ self,
386
+ *,
387
+ format: typing.Optional[Format] = None,
388
+ focus: typing.Optional[str] = None,
389
+ oldest: typing.Optional[str] = None,
390
+ newest: typing.Optional[str] = None,
391
+ filtering: typing.Optional[str] = None,
392
+ page: typing.Optional[int] = None,
393
+ size: typing.Optional[int] = None,
394
+ next: typing.Optional[str] = None,
395
+ stop: typing.Optional[str] = None,
396
+ request_options: typing.Optional[RequestOptions] = None,
397
+ ) -> QueryTracesResponse:
398
+ """
399
+ Query traces, with optional grouping, windowing, filtering, and pagination.
400
+
401
+ Parameters
402
+ ----------
403
+ format : typing.Optional[Format]
404
+
405
+ focus : typing.Optional[str]
406
+
407
+ oldest : typing.Optional[str]
408
+
409
+ newest : typing.Optional[str]
410
+
411
+ filtering : typing.Optional[str]
412
+
413
+ page : typing.Optional[int]
414
+
415
+ size : typing.Optional[int]
416
+
417
+ next : typing.Optional[str]
418
+
419
+ stop : typing.Optional[str]
420
+
421
+ request_options : typing.Optional[RequestOptions]
422
+ Request-specific configuration.
423
+
424
+ Returns
425
+ -------
426
+ QueryTracesResponse
427
+ Successful Response
428
+
429
+ Examples
430
+ --------
431
+ import asyncio
432
+
433
+ from agenta import AsyncAgentaApi
434
+
435
+ client = AsyncAgentaApi(
436
+ api_key="YOUR_API_KEY",
437
+ base_url="https://yourhost.com/path/to/api",
438
+ )
439
+
440
+
441
+ async def main() -> None:
442
+ await client.observability_v_1.query_traces()
443
+
444
+
445
+ asyncio.run(main())
446
+ """
447
+ _response = await self._client_wrapper.httpx_client.request(
448
+ "observability/v1/traces",
449
+ method="GET",
450
+ params={
451
+ "format": format,
452
+ "focus": focus,
453
+ "oldest": oldest,
454
+ "newest": newest,
455
+ "filtering": filtering,
456
+ "page": page,
457
+ "size": size,
458
+ "next": next,
459
+ "stop": stop,
460
+ },
461
+ request_options=request_options,
462
+ )
463
+ try:
464
+ if 200 <= _response.status_code < 300:
465
+ return typing.cast(
466
+ QueryTracesResponse,
467
+ parse_obj_as(
468
+ type_=QueryTracesResponse, # type: ignore
469
+ object_=_response.json(),
470
+ ),
471
+ )
472
+ if _response.status_code == 422:
473
+ raise UnprocessableEntityError(
474
+ typing.cast(
475
+ HttpValidationError,
476
+ parse_obj_as(
477
+ type_=HttpValidationError, # type: ignore
478
+ object_=_response.json(),
479
+ ),
480
+ )
481
+ )
482
+ _response_json = _response.json()
483
+ except JSONDecodeError:
484
+ raise ApiError(status_code=_response.status_code, body=_response.text)
485
+ raise ApiError(status_code=_response.status_code, body=_response_json)
486
+
487
+ async def delete_traces(
488
+ self,
489
+ *,
490
+ node_id: typing.Optional[str] = None,
491
+ node_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
492
+ request_options: typing.Optional[RequestOptions] = None,
493
+ ) -> CollectStatusResponse:
494
+ """
495
+ Delete trace.
496
+
497
+ Parameters
498
+ ----------
499
+ node_id : typing.Optional[str]
500
+
501
+ node_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
502
+
503
+ request_options : typing.Optional[RequestOptions]
504
+ Request-specific configuration.
505
+
506
+ Returns
507
+ -------
508
+ CollectStatusResponse
509
+ Successful Response
510
+
511
+ Examples
512
+ --------
513
+ import asyncio
514
+
515
+ from agenta import AsyncAgentaApi
516
+
517
+ client = AsyncAgentaApi(
518
+ api_key="YOUR_API_KEY",
519
+ base_url="https://yourhost.com/path/to/api",
520
+ )
521
+
522
+
523
+ async def main() -> None:
524
+ await client.observability_v_1.delete_traces()
525
+
526
+
527
+ asyncio.run(main())
528
+ """
529
+ _response = await self._client_wrapper.httpx_client.request(
530
+ "observability/v1/traces",
531
+ method="DELETE",
532
+ params={
533
+ "node_id": node_id,
534
+ "node_ids": node_ids,
535
+ },
536
+ request_options=request_options,
537
+ )
538
+ try:
539
+ if 200 <= _response.status_code < 300:
540
+ return typing.cast(
541
+ CollectStatusResponse,
542
+ parse_obj_as(
543
+ type_=CollectStatusResponse, # type: ignore
544
+ object_=_response.json(),
545
+ ),
546
+ )
547
+ if _response.status_code == 422:
548
+ raise UnprocessableEntityError(
549
+ typing.cast(
550
+ HttpValidationError,
551
+ parse_obj_as(
552
+ type_=HttpValidationError, # type: ignore
553
+ object_=_response.json(),
554
+ ),
555
+ )
556
+ )
557
+ _response_json = _response.json()
558
+ except JSONDecodeError:
559
+ raise ApiError(status_code=_response.status_code, body=_response.text)
560
+ raise ApiError(status_code=_response.status_code, body=_response_json)
@@ -0,0 +1,6 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from .format import Format
4
+ from .query_traces_response import QueryTracesResponse
5
+
6
+ __all__ = ["Format", "QueryTracesResponse"]
@@ -0,0 +1,5 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ Format = typing.Union[typing.Literal["opentelemetry", "agenta"], typing.Any]
@@ -0,0 +1,11 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+ from ...types.o_tel_spans_response import OTelSpansResponse
5
+ from ...types.agenta_nodes_response import AgentaNodesResponse
6
+ from ...types.agenta_trees_response import AgentaTreesResponse
7
+ from ...types.agenta_roots_response import AgentaRootsResponse
8
+
9
+ QueryTracesResponse = typing.Union[
10
+ OTelSpansResponse, AgentaNodesResponse, AgentaTreesResponse, AgentaRootsResponse
11
+ ]