agenta 0.27.7a1__py3-none-any.whl → 0.27.7a2__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 (48) hide show
  1. agenta/client/backend/__init__.py +63 -0
  2. agenta/client/backend/client.py +22 -22
  3. agenta/client/backend/core/http_client.py +15 -7
  4. agenta/client/backend/observability/client.py +4 -4
  5. agenta/client/backend/observability_v_1/__init__.py +5 -0
  6. agenta/client/backend/observability_v_1/client.py +560 -0
  7. agenta/client/backend/observability_v_1/types/__init__.py +6 -0
  8. agenta/client/backend/observability_v_1/types/format.py +5 -0
  9. agenta/client/backend/observability_v_1/types/query_traces_response.py +11 -0
  10. agenta/client/backend/types/__init__.py +58 -0
  11. agenta/client/backend/types/agenta_node_dto.py +48 -0
  12. agenta/client/backend/types/agenta_node_dto_nodes_value.py +6 -0
  13. agenta/client/backend/types/agenta_nodes_response.py +30 -0
  14. agenta/client/backend/types/agenta_root_dto.py +30 -0
  15. agenta/client/backend/types/agenta_roots_response.py +30 -0
  16. agenta/client/backend/types/agenta_tree_dto.py +30 -0
  17. agenta/client/backend/types/agenta_trees_response.py +30 -0
  18. agenta/client/backend/types/collect_status_response.py +22 -0
  19. agenta/client/backend/types/exception_dto.py +26 -0
  20. agenta/client/backend/types/link_dto.py +24 -0
  21. agenta/client/backend/types/node_dto.py +24 -0
  22. agenta/client/backend/types/node_type.py +19 -0
  23. agenta/client/backend/types/o_tel_context_dto.py +22 -0
  24. agenta/client/backend/types/o_tel_event_dto.py +23 -0
  25. agenta/client/backend/types/o_tel_extra_dto.py +26 -0
  26. agenta/client/backend/types/o_tel_link_dto.py +23 -0
  27. agenta/client/backend/types/o_tel_span_dto.py +37 -0
  28. agenta/client/backend/types/o_tel_span_kind.py +15 -0
  29. agenta/client/backend/types/o_tel_spans_response.py +24 -0
  30. agenta/client/backend/types/o_tel_status_code.py +8 -0
  31. agenta/client/backend/types/parent_dto.py +21 -0
  32. agenta/client/backend/types/root_dto.py +21 -0
  33. agenta/client/backend/types/span_dto.py +54 -0
  34. agenta/client/backend/types/span_dto_nodes_value.py +9 -0
  35. agenta/client/backend/types/status_code.py +5 -0
  36. agenta/client/backend/types/status_dto.py +23 -0
  37. agenta/client/backend/types/time_dto.py +23 -0
  38. agenta/client/backend/types/tree_dto.py +23 -0
  39. agenta/client/backend/types/tree_type.py +5 -0
  40. agenta/client/backend/variants/client.py +24 -16
  41. agenta/sdk/__init__.py +2 -0
  42. agenta/sdk/decorators/routing.py +1 -1
  43. agenta/sdk/tracing/inline.py +29 -140
  44. agenta/sdk/types.py +5 -2
  45. {agenta-0.27.7a1.dist-info → agenta-0.27.7a2.dist-info}/METADATA +1 -1
  46. {agenta-0.27.7a1.dist-info → agenta-0.27.7a2.dist-info}/RECORD +48 -14
  47. {agenta-0.27.7a1.dist-info → agenta-0.27.7a2.dist-info}/WHEEL +0 -0
  48. {agenta-0.27.7a1.dist-info → agenta-0.27.7a2.dist-info}/entry_points.txt +0 -0
@@ -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
+ ]