agenta 0.50.6__py3-none-any.whl → 0.51.1__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.
- agenta/__init__.py +8 -5
- agenta/sdk/__init__.py +2 -1
- agenta/sdk/agenta_init.py +2 -2
- agenta/sdk/context/running.py +39 -0
- agenta/sdk/context/{routing.py → serving.py} +4 -4
- agenta/sdk/context/tracing.py +27 -1
- agenta/sdk/decorators/running.py +134 -0
- agenta/sdk/decorators/{routing.py → serving.py} +5 -5
- agenta/sdk/decorators/tracing.py +7 -1
- agenta/sdk/litellm/mockllm.py +55 -2
- agenta/sdk/managers/config.py +2 -2
- agenta/sdk/managers/secrets.py +2 -2
- agenta/sdk/managers/vault.py +2 -2
- agenta/sdk/middleware/adapt.py +253 -0
- agenta/sdk/middleware/auth.py +179 -3
- agenta/sdk/middleware/base.py +40 -0
- agenta/sdk/middleware/flags.py +40 -0
- agenta/sdk/tracing/exporters.py +9 -9
- agenta/sdk/tracing/inline.py +1 -0
- agenta/sdk/tracing/tracing.py +0 -8
- agenta/sdk/utils/cache.py +3 -3
- agenta/sdk/workflows/__init__.py +0 -0
- agenta/sdk/workflows/registry.py +32 -0
- agenta/sdk/workflows/types.py +470 -0
- agenta/sdk/workflows/utils.py +17 -0
- {agenta-0.50.6.dist-info → agenta-0.51.1.dist-info}/METADATA +4 -2
- {agenta-0.50.6.dist-info → agenta-0.51.1.dist-info}/RECORD +28 -20
- agenta/sdk/context/exporting.py +0 -25
- {agenta-0.50.6.dist-info → agenta-0.51.1.dist-info}/WHEEL +0 -0
|
@@ -0,0 +1,470 @@
|
|
|
1
|
+
# - oss.src.core.shared.dtos ---------------------------------------------------
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
from typing import Optional, Dict, List, Union
|
|
5
|
+
from uuid import UUID
|
|
6
|
+
from datetime import datetime
|
|
7
|
+
|
|
8
|
+
from typing_extensions import TypeAliasType
|
|
9
|
+
from pydantic import BaseModel
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
BoolJson: TypeAliasType = TypeAliasType(
|
|
13
|
+
"BoolJson",
|
|
14
|
+
Union[bool, Dict[str, "BoolJson"]],
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
StringJson: TypeAliasType = TypeAliasType(
|
|
18
|
+
"StringJson",
|
|
19
|
+
Union[str, Dict[str, "StringJson"]],
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
FullJson: TypeAliasType = TypeAliasType(
|
|
23
|
+
"FullJson",
|
|
24
|
+
Union[str, int, float, bool, None, Dict[str, "FullJson"], List["FullJson"]],
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
NumericJson: TypeAliasType = TypeAliasType(
|
|
28
|
+
"NumericJson",
|
|
29
|
+
Union[int, float, Dict[str, "NumericJson"]],
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
NoListJson: TypeAliasType = TypeAliasType(
|
|
33
|
+
"NoListJson",
|
|
34
|
+
Union[str, int, float, bool, None, Dict[str, "NoListJson"]],
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
LabelJson: TypeAliasType = TypeAliasType(
|
|
38
|
+
"LabelJson",
|
|
39
|
+
Union[bool, str, Dict[str, "LabelJson"]],
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
Json = Dict[str, FullJson]
|
|
43
|
+
|
|
44
|
+
Data = Dict[str, FullJson]
|
|
45
|
+
|
|
46
|
+
Meta = Dict[str, FullJson]
|
|
47
|
+
|
|
48
|
+
Tags = Dict[str, LabelJson]
|
|
49
|
+
|
|
50
|
+
Flags = Dict[str, LabelJson]
|
|
51
|
+
|
|
52
|
+
Hashes = Dict[str, StringJson]
|
|
53
|
+
|
|
54
|
+
Metrics = Dict[str, NumericJson]
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
class Metadata(BaseModel):
|
|
58
|
+
flags: Optional[Flags] = None
|
|
59
|
+
meta: Optional[Meta] = None
|
|
60
|
+
tags: Optional[Tags] = None
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
class Lifecycle(BaseModel):
|
|
64
|
+
created_at: Optional[datetime] = None
|
|
65
|
+
updated_at: Optional[datetime] = None
|
|
66
|
+
deleted_at: Optional[datetime] = None
|
|
67
|
+
|
|
68
|
+
created_by_id: Optional[UUID] = None
|
|
69
|
+
updated_by_id: Optional[UUID] = None
|
|
70
|
+
deleted_by_id: Optional[UUID] = None
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
class TraceID(BaseModel):
|
|
74
|
+
trace_id: Optional[str] = None
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
class SpanID(BaseModel):
|
|
78
|
+
span_id: Optional[str] = None
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
class Identifier(BaseModel):
|
|
82
|
+
id: Optional[UUID] = None
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
class Slug(BaseModel):
|
|
86
|
+
slug: Optional[str] = None
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
class Version(BaseModel):
|
|
90
|
+
version: Optional[str] = None
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
class Header(BaseModel):
|
|
94
|
+
name: Optional[str] = None
|
|
95
|
+
description: Optional[str] = None
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
class Reference(Identifier, Slug, Version):
|
|
99
|
+
pass
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
class Link(TraceID, SpanID):
|
|
103
|
+
pass
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
def sync_alias(primary: str, alias: str, instance: BaseModel) -> None:
|
|
107
|
+
primary_val = getattr(instance, primary)
|
|
108
|
+
alias_val = getattr(instance, alias)
|
|
109
|
+
|
|
110
|
+
if primary_val and alias_val is None:
|
|
111
|
+
object.__setattr__(instance, alias, primary_val)
|
|
112
|
+
elif alias_val and primary_val is None:
|
|
113
|
+
object.__setattr__(instance, primary, alias_val)
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
class AliasConfig(BaseModel):
|
|
117
|
+
model_config = {
|
|
118
|
+
"populate_by_name": True,
|
|
119
|
+
"from_attributes": True,
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
class Status(BaseModel):
|
|
124
|
+
code: Optional[int] = 500
|
|
125
|
+
message: Optional[str] = "Please try again later."
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
Mappings = Dict[str, str]
|
|
129
|
+
|
|
130
|
+
Schema = Dict[str, FullJson]
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
# ------------------------------------------------------------------------------
|
|
134
|
+
|
|
135
|
+
# - oss.src.core.git.dtos ------------------------------------------------------
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
from typing import Optional, List
|
|
139
|
+
from uuid import UUID
|
|
140
|
+
from datetime import datetime
|
|
141
|
+
|
|
142
|
+
from pydantic import BaseModel
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
class Commit(BaseModel):
|
|
146
|
+
author: Optional[UUID] = None
|
|
147
|
+
date: Optional[datetime] = None
|
|
148
|
+
message: Optional[str] = None
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
class Revision(Identifier, Slug, Version, Lifecycle, Header, Metadata, Commit):
|
|
152
|
+
data: Optional[Data] = None
|
|
153
|
+
|
|
154
|
+
artifact_id: Optional[UUID] = None
|
|
155
|
+
variant_id: Optional[UUID] = None
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
# ------------------------------------------------------------------------------
|
|
159
|
+
|
|
160
|
+
# - oss.src.core.tracing.dtos --------------------------------------------------
|
|
161
|
+
|
|
162
|
+
import random
|
|
163
|
+
import string
|
|
164
|
+
from enum import Enum
|
|
165
|
+
from datetime import datetime, timezone
|
|
166
|
+
from typing import List, Dict, Any, Union, Optional
|
|
167
|
+
|
|
168
|
+
from pydantic import BaseModel, model_validator, Field
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
class TraceType(Enum):
|
|
172
|
+
INVOCATION = "invocation"
|
|
173
|
+
ANNOTATION = "annotation"
|
|
174
|
+
UNKNOWN = "unknown"
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
class SpanType(Enum):
|
|
178
|
+
AGENT = "agent"
|
|
179
|
+
CHAIN = "chain"
|
|
180
|
+
WORKFLOW = "workflow"
|
|
181
|
+
TASK = "task"
|
|
182
|
+
TOOL = "tool"
|
|
183
|
+
EMBEDDING = "embedding"
|
|
184
|
+
QUERY = "query"
|
|
185
|
+
LLM = "llm"
|
|
186
|
+
COMPLETION = "completion"
|
|
187
|
+
CHAT = "chat"
|
|
188
|
+
RERANK = "rerank"
|
|
189
|
+
UNKNOWN = "unknown"
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
class AgMetricEntryAttributes(BaseModel):
|
|
193
|
+
cumulative: Optional[Metrics] = None
|
|
194
|
+
incremental: Optional[Metrics] = None
|
|
195
|
+
|
|
196
|
+
model_config = {"ser_json_exclude_none": True}
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
class AgMetricsAttributes(BaseModel):
|
|
200
|
+
duration: Optional[AgMetricEntryAttributes] = None
|
|
201
|
+
errors: Optional[AgMetricEntryAttributes] = None
|
|
202
|
+
tokens: Optional[AgMetricEntryAttributes] = None
|
|
203
|
+
costs: Optional[AgMetricEntryAttributes] = None
|
|
204
|
+
|
|
205
|
+
model_config = {"ser_json_exclude_none": True}
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
class AgTypeAttributes(BaseModel):
|
|
209
|
+
trace: Optional[TraceType] = TraceType.INVOCATION
|
|
210
|
+
span: Optional[SpanType] = SpanType.TASK
|
|
211
|
+
|
|
212
|
+
model_config = {"ser_json_exclude_none": True}
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
class AgDataAttributes(BaseModel):
|
|
216
|
+
inputs: Optional[Dict[str, Any]] = None
|
|
217
|
+
outputs: Optional[Any] = None
|
|
218
|
+
internals: Optional[Dict[str, Any]] = None
|
|
219
|
+
|
|
220
|
+
model_config = {"ser_json_exclude_none": True}
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
class AgAttributes(BaseModel):
|
|
224
|
+
type: AgTypeAttributes = Field(default_factory=AgTypeAttributes)
|
|
225
|
+
data: AgDataAttributes = Field(default_factory=AgDataAttributes)
|
|
226
|
+
|
|
227
|
+
metrics: Optional[AgMetricsAttributes] = None
|
|
228
|
+
flags: Optional[Flags] = None
|
|
229
|
+
tags: Optional[Tags] = None
|
|
230
|
+
meta: Optional[Meta] = None
|
|
231
|
+
exception: Optional[Data] = None
|
|
232
|
+
references: Optional[Dict[str, "OTelReference"]] = None
|
|
233
|
+
unsupported: Optional[Data] = None
|
|
234
|
+
|
|
235
|
+
model_config = {"ser_json_exclude_none": True}
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
class OTelStatusCode(Enum):
|
|
239
|
+
STATUS_CODE_UNSET = "STATUS_CODE_UNSET"
|
|
240
|
+
STATUS_CODE_OK = "STATUS_CODE_OK"
|
|
241
|
+
STATUS_CODE_ERROR = "STATUS_CODE_ERROR"
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
class OTelSpanKind(Enum):
|
|
245
|
+
SPAN_KIND_UNSPECIFIED = "SPAN_KIND_UNSPECIFIED"
|
|
246
|
+
SPAN_KIND_INTERNAL = "SPAN_KIND_INTERNAL"
|
|
247
|
+
SPAN_KIND_SERVER = "SPAN_KIND_SERVER"
|
|
248
|
+
SPAN_KIND_CLIENT = "SPAN_KIND_CLIENT"
|
|
249
|
+
SPAN_KIND_PRODUCER = "SPAN_KIND_PRODUCER"
|
|
250
|
+
SPAN_KIND_CONSUMER = "SPAN_KIND_CONSUMER"
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
OTelAttributes = Json
|
|
254
|
+
OTelMetrics = Metrics
|
|
255
|
+
OTelTags = Tags
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
class OTelEvent(BaseModel):
|
|
259
|
+
name: str
|
|
260
|
+
timestamp: Union[datetime, int]
|
|
261
|
+
|
|
262
|
+
attributes: Optional[OTelAttributes] = None
|
|
263
|
+
|
|
264
|
+
|
|
265
|
+
OTelEvents = List[OTelEvent]
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
class OTelHash(Identifier):
|
|
269
|
+
attributes: Optional[OTelAttributes] = None
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
OTelHashes = List[OTelHash]
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
class OTelLink(TraceID, SpanID):
|
|
276
|
+
attributes: Optional[OTelAttributes] = None
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
OTelLinks = List[OTelLink]
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
class OTelReference(Reference):
|
|
283
|
+
attributes: Optional[OTelAttributes] = None
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
OTelReferences = List[OTelReference]
|
|
287
|
+
|
|
288
|
+
|
|
289
|
+
class OTelSpansTree(BaseModel):
|
|
290
|
+
spans: Optional["OTelNestedSpans"] = None
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
OTelSpansTrees = List[OTelSpansTree]
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
class OTelFlatSpan(Lifecycle):
|
|
297
|
+
trace_id: str
|
|
298
|
+
span_id: str
|
|
299
|
+
parent_id: Optional[str] = None
|
|
300
|
+
|
|
301
|
+
trace_type: Optional[TraceType] = None
|
|
302
|
+
span_type: Optional[SpanType] = None
|
|
303
|
+
|
|
304
|
+
span_kind: Optional[OTelSpanKind] = None
|
|
305
|
+
span_name: Optional[str] = None
|
|
306
|
+
|
|
307
|
+
start_time: Optional[Union[datetime, int]] = None
|
|
308
|
+
end_time: Optional[Union[datetime, int]] = None
|
|
309
|
+
|
|
310
|
+
status_code: Optional[OTelStatusCode] = None
|
|
311
|
+
status_message: Optional[str] = None
|
|
312
|
+
|
|
313
|
+
attributes: Optional[OTelAttributes] = None
|
|
314
|
+
references: Optional[OTelReferences] = None
|
|
315
|
+
links: Optional[OTelLinks] = None
|
|
316
|
+
hashes: Optional[OTelHashes] = None
|
|
317
|
+
|
|
318
|
+
exception: Optional[Data] = None
|
|
319
|
+
|
|
320
|
+
events: Optional[OTelEvents] = None
|
|
321
|
+
|
|
322
|
+
@model_validator(mode="after")
|
|
323
|
+
def set_defaults(self):
|
|
324
|
+
if self.trace_type is None:
|
|
325
|
+
self.trace_type = TraceType.INVOCATION
|
|
326
|
+
if self.span_type is None:
|
|
327
|
+
self.span_type = SpanType.TASK
|
|
328
|
+
if self.span_kind is None:
|
|
329
|
+
self.span_kind = OTelSpanKind.SPAN_KIND_UNSPECIFIED
|
|
330
|
+
if self.status_code is None:
|
|
331
|
+
self.status_code = OTelStatusCode.STATUS_CODE_UNSET
|
|
332
|
+
if self.end_time is None and self.start_time is not None:
|
|
333
|
+
self.end_time = self.start_time
|
|
334
|
+
if self.start_time is None and self.end_time is not None:
|
|
335
|
+
self.start_time = self.end_time
|
|
336
|
+
if self.start_time is None and self.end_time is None:
|
|
337
|
+
now = datetime.now(timezone.utc)
|
|
338
|
+
self.start_time = now
|
|
339
|
+
self.end_time = now
|
|
340
|
+
if self.span_name is None:
|
|
341
|
+
self.span_name = "".join(
|
|
342
|
+
random.choices(string.ascii_letters + string.digits, k=8)
|
|
343
|
+
)
|
|
344
|
+
return self
|
|
345
|
+
|
|
346
|
+
|
|
347
|
+
class OTelSpan(OTelFlatSpan, OTelSpansTree):
|
|
348
|
+
pass
|
|
349
|
+
|
|
350
|
+
|
|
351
|
+
OTelFlatSpans = List[OTelFlatSpan]
|
|
352
|
+
OTelNestedSpans = Dict[str, Union[OTelSpan, List[OTelSpan]]]
|
|
353
|
+
OTelTraceTree = Dict[str, OTelSpansTree]
|
|
354
|
+
OTelTraceTrees = List[OTelTraceTree]
|
|
355
|
+
OTelSpans = List[OTelSpan]
|
|
356
|
+
|
|
357
|
+
|
|
358
|
+
Attributes = OTelAttributes
|
|
359
|
+
Trace = OTelTraceTree
|
|
360
|
+
|
|
361
|
+
|
|
362
|
+
# ------------------------------------------------------------------------------
|
|
363
|
+
|
|
364
|
+
# - oss.src.core.workflows.dtos ------------------------------------------------
|
|
365
|
+
|
|
366
|
+
|
|
367
|
+
from typing import Optional, Dict
|
|
368
|
+
from uuid import UUID
|
|
369
|
+
|
|
370
|
+
from pydantic import BaseModel, Field, model_validator
|
|
371
|
+
|
|
372
|
+
|
|
373
|
+
class WorkflowIdAlias(AliasConfig):
|
|
374
|
+
workflow_id: Optional[UUID] = None
|
|
375
|
+
artifact_id: Optional[UUID] = Field(
|
|
376
|
+
default=None,
|
|
377
|
+
exclude=True,
|
|
378
|
+
alias="workflow_id",
|
|
379
|
+
)
|
|
380
|
+
|
|
381
|
+
|
|
382
|
+
class WorkflowVariantIdAlias(AliasConfig):
|
|
383
|
+
workflow_variant_id: Optional[UUID] = None
|
|
384
|
+
variant_id: Optional[UUID] = Field(
|
|
385
|
+
default=None,
|
|
386
|
+
exclude=True,
|
|
387
|
+
alias="workflow_variant_id",
|
|
388
|
+
)
|
|
389
|
+
|
|
390
|
+
|
|
391
|
+
class WorkflowFlags(BaseModel):
|
|
392
|
+
is_custom: Optional[bool] = None
|
|
393
|
+
is_evaluator: Optional[bool] = None
|
|
394
|
+
is_human: Optional[bool] = None
|
|
395
|
+
|
|
396
|
+
|
|
397
|
+
class WorkflowServiceVersion(BaseModel):
|
|
398
|
+
version: Optional[str] = None
|
|
399
|
+
|
|
400
|
+
|
|
401
|
+
class WorkflowServiceInterface(WorkflowServiceVersion):
|
|
402
|
+
uri: Optional[str] = None # str (Enum) w/ validation
|
|
403
|
+
url: Optional[str] = None # str w/ validation
|
|
404
|
+
headers: Optional[Dict[str, Reference | str]] = None # either hardcoded or a secret
|
|
405
|
+
|
|
406
|
+
schemas: Optional[Schema] = None # json-schema instead of pydantic
|
|
407
|
+
mappings: Optional[Mappings] = None # used in the workflow interface
|
|
408
|
+
|
|
409
|
+
|
|
410
|
+
class WorkflowServiceConfiguration(WorkflowServiceInterface):
|
|
411
|
+
script: Optional[str] = None # str w/ validation
|
|
412
|
+
parameters: Optional[Data] = None # configuration values
|
|
413
|
+
|
|
414
|
+
|
|
415
|
+
class WorkflowRevisionData(WorkflowServiceConfiguration):
|
|
416
|
+
pass
|
|
417
|
+
|
|
418
|
+
|
|
419
|
+
class WorkflowRevision(
|
|
420
|
+
Revision,
|
|
421
|
+
WorkflowIdAlias,
|
|
422
|
+
WorkflowVariantIdAlias,
|
|
423
|
+
):
|
|
424
|
+
flags: Optional[WorkflowFlags] = None
|
|
425
|
+
|
|
426
|
+
data: Optional[WorkflowRevisionData] = None
|
|
427
|
+
|
|
428
|
+
def model_post_init(self, __context) -> None:
|
|
429
|
+
sync_alias("workflow_id", "artifact_id", self)
|
|
430
|
+
sync_alias("workflow_variant_id", "variant_id", self)
|
|
431
|
+
|
|
432
|
+
|
|
433
|
+
class WorkflowServiceData(BaseModel):
|
|
434
|
+
inputs: Optional[Data] = None
|
|
435
|
+
outputs: Optional[str | Data] = None
|
|
436
|
+
trace: Optional[Trace] = None
|
|
437
|
+
trace_outputs: Optional[str | Data] = None
|
|
438
|
+
traces: Optional[Dict[str, Trace]] = None
|
|
439
|
+
traces_outputs: Optional[Dict[str, str | Data]] = None
|
|
440
|
+
|
|
441
|
+
|
|
442
|
+
class WorkflowServiceRequest(Version, Metadata):
|
|
443
|
+
data: Optional[WorkflowServiceData] = None
|
|
444
|
+
|
|
445
|
+
path: Optional[str] = "/"
|
|
446
|
+
method: Optional[str] = "invoke"
|
|
447
|
+
|
|
448
|
+
references: Optional[Dict[str, Reference]] = None
|
|
449
|
+
links: Optional[Dict[str, Link]] = None
|
|
450
|
+
|
|
451
|
+
# secrets: Optional[Dict[str, Secret]] = None
|
|
452
|
+
credentials: Optional[str] = None
|
|
453
|
+
|
|
454
|
+
|
|
455
|
+
class WorkflowServiceResponse(Identifier, Version):
|
|
456
|
+
data: Optional[WorkflowServiceData] = None
|
|
457
|
+
|
|
458
|
+
links: Optional[Dict[str, Link]] = None
|
|
459
|
+
|
|
460
|
+
status: Optional[Status] = None # = Status()
|
|
461
|
+
|
|
462
|
+
|
|
463
|
+
# ------------------------------------------------------------------------------
|
|
464
|
+
|
|
465
|
+
from typing import Callable, Awaitable
|
|
466
|
+
|
|
467
|
+
WorkflowServiceHandler = Callable[
|
|
468
|
+
[WorkflowServiceRequest, WorkflowRevision],
|
|
469
|
+
Awaitable[WorkflowServiceResponse],
|
|
470
|
+
]
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
from typing import Optional, Tuple
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
async def parse_service_uri(
|
|
5
|
+
uri: str,
|
|
6
|
+
) -> Tuple[Optional[str], Optional[str], Optional[str], Optional[str]]:
|
|
7
|
+
if not uri or not uri.strip():
|
|
8
|
+
return None, None, None, None
|
|
9
|
+
|
|
10
|
+
# uri ~ [<provider>|empty]:<kind>:<key>:[<version>|'latest'|empty]
|
|
11
|
+
|
|
12
|
+
parts = uri.split(":")
|
|
13
|
+
|
|
14
|
+
if len(parts) != 4:
|
|
15
|
+
return None, None, None, None
|
|
16
|
+
|
|
17
|
+
return tuple(parts)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: agenta
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.51.1
|
|
4
4
|
Summary: The SDK for agenta is an open-source LLMOps platform.
|
|
5
5
|
Keywords: LLMOps,LLM,evaluation,prompt engineering
|
|
6
6
|
Author: Mahmoud Mabrouk
|
|
@@ -15,13 +15,15 @@ Classifier: Programming Language :: Python :: 3.11
|
|
|
15
15
|
Classifier: Programming Language :: Python :: 3.12
|
|
16
16
|
Classifier: Programming Language :: Python :: 3.13
|
|
17
17
|
Classifier: Topic :: Software Development :: Libraries
|
|
18
|
+
Requires-Dist: decorator (>=5.2.1,<6.0.0)
|
|
18
19
|
Requires-Dist: fastapi (>=0.116.0,<0.117.0)
|
|
19
20
|
Requires-Dist: h11 (>=0.16.0)
|
|
20
21
|
Requires-Dist: httpx (>=0.28.0)
|
|
21
22
|
Requires-Dist: huggingface-hub (<0.31.0)
|
|
22
23
|
Requires-Dist: importlib-metadata (>=8.0.0,<9.0)
|
|
23
24
|
Requires-Dist: jinja2 (>=3.1.6,<4.0.0)
|
|
24
|
-
Requires-Dist: litellm (>=1.
|
|
25
|
+
Requires-Dist: litellm (>=1.75.9)
|
|
26
|
+
Requires-Dist: openai (>=1.100.0)
|
|
25
27
|
Requires-Dist: opentelemetry-api (>=1.27.0,<2.0.0)
|
|
26
28
|
Requires-Dist: opentelemetry-exporter-otlp-proto-http (>=1.27.0,<2.0.0)
|
|
27
29
|
Requires-Dist: opentelemetry-instrumentation (>=0.56b0)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
agenta/__init__.py,sha256=
|
|
1
|
+
agenta/__init__.py,sha256=bV39S6o-f49Ehh07C29NuJzu7p0lOWu-8CzNHSs16GA,2511
|
|
2
2
|
agenta/client/Readme.md,sha256=ZQJ_nBVYfVJizfMaD_3WPdXPBfi8okrV7i8LAUAfdu0,7604
|
|
3
3
|
agenta/client/__init__.py,sha256=CX29qhOzPbMoL3C_YJ_FIMxVzlpW4B7F-g94TddQkw4,10832
|
|
4
4
|
agenta/client/backend/__init__.py,sha256=8gv27I-5qi_x0ImGIETQzNdEr7BeiAR12YwR3rVRrqE,10559
|
|
@@ -305,32 +305,36 @@ agenta/client/types/provider_kind.py~feat_model-registry,sha256=u_fXncQyXH3pfh2w
|
|
|
305
305
|
agenta/client/types.py,sha256=wBGDVktTL2EblEKW23Y-VrFp7V_JHLPMHltt2jEkF0Q,129
|
|
306
306
|
agenta/config.py,sha256=0VrTqduB4g8Mt_Ll7ffFcEjKF5qjTUIxmUtTPW2ygWw,653
|
|
307
307
|
agenta/config.toml,sha256=sIORbhnyct2R9lJrquxhNL4pHul3O0R7iaipCoja5MY,193
|
|
308
|
-
agenta/sdk/__init__.py,sha256=
|
|
309
|
-
agenta/sdk/agenta_init.py,sha256
|
|
308
|
+
agenta/sdk/__init__.py,sha256=6LWzIVeXpkBKgjIXyOFOJwSDDcAf9JC_3kmxaBxjB_w,2170
|
|
309
|
+
agenta/sdk/agenta_init.py,sha256=Jkfm5Fs5qy1gMY_AWiMhr_EnvVBddNRqYb8GtN19kkc,6610
|
|
310
310
|
agenta/sdk/assets.py,sha256=F5W5p_jXk8hzM9L5RA1n5HXc0yjS5OZMGF_Bu1P8t_I,8392
|
|
311
311
|
agenta/sdk/context/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
312
|
-
agenta/sdk/context/
|
|
313
|
-
agenta/sdk/context/
|
|
314
|
-
agenta/sdk/context/tracing.py,sha256=
|
|
312
|
+
agenta/sdk/context/running.py,sha256=3gEuUdQrJwcuN93MlXFZ6aHXNxUW6dUk_EudgaxOkCU,907
|
|
313
|
+
agenta/sdk/context/serving.py,sha256=f0Iq8Sv_CBJF7838tDecy_89K6HI7k6joWBkWHTM7yE,598
|
|
314
|
+
agenta/sdk/context/tracing.py,sha256=tM1T-HBt9D1qD8VsVKWlLe6MBRQrtHUA33E3KNM4GXQ,1237
|
|
315
315
|
agenta/sdk/decorators/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
316
|
-
agenta/sdk/decorators/
|
|
317
|
-
agenta/sdk/decorators/
|
|
316
|
+
agenta/sdk/decorators/running.py,sha256=j077-4u4XytNV57g0UY8ddG_M2k99Q829yPejiuGeg8,4034
|
|
317
|
+
agenta/sdk/decorators/serving.py,sha256=jU8nP0btR4tytPkjiEmrmVSvShSSEFX7tKilHZfr-XE,26186
|
|
318
|
+
agenta/sdk/decorators/tracing.py,sha256=Ug1ybanpW6CsvT41eh2wDrjNy81amDqGU0Yo2FN5sPk,10222
|
|
318
319
|
agenta/sdk/litellm/__init__.py,sha256=Bpz1gfHQc0MN1yolWcjifLWznv6GjHggvRGQSpxpihM,37
|
|
319
320
|
agenta/sdk/litellm/litellm.py,sha256=dCjw0H_jD3L3UQ3l9SbLm5dfeIGnel6dPtQYJ78beYM,10202
|
|
320
|
-
agenta/sdk/litellm/mockllm.py,sha256=
|
|
321
|
+
agenta/sdk/litellm/mockllm.py,sha256=F10Sbj2V1Cihkg6bgHkIOuw8irYEYpIp47UsO8LGOeE,2322
|
|
321
322
|
agenta/sdk/litellm/mocks/__init__.py,sha256=d-aAj-uzee1BVGHMB2oJocpxGQeWr6QLrYV4oNdSqzY,5241
|
|
322
323
|
agenta/sdk/managers/__init__.py,sha256=SN-LRwG0pRRDV3u2Q4JiiSTigN3-mYpzGNM35RzT4mc,238
|
|
323
324
|
agenta/sdk/managers/apps.py,sha256=BeAlTJlOOM0Wh_XWgjve65Mt-LwFgib_swu-1wvGQi4,2250
|
|
324
|
-
agenta/sdk/managers/config.py,sha256=
|
|
325
|
+
agenta/sdk/managers/config.py,sha256=yyFxjZVf3_XfNAkZpl-qWzljYz4XB8LgPYc55JXEwG0,7494
|
|
325
326
|
agenta/sdk/managers/deployment.py,sha256=SEokjZeh6n7HRKZ92Y0WncdG49hIFx-Z3B3HAl2kmUg,1174
|
|
326
|
-
agenta/sdk/managers/secrets.py,sha256=
|
|
327
|
+
agenta/sdk/managers/secrets.py,sha256=Xwt8DNIjMbt20vVNBNLjICmi9S0xcQK97JD97MFHvAE,7458
|
|
327
328
|
agenta/sdk/managers/shared.py,sha256=kI3w74E4rS3YDORG2e-_r0Pz5KslTRzRBK7vgyOeaJA,21559
|
|
328
329
|
agenta/sdk/managers/variant.py,sha256=A5ga3mq3b0weUTXa9HO72MGaspthGcu1uK9K5OnP738,4172
|
|
329
|
-
agenta/sdk/managers/vault.py,sha256=
|
|
330
|
+
agenta/sdk/managers/vault.py,sha256=tOJsRWSEpmNT_ysWVcK5KQMdQO4pwiK90H3rsr9BUbg,337
|
|
330
331
|
agenta/sdk/middleware/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
331
|
-
agenta/sdk/middleware/
|
|
332
|
+
agenta/sdk/middleware/adapt.py,sha256=hRMwaCv_-6vA80YiYRA25ONl7WHEClmVgqnbHUYfwLQ,7195
|
|
333
|
+
agenta/sdk/middleware/auth.py,sha256=bcg2MrCIqruVblbsNuSKZXXkutu0iRfSQp_AJZtJs14,16389
|
|
334
|
+
agenta/sdk/middleware/base.py,sha256=ieRXgzjM4R3edqAs6sEd0hzo5B7kl1UDjNOsNqGitmI,1051
|
|
332
335
|
agenta/sdk/middleware/config.py,sha256=zd57kxaeYheZMG8nD5VOYgHXw8j9zRlFacuzCGHWeEA,7978
|
|
333
336
|
agenta/sdk/middleware/cors.py,sha256=q3r7lGkrIdMcT_vuhsburMcjG7pyl7w0ycxrIrGJ2e8,921
|
|
337
|
+
agenta/sdk/middleware/flags.py,sha256=okku9RBmcD4Qka8XIsVqtroMDg-9IXevUwDiAA9whJg,990
|
|
334
338
|
agenta/sdk/middleware/inline.py,sha256=ee8E4XBGcRSrHTvblqX1yRXuTN_sxLm7lY1jnywrBG8,901
|
|
335
339
|
agenta/sdk/middleware/mock.py,sha256=bCUN9iJBxePyN9MBwBpJs-_iCNkUQeUjIIu3WElS1oQ,759
|
|
336
340
|
agenta/sdk/middleware/otel.py,sha256=lHzhGUv4fq2RPuTPH2keJ16v-_cBUrLrTqWzHUmEVdI,1041
|
|
@@ -339,15 +343,15 @@ agenta/sdk/router.py,sha256=mOguvtOwl2wmyAgOuWTsf98pQwpNiUILKIo67W_hR3A,119
|
|
|
339
343
|
agenta/sdk/tracing/__init__.py,sha256=rQNe5-zT5Kt7_CDhq-lnUIi1EYTBVzVf_MbfcIxVD98,41
|
|
340
344
|
agenta/sdk/tracing/attributes.py,sha256=DwjjOk3mGOvz0jYu8EYr3hhItvawK5GX80_MfciqPrc,5559
|
|
341
345
|
agenta/sdk/tracing/conventions.py,sha256=JBtznBXZ3aRkGKkLl7cPwdMNh3w1G-H2Ta2YrAxbr38,950
|
|
342
|
-
agenta/sdk/tracing/exporters.py,sha256=
|
|
343
|
-
agenta/sdk/tracing/inline.py,sha256=
|
|
346
|
+
agenta/sdk/tracing/exporters.py,sha256=b1Aq5AcQYnmAxapQMYpN_MfaLOG4IGTzlQw3PfBiKgI,3486
|
|
347
|
+
agenta/sdk/tracing/inline.py,sha256=y2S_MGGqmXgyUgbkNNyrb8_X-QtGuDy8JwxlwWibIx8,31507
|
|
344
348
|
agenta/sdk/tracing/processors.py,sha256=wZWF8vTEouhbGxbfPGXVQJI53CcXFByqxHiCSIzJV-4,5407
|
|
345
349
|
agenta/sdk/tracing/propagation.py,sha256=EeOqDMqnh_MoEhGd1do_vy_tQBYUcoC8kpLqVoZeqg0,2561
|
|
346
350
|
agenta/sdk/tracing/spans.py,sha256=nqUOjjirBxB8Eacv8Qj4Ra_6rknGi3lbJdNyKmk5ODQ,3707
|
|
347
|
-
agenta/sdk/tracing/tracing.py,sha256=
|
|
351
|
+
agenta/sdk/tracing/tracing.py,sha256=eqQLcvgmR6Tz0WSwLCERkGKiLzsKfDyR_ah-Tyz1qGE,9256
|
|
348
352
|
agenta/sdk/types.py,sha256=Cq0U3gI8ll65KhsnVWkuLJvwZGEsuTe3WdsHX1UX6zQ,20753
|
|
349
353
|
agenta/sdk/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
350
|
-
agenta/sdk/utils/cache.py,sha256=
|
|
354
|
+
agenta/sdk/utils/cache.py,sha256=q6SYVzHW9RCwtZ7z4Ue3uMwXroroLlko5AvQ1MouvFM,1429
|
|
351
355
|
agenta/sdk/utils/constants.py,sha256=zW3R4rjXOo2L5lz6q84l_zYuOM9u4mpPRHw_B1Dr_hI,67
|
|
352
356
|
agenta/sdk/utils/costs.py,sha256=i8C7ud__pThLS55XkN4YW8czXtGeXr2mx7jjcOFeiXg,5955
|
|
353
357
|
agenta/sdk/utils/exceptions.py,sha256=Dq3lh5Ug7IhF4nvYRXXlwhgxEuByOnT1w0uVMZx1eaM,1504
|
|
@@ -357,6 +361,10 @@ agenta/sdk/utils/logging.py,sha256=j4NzpFk2ilOM10sRBOxCjmansDHSx6HwMV8IAEreRb8,8
|
|
|
357
361
|
agenta/sdk/utils/preinit.py,sha256=1TAAHhYyYnLLwvzwnf33Qwkou7tI3iITlVt-1kcyGaM,1186
|
|
358
362
|
agenta/sdk/utils/singleton.py,sha256=17Ph7LGnnV8HkPjImruKita2ni03Ari5jr0jqm__4sc,312
|
|
359
363
|
agenta/sdk/utils/timing.py,sha256=nZR-kudVUtKFlHuBhztgSGxj7FVnCB4Uv6sfg-1dkrQ,1556
|
|
360
|
-
agenta
|
|
361
|
-
agenta
|
|
362
|
-
agenta
|
|
364
|
+
agenta/sdk/workflows/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
365
|
+
agenta/sdk/workflows/registry.py,sha256=OucCfmhyEENAF5OwjRBLjbDIy3Qar-prFXLhKMU0BZA,944
|
|
366
|
+
agenta/sdk/workflows/types.py,sha256=nklaaIrK0o5Nloy1l6hnPXjtN7H4-OUv0ivAUf278Og,11682
|
|
367
|
+
agenta/sdk/workflows/utils.py,sha256=ILfY8DSBWLrdWIuKg6mq7rANwKiiY6sxEeFiBFhjLYM,413
|
|
368
|
+
agenta-0.51.1.dist-info/METADATA,sha256=iHGVP2W8GbodS7IXUw4WHO5DWn2piSeditJFqigLfEM,31641
|
|
369
|
+
agenta-0.51.1.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
|
370
|
+
agenta-0.51.1.dist-info/RECORD,,
|
agenta/sdk/context/exporting.py
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
from typing import Optional
|
|
2
|
-
|
|
3
|
-
from contextlib import contextmanager
|
|
4
|
-
from contextvars import ContextVar
|
|
5
|
-
|
|
6
|
-
from pydantic import BaseModel
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
class ExportingContext(BaseModel):
|
|
10
|
-
credentials: Optional[str] = None
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
exporting_context = ContextVar("exporting_context", default=ExportingContext())
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
@contextmanager
|
|
17
|
-
def exporting_context_manager(
|
|
18
|
-
*,
|
|
19
|
-
context: Optional[ExportingContext] = None,
|
|
20
|
-
):
|
|
21
|
-
token = exporting_context.set(context)
|
|
22
|
-
try:
|
|
23
|
-
yield
|
|
24
|
-
finally:
|
|
25
|
-
exporting_context.reset(token)
|
|
File without changes
|