aerograph-sdk 0.2.0__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.
- aerograph_sdk/__init__.py +25 -0
- aerograph_sdk/contracts/__init__.py +83 -0
- aerograph_sdk/contracts/generated.py +564 -0
- aerograph_sdk/events.py +423 -0
- aerograph_sdk/ids.py +38 -0
- aerograph_sdk/json_normalize.py +60 -0
- aerograph_sdk/recorder.py +669 -0
- aerograph_sdk/state_hash.py +183 -0
- aerograph_sdk-0.2.0.dist-info/METADATA +63 -0
- aerograph_sdk-0.2.0.dist-info/RECORD +11 -0
- aerograph_sdk-0.2.0.dist-info/WHEEL +4 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"""
|
|
2
|
+
python/aerograph-sdk/src/aerograph_sdk/__init__.py
|
|
3
|
+
|
|
4
|
+
Public API for the aerograph-sdk package.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from aerograph_sdk.recorder import FlightRecorder, EmissionError
|
|
8
|
+
from aerograph_sdk.ids import new_trace_id, new_span_id
|
|
9
|
+
from aerograph_sdk.state_hash import get_deterministic_state_hash, compute_state_diff
|
|
10
|
+
from aerograph_sdk.events import compare_trace_events, sort_trace_events_deterministic
|
|
11
|
+
from aerograph_sdk.contracts import SCHEMA_VERSION
|
|
12
|
+
|
|
13
|
+
__version__ = "0.2.0"
|
|
14
|
+
|
|
15
|
+
__all__ = [
|
|
16
|
+
"FlightRecorder",
|
|
17
|
+
"EmissionError",
|
|
18
|
+
"new_trace_id",
|
|
19
|
+
"new_span_id",
|
|
20
|
+
"get_deterministic_state_hash",
|
|
21
|
+
"compute_state_diff",
|
|
22
|
+
"compare_trace_events",
|
|
23
|
+
"sort_trace_events_deterministic",
|
|
24
|
+
"SCHEMA_VERSION",
|
|
25
|
+
]
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"""
|
|
2
|
+
python/aerograph-sdk/src/aerograph_sdk/contracts/__init__.py
|
|
3
|
+
|
|
4
|
+
Public exports from the contracts subpackage.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from aerograph_sdk.contracts.generated import (
|
|
8
|
+
SCHEMA_VERSION,
|
|
9
|
+
TraceEventKind,
|
|
10
|
+
TraceEventStatus,
|
|
11
|
+
ActorKind,
|
|
12
|
+
LinkRel,
|
|
13
|
+
Actor,
|
|
14
|
+
AgentActor,
|
|
15
|
+
ToolActor,
|
|
16
|
+
SystemActor,
|
|
17
|
+
TraceLink,
|
|
18
|
+
StreamingTelemetry,
|
|
19
|
+
PromptPayload,
|
|
20
|
+
ResponsePayload,
|
|
21
|
+
ToolCallPayload,
|
|
22
|
+
ToolResultPayload,
|
|
23
|
+
HandoffPayload,
|
|
24
|
+
ErrorPayload,
|
|
25
|
+
RetrieverDocument,
|
|
26
|
+
RetrieverPayload,
|
|
27
|
+
StateSnapshotPayload,
|
|
28
|
+
CheckpointPayload,
|
|
29
|
+
PromptEvent,
|
|
30
|
+
ResponseEvent,
|
|
31
|
+
ToolCallEvent,
|
|
32
|
+
ToolResultEvent,
|
|
33
|
+
HandoffEvent,
|
|
34
|
+
ErrorEvent,
|
|
35
|
+
NoteEvent,
|
|
36
|
+
StateSnapshotEvent,
|
|
37
|
+
RetrieverEvent,
|
|
38
|
+
CheckpointEvent,
|
|
39
|
+
TraceEvent,
|
|
40
|
+
TraceMeta,
|
|
41
|
+
Trace,
|
|
42
|
+
TraceWithMeta,
|
|
43
|
+
TraceListResponse,
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
__all__ = [
|
|
47
|
+
"SCHEMA_VERSION",
|
|
48
|
+
"TraceEventKind",
|
|
49
|
+
"TraceEventStatus",
|
|
50
|
+
"ActorKind",
|
|
51
|
+
"LinkRel",
|
|
52
|
+
"Actor",
|
|
53
|
+
"AgentActor",
|
|
54
|
+
"ToolActor",
|
|
55
|
+
"SystemActor",
|
|
56
|
+
"TraceLink",
|
|
57
|
+
"StreamingTelemetry",
|
|
58
|
+
"PromptPayload",
|
|
59
|
+
"ResponsePayload",
|
|
60
|
+
"ToolCallPayload",
|
|
61
|
+
"ToolResultPayload",
|
|
62
|
+
"HandoffPayload",
|
|
63
|
+
"ErrorPayload",
|
|
64
|
+
"RetrieverDocument",
|
|
65
|
+
"RetrieverPayload",
|
|
66
|
+
"StateSnapshotPayload",
|
|
67
|
+
"CheckpointPayload",
|
|
68
|
+
"PromptEvent",
|
|
69
|
+
"ResponseEvent",
|
|
70
|
+
"ToolCallEvent",
|
|
71
|
+
"ToolResultEvent",
|
|
72
|
+
"HandoffEvent",
|
|
73
|
+
"ErrorEvent",
|
|
74
|
+
"NoteEvent",
|
|
75
|
+
"StateSnapshotEvent",
|
|
76
|
+
"RetrieverEvent",
|
|
77
|
+
"CheckpointEvent",
|
|
78
|
+
"TraceEvent",
|
|
79
|
+
"TraceMeta",
|
|
80
|
+
"Trace",
|
|
81
|
+
"TraceWithMeta",
|
|
82
|
+
"TraceListResponse",
|
|
83
|
+
]
|
|
@@ -0,0 +1,564 @@
|
|
|
1
|
+
# generated by datamodel-codegen:
|
|
2
|
+
# filename: trace-event.schema.json
|
|
3
|
+
|
|
4
|
+
from __future__ import annotations
|
|
5
|
+
|
|
6
|
+
from enum import Enum
|
|
7
|
+
from typing import Annotated, Any, Literal
|
|
8
|
+
|
|
9
|
+
from pydantic import AwareDatetime, BaseModel, ConfigDict, Field, RootModel
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class Model(RootModel[Any]):
|
|
13
|
+
root: Any
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class TraceEventKind(Enum):
|
|
17
|
+
prompt = "prompt"
|
|
18
|
+
response = "response"
|
|
19
|
+
tool_call = "tool_call"
|
|
20
|
+
tool_result = "tool_result"
|
|
21
|
+
handoff = "handoff"
|
|
22
|
+
error = "error"
|
|
23
|
+
note = "note"
|
|
24
|
+
state_snapshot = "state_snapshot"
|
|
25
|
+
retriever = "retriever"
|
|
26
|
+
checkpoint = "checkpoint"
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class TraceEventStatus(Enum):
|
|
30
|
+
ok = "ok"
|
|
31
|
+
error = "error"
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
class ActorKind(Enum):
|
|
35
|
+
agent = "agent"
|
|
36
|
+
tool = "tool"
|
|
37
|
+
system = "system"
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
class LinkRel(Enum):
|
|
41
|
+
follows = "follows"
|
|
42
|
+
caused_by = "caused_by"
|
|
43
|
+
handoff_to = "handoff_to"
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
class PromptPayload(BaseModel):
|
|
47
|
+
model_config = ConfigDict(
|
|
48
|
+
extra="forbid",
|
|
49
|
+
)
|
|
50
|
+
text: str
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
class StreamingTelemetry(BaseModel):
|
|
54
|
+
model_config = ConfigDict(
|
|
55
|
+
extra="forbid",
|
|
56
|
+
)
|
|
57
|
+
timeToFirstTokenMs: float
|
|
58
|
+
totalDurationMs: float
|
|
59
|
+
tokensPerSecond: float
|
|
60
|
+
tokenCount: float
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
class ToolCallPayload(BaseModel):
|
|
64
|
+
model_config = ConfigDict(
|
|
65
|
+
extra="forbid",
|
|
66
|
+
)
|
|
67
|
+
input: dict[str, Any]
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
class ToolResultPayload(BaseModel):
|
|
71
|
+
model_config = ConfigDict(
|
|
72
|
+
extra="forbid",
|
|
73
|
+
)
|
|
74
|
+
output: dict[str, Any]
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
class HandoffPayload(BaseModel):
|
|
78
|
+
model_config = ConfigDict(
|
|
79
|
+
extra="forbid",
|
|
80
|
+
)
|
|
81
|
+
fromAgentId: Annotated[str, Field(min_length=1)]
|
|
82
|
+
toAgentId: Annotated[str, Field(min_length=1)]
|
|
83
|
+
reason: str | None = None
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
class ErrorPayload(BaseModel):
|
|
87
|
+
model_config = ConfigDict(
|
|
88
|
+
extra="forbid",
|
|
89
|
+
)
|
|
90
|
+
message: Annotated[str, Field(min_length=1)]
|
|
91
|
+
details: dict[str, Any] = {}
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
class StateSnapshotPayload(BaseModel):
|
|
95
|
+
model_config = ConfigDict(
|
|
96
|
+
extra="forbid",
|
|
97
|
+
)
|
|
98
|
+
nodeName: str
|
|
99
|
+
stateHash: str
|
|
100
|
+
stateDiff: dict[str, Any]
|
|
101
|
+
removedKeys: list[str] | None = None
|
|
102
|
+
fullState: dict[str, Any]
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
class RetrieverDocument(BaseModel):
|
|
106
|
+
model_config = ConfigDict(
|
|
107
|
+
extra="forbid",
|
|
108
|
+
)
|
|
109
|
+
pageContent: str
|
|
110
|
+
metadata: dict[str, Any]
|
|
111
|
+
score: float | None = None
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
class CheckpointPayload(BaseModel):
|
|
115
|
+
model_config = ConfigDict(
|
|
116
|
+
extra="forbid",
|
|
117
|
+
)
|
|
118
|
+
checkpointId: str
|
|
119
|
+
reason: str
|
|
120
|
+
state: dict[str, Any]
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
class ParentSpanId(RootModel[str]):
|
|
124
|
+
root: Annotated[str, Field(min_length=1)]
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
class RootSpanId(RootModel[str]):
|
|
128
|
+
root: Annotated[str, Field(min_length=1)]
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
class DerivedFrom(BaseModel):
|
|
132
|
+
model_config = ConfigDict(
|
|
133
|
+
extra="forbid",
|
|
134
|
+
)
|
|
135
|
+
baseTraceId: Annotated[str, Field(min_length=1)]
|
|
136
|
+
forkedFromSpanId: Annotated[str, Field(min_length=1)]
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
class TraceMeta(BaseModel):
|
|
140
|
+
model_config = ConfigDict(
|
|
141
|
+
extra="forbid",
|
|
142
|
+
)
|
|
143
|
+
traceId: Annotated[str, Field(min_length=1)]
|
|
144
|
+
createdAt: AwareDatetime
|
|
145
|
+
updatedAt: AwareDatetime
|
|
146
|
+
eventCount: Annotated[int, Field(ge=0)]
|
|
147
|
+
rootSpanId: RootSpanId | None
|
|
148
|
+
derivedFrom: DerivedFrom | None = None
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
class Id(RootModel[str]):
|
|
152
|
+
root: Annotated[str, Field(min_length=1)]
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
class Name(RootModel[str]):
|
|
156
|
+
root: Annotated[str, Field(min_length=1)]
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
class AgentActor(BaseModel):
|
|
160
|
+
model_config = ConfigDict(
|
|
161
|
+
extra="forbid",
|
|
162
|
+
)
|
|
163
|
+
kind: Literal["agent"]
|
|
164
|
+
id: Annotated[str, Field(min_length=1)]
|
|
165
|
+
name: Annotated[str | None, Field(min_length=1)] = None
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
class OccurredAt(RootModel[AwareDatetime]):
|
|
169
|
+
root: AwareDatetime
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
class ParentSpanIdModel(RootModel[ParentSpanId | None]):
|
|
173
|
+
root: ParentSpanId | None
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
class SchemaVersion(RootModel[Literal["1.0.0"]]):
|
|
177
|
+
root: Literal["1.0.0"]
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
class SpanId(RootModel[str]):
|
|
181
|
+
root: Annotated[str, Field(min_length=1)]
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
class Title(RootModel[str]):
|
|
185
|
+
root: Annotated[str, Field(min_length=1)]
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
class TraceId(RootModel[str]):
|
|
189
|
+
root: Annotated[str, Field(min_length=1)]
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
class RetrieverPayload(BaseModel):
|
|
193
|
+
model_config = ConfigDict(
|
|
194
|
+
extra="forbid",
|
|
195
|
+
)
|
|
196
|
+
query: str
|
|
197
|
+
documents: list[RetrieverDocument]
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
class SystemActor(BaseModel):
|
|
201
|
+
model_config = ConfigDict(
|
|
202
|
+
extra="forbid",
|
|
203
|
+
)
|
|
204
|
+
kind: Literal["system"]
|
|
205
|
+
id: Annotated[str, Field(min_length=1)]
|
|
206
|
+
name: Annotated[str | None, Field(min_length=1)] = None
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
class ToolActor(BaseModel):
|
|
210
|
+
model_config = ConfigDict(
|
|
211
|
+
extra="forbid",
|
|
212
|
+
)
|
|
213
|
+
kind: Literal["tool"]
|
|
214
|
+
id: Annotated[str, Field(min_length=1)]
|
|
215
|
+
name: Annotated[str | None, Field(min_length=1)] = None
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
class TraceLink(BaseModel):
|
|
219
|
+
model_config = ConfigDict(
|
|
220
|
+
extra="forbid",
|
|
221
|
+
)
|
|
222
|
+
rel: LinkRel
|
|
223
|
+
spanId: Annotated[str, Field(min_length=1)]
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
class TraceMetaModel(BaseModel):
|
|
227
|
+
model_config = ConfigDict(
|
|
228
|
+
extra="forbid",
|
|
229
|
+
)
|
|
230
|
+
traceId: Annotated[str, Field(min_length=1)]
|
|
231
|
+
createdAt: AwareDatetime
|
|
232
|
+
updatedAt: AwareDatetime
|
|
233
|
+
eventCount: Annotated[int, Field(ge=0)]
|
|
234
|
+
rootSpanId: RootSpanId | None
|
|
235
|
+
derivedFrom: DerivedFrom | None = None
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
class Actor(BaseModel):
|
|
239
|
+
model_config = ConfigDict(
|
|
240
|
+
extra="forbid",
|
|
241
|
+
)
|
|
242
|
+
kind: ActorKind
|
|
243
|
+
id: Annotated[str, Field(min_length=1)]
|
|
244
|
+
name: Annotated[str | None, Field(min_length=1)] = None
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
class ResponsePayload(BaseModel):
|
|
248
|
+
model_config = ConfigDict(
|
|
249
|
+
extra="forbid",
|
|
250
|
+
)
|
|
251
|
+
text: str
|
|
252
|
+
streamingTelemetry: StreamingTelemetry | None = None
|
|
253
|
+
|
|
254
|
+
|
|
255
|
+
class PromptEvent(BaseModel):
|
|
256
|
+
model_config = ConfigDict(
|
|
257
|
+
extra="forbid",
|
|
258
|
+
)
|
|
259
|
+
schemaVersion: Literal["1.0.0"]
|
|
260
|
+
traceId: Annotated[str, Field(min_length=1)]
|
|
261
|
+
spanId: Annotated[str, Field(min_length=1)]
|
|
262
|
+
parentSpanId: ParentSpanId | None
|
|
263
|
+
occurredAt: AwareDatetime
|
|
264
|
+
actor: AgentActor
|
|
265
|
+
status: TraceEventStatus
|
|
266
|
+
title: Annotated[str | None, Field(min_length=1)] = None
|
|
267
|
+
links: Annotated[list[TraceLink], Field(validate_default=True)] = []
|
|
268
|
+
kind: Literal["prompt"]
|
|
269
|
+
payload: PromptPayload
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
class TraceListResponse(BaseModel):
|
|
273
|
+
model_config = ConfigDict(
|
|
274
|
+
extra="forbid",
|
|
275
|
+
)
|
|
276
|
+
traces: list[TraceMetaModel]
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
class PromptEventModel(BaseModel):
|
|
280
|
+
model_config = ConfigDict(
|
|
281
|
+
extra="forbid",
|
|
282
|
+
)
|
|
283
|
+
schemaVersion: Literal["1.0.0"]
|
|
284
|
+
traceId: Annotated[str, Field(min_length=1)]
|
|
285
|
+
spanId: Annotated[str, Field(min_length=1)]
|
|
286
|
+
parentSpanId: ParentSpanId | None
|
|
287
|
+
occurredAt: AwareDatetime
|
|
288
|
+
actor: AgentActor
|
|
289
|
+
status: TraceEventStatus
|
|
290
|
+
title: Annotated[str | None, Field(min_length=1)] = None
|
|
291
|
+
links: Annotated[list[TraceLink], Field(validate_default=True)] = []
|
|
292
|
+
kind: Literal["prompt"]
|
|
293
|
+
payload: PromptPayload
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
class Links(RootModel[list[TraceLink] | None]):
|
|
297
|
+
root: Annotated[list[TraceLink] | None, Field(validate_default=True)] = []
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
class RetrieverEvent(BaseModel):
|
|
301
|
+
model_config = ConfigDict(
|
|
302
|
+
extra="forbid",
|
|
303
|
+
)
|
|
304
|
+
schemaVersion: Literal["1.0.0"]
|
|
305
|
+
traceId: Annotated[str, Field(min_length=1)]
|
|
306
|
+
spanId: Annotated[str, Field(min_length=1)]
|
|
307
|
+
parentSpanId: ParentSpanId | None
|
|
308
|
+
occurredAt: AwareDatetime
|
|
309
|
+
actor: ToolActor
|
|
310
|
+
status: TraceEventStatus
|
|
311
|
+
title: Annotated[str | None, Field(min_length=1)] = None
|
|
312
|
+
links: list[TraceLink] | None = None
|
|
313
|
+
kind: Literal["retriever"]
|
|
314
|
+
payload: RetrieverPayload
|
|
315
|
+
|
|
316
|
+
|
|
317
|
+
class StateSnapshotEvent(BaseModel):
|
|
318
|
+
model_config = ConfigDict(
|
|
319
|
+
extra="forbid",
|
|
320
|
+
)
|
|
321
|
+
schemaVersion: Literal["1.0.0"]
|
|
322
|
+
traceId: Annotated[str, Field(min_length=1)]
|
|
323
|
+
spanId: Annotated[str, Field(min_length=1)]
|
|
324
|
+
parentSpanId: ParentSpanId | None
|
|
325
|
+
occurredAt: AwareDatetime
|
|
326
|
+
actor: SystemActor
|
|
327
|
+
status: TraceEventStatus
|
|
328
|
+
title: Annotated[str | None, Field(min_length=1)] = None
|
|
329
|
+
links: list[TraceLink] | None = None
|
|
330
|
+
kind: Literal["state_snapshot"]
|
|
331
|
+
payload: StateSnapshotPayload
|
|
332
|
+
|
|
333
|
+
|
|
334
|
+
class ToolCallEvent(BaseModel):
|
|
335
|
+
model_config = ConfigDict(
|
|
336
|
+
extra="forbid",
|
|
337
|
+
)
|
|
338
|
+
schemaVersion: Literal["1.0.0"]
|
|
339
|
+
traceId: Annotated[str, Field(min_length=1)]
|
|
340
|
+
spanId: Annotated[str, Field(min_length=1)]
|
|
341
|
+
parentSpanId: ParentSpanId | None
|
|
342
|
+
occurredAt: AwareDatetime
|
|
343
|
+
actor: ToolActor
|
|
344
|
+
status: TraceEventStatus
|
|
345
|
+
title: Annotated[str | None, Field(min_length=1)] = None
|
|
346
|
+
links: list[TraceLink] | None = None
|
|
347
|
+
kind: Literal["tool_call"]
|
|
348
|
+
payload: ToolCallPayload
|
|
349
|
+
|
|
350
|
+
|
|
351
|
+
class ToolResultEvent(BaseModel):
|
|
352
|
+
model_config = ConfigDict(
|
|
353
|
+
extra="forbid",
|
|
354
|
+
)
|
|
355
|
+
schemaVersion: Literal["1.0.0"]
|
|
356
|
+
traceId: Annotated[str, Field(min_length=1)]
|
|
357
|
+
spanId: Annotated[str, Field(min_length=1)]
|
|
358
|
+
parentSpanId: ParentSpanId | None
|
|
359
|
+
occurredAt: AwareDatetime
|
|
360
|
+
actor: ToolActor
|
|
361
|
+
status: TraceEventStatus
|
|
362
|
+
title: Annotated[str | None, Field(min_length=1)] = None
|
|
363
|
+
links: list[TraceLink] | None = None
|
|
364
|
+
kind: Literal["tool_result"]
|
|
365
|
+
payload: ToolResultPayload
|
|
366
|
+
|
|
367
|
+
|
|
368
|
+
class ResponseEvent(BaseModel):
|
|
369
|
+
model_config = ConfigDict(
|
|
370
|
+
extra="forbid",
|
|
371
|
+
)
|
|
372
|
+
schemaVersion: Literal["1.0.0"]
|
|
373
|
+
traceId: Annotated[str, Field(min_length=1)]
|
|
374
|
+
spanId: Annotated[str, Field(min_length=1)]
|
|
375
|
+
parentSpanId: ParentSpanId | None
|
|
376
|
+
occurredAt: AwareDatetime
|
|
377
|
+
actor: AgentActor
|
|
378
|
+
status: TraceEventStatus
|
|
379
|
+
title: Annotated[str | None, Field(min_length=1)] = None
|
|
380
|
+
links: list[TraceLink] | None = None
|
|
381
|
+
kind: Literal["response"]
|
|
382
|
+
payload: ResponsePayload
|
|
383
|
+
|
|
384
|
+
|
|
385
|
+
class HandoffEvent(BaseModel):
|
|
386
|
+
model_config = ConfigDict(
|
|
387
|
+
extra="forbid",
|
|
388
|
+
)
|
|
389
|
+
schemaVersion: Literal["1.0.0"]
|
|
390
|
+
traceId: Annotated[str, Field(min_length=1)]
|
|
391
|
+
spanId: Annotated[str, Field(min_length=1)]
|
|
392
|
+
parentSpanId: ParentSpanId | None
|
|
393
|
+
occurredAt: AwareDatetime
|
|
394
|
+
actor: SystemActor
|
|
395
|
+
status: TraceEventStatus
|
|
396
|
+
title: Annotated[str | None, Field(min_length=1)] = None
|
|
397
|
+
links: list[TraceLink] | None = None
|
|
398
|
+
kind: Literal["handoff"]
|
|
399
|
+
payload: HandoffPayload
|
|
400
|
+
|
|
401
|
+
|
|
402
|
+
class ErrorEvent(BaseModel):
|
|
403
|
+
model_config = ConfigDict(
|
|
404
|
+
extra="forbid",
|
|
405
|
+
)
|
|
406
|
+
schemaVersion: Literal["1.0.0"]
|
|
407
|
+
traceId: Annotated[str, Field(min_length=1)]
|
|
408
|
+
spanId: Annotated[str, Field(min_length=1)]
|
|
409
|
+
parentSpanId: ParentSpanId | None
|
|
410
|
+
occurredAt: AwareDatetime
|
|
411
|
+
actor: Actor
|
|
412
|
+
status: TraceEventStatus
|
|
413
|
+
title: Annotated[str | None, Field(min_length=1)] = None
|
|
414
|
+
links: list[TraceLink] | None = None
|
|
415
|
+
kind: Literal["error"]
|
|
416
|
+
payload: ErrorPayload
|
|
417
|
+
|
|
418
|
+
|
|
419
|
+
class NoteEvent(BaseModel):
|
|
420
|
+
model_config = ConfigDict(
|
|
421
|
+
extra="forbid",
|
|
422
|
+
)
|
|
423
|
+
schemaVersion: Literal["1.0.0"]
|
|
424
|
+
traceId: Annotated[str, Field(min_length=1)]
|
|
425
|
+
spanId: Annotated[str, Field(min_length=1)]
|
|
426
|
+
parentSpanId: ParentSpanId | None
|
|
427
|
+
occurredAt: AwareDatetime
|
|
428
|
+
actor: Actor
|
|
429
|
+
status: TraceEventStatus
|
|
430
|
+
title: Annotated[str | None, Field(min_length=1)] = None
|
|
431
|
+
links: list[TraceLink] | None = None
|
|
432
|
+
kind: Literal["note"]
|
|
433
|
+
payload: dict[str, Any]
|
|
434
|
+
|
|
435
|
+
|
|
436
|
+
class CheckpointEvent(BaseModel):
|
|
437
|
+
model_config = ConfigDict(
|
|
438
|
+
extra="forbid",
|
|
439
|
+
)
|
|
440
|
+
schemaVersion: Literal["1.0.0"]
|
|
441
|
+
traceId: Annotated[str, Field(min_length=1)]
|
|
442
|
+
spanId: Annotated[str, Field(min_length=1)]
|
|
443
|
+
parentSpanId: ParentSpanId | None
|
|
444
|
+
occurredAt: AwareDatetime
|
|
445
|
+
actor: SystemActor
|
|
446
|
+
status: TraceEventStatus
|
|
447
|
+
title: Annotated[str | None, Field(min_length=1)] = None
|
|
448
|
+
links: list[TraceLink] | None = None
|
|
449
|
+
kind: Literal["checkpoint"]
|
|
450
|
+
payload: CheckpointPayload
|
|
451
|
+
|
|
452
|
+
|
|
453
|
+
class Trace(BaseModel):
|
|
454
|
+
model_config = ConfigDict(
|
|
455
|
+
extra="forbid",
|
|
456
|
+
)
|
|
457
|
+
traceId: Annotated[str, Field(min_length=1)]
|
|
458
|
+
createdAt: AwareDatetime
|
|
459
|
+
rootSpanId: RootSpanId | None
|
|
460
|
+
events: list[
|
|
461
|
+
PromptEventModel
|
|
462
|
+
| ResponseEvent
|
|
463
|
+
| ToolCallEvent
|
|
464
|
+
| ToolResultEvent
|
|
465
|
+
| HandoffEvent
|
|
466
|
+
| ErrorEvent
|
|
467
|
+
| NoteEvent
|
|
468
|
+
| StateSnapshotEvent
|
|
469
|
+
| RetrieverEvent
|
|
470
|
+
| CheckpointEvent
|
|
471
|
+
]
|
|
472
|
+
|
|
473
|
+
|
|
474
|
+
class TraceWithMeta(BaseModel):
|
|
475
|
+
model_config = ConfigDict(
|
|
476
|
+
extra="forbid",
|
|
477
|
+
)
|
|
478
|
+
meta: TraceMetaModel
|
|
479
|
+
events: list[
|
|
480
|
+
PromptEventModel
|
|
481
|
+
| ResponseEvent
|
|
482
|
+
| ToolCallEvent
|
|
483
|
+
| ToolResultEvent
|
|
484
|
+
| HandoffEvent
|
|
485
|
+
| ErrorEvent
|
|
486
|
+
| NoteEvent
|
|
487
|
+
| StateSnapshotEvent
|
|
488
|
+
| RetrieverEvent
|
|
489
|
+
| CheckpointEvent
|
|
490
|
+
]
|
|
491
|
+
|
|
492
|
+
|
|
493
|
+
class AeroGraph(BaseModel):
|
|
494
|
+
model_config = ConfigDict(
|
|
495
|
+
extra="forbid",
|
|
496
|
+
)
|
|
497
|
+
TraceEventKind_1: Annotated[TraceEventKind, Field(alias="TraceEventKind")]
|
|
498
|
+
TraceEventStatus_1: Annotated[TraceEventStatus, Field(alias="TraceEventStatus")]
|
|
499
|
+
ActorKind_1: Annotated[ActorKind, Field(alias="ActorKind")]
|
|
500
|
+
Actor_1: Annotated[Actor, Field(alias="Actor")]
|
|
501
|
+
AgentActor_1: Annotated[AgentActor, Field(alias="AgentActor")]
|
|
502
|
+
ToolActor_1: Annotated[ToolActor, Field(alias="ToolActor")]
|
|
503
|
+
SystemActor_1: Annotated[SystemActor, Field(alias="SystemActor")]
|
|
504
|
+
LinkRel_1: Annotated[LinkRel, Field(alias="LinkRel")]
|
|
505
|
+
TraceLink_1: Annotated[TraceLink, Field(alias="TraceLink")]
|
|
506
|
+
PromptPayload_1: Annotated[PromptPayload, Field(alias="PromptPayload")]
|
|
507
|
+
StreamingTelemetry_1: Annotated[
|
|
508
|
+
StreamingTelemetry, Field(alias="StreamingTelemetry")
|
|
509
|
+
]
|
|
510
|
+
ResponsePayload_1: Annotated[ResponsePayload, Field(alias="ResponsePayload")]
|
|
511
|
+
ToolCallPayload_1: Annotated[ToolCallPayload, Field(alias="ToolCallPayload")]
|
|
512
|
+
ToolResultPayload_1: Annotated[ToolResultPayload, Field(alias="ToolResultPayload")]
|
|
513
|
+
HandoffPayload_1: Annotated[HandoffPayload, Field(alias="HandoffPayload")]
|
|
514
|
+
ErrorPayload_1: Annotated[ErrorPayload, Field(alias="ErrorPayload")]
|
|
515
|
+
StateSnapshotPayload_1: Annotated[
|
|
516
|
+
StateSnapshotPayload, Field(alias="StateSnapshotPayload")
|
|
517
|
+
]
|
|
518
|
+
RetrieverDocument_1: Annotated[RetrieverDocument, Field(alias="RetrieverDocument")]
|
|
519
|
+
RetrieverPayload_1: Annotated[RetrieverPayload, Field(alias="RetrieverPayload")]
|
|
520
|
+
CheckpointPayload_1: Annotated[CheckpointPayload, Field(alias="CheckpointPayload")]
|
|
521
|
+
PromptEvent_1: Annotated[PromptEvent, Field(alias="PromptEvent")]
|
|
522
|
+
ResponseEvent_1: Annotated[ResponseEvent, Field(alias="ResponseEvent")]
|
|
523
|
+
ToolCallEvent_1: Annotated[ToolCallEvent, Field(alias="ToolCallEvent")]
|
|
524
|
+
ToolResultEvent_1: Annotated[ToolResultEvent, Field(alias="ToolResultEvent")]
|
|
525
|
+
HandoffEvent_1: Annotated[HandoffEvent, Field(alias="HandoffEvent")]
|
|
526
|
+
ErrorEvent_1: Annotated[ErrorEvent, Field(alias="ErrorEvent")]
|
|
527
|
+
NoteEvent_1: Annotated[NoteEvent, Field(alias="NoteEvent")]
|
|
528
|
+
StateSnapshotEvent_1: Annotated[
|
|
529
|
+
StateSnapshotEvent, Field(alias="StateSnapshotEvent")
|
|
530
|
+
]
|
|
531
|
+
RetrieverEvent_1: Annotated[RetrieverEvent, Field(alias="RetrieverEvent")]
|
|
532
|
+
CheckpointEvent_1: Annotated[CheckpointEvent, Field(alias="CheckpointEvent")]
|
|
533
|
+
TraceEvent: (
|
|
534
|
+
PromptEventModel
|
|
535
|
+
| ResponseEvent
|
|
536
|
+
| ToolCallEvent
|
|
537
|
+
| ToolResultEvent
|
|
538
|
+
| HandoffEvent
|
|
539
|
+
| ErrorEvent
|
|
540
|
+
| NoteEvent
|
|
541
|
+
| StateSnapshotEvent
|
|
542
|
+
| RetrieverEvent
|
|
543
|
+
| CheckpointEvent
|
|
544
|
+
)
|
|
545
|
+
Trace_1: Annotated[Trace, Field(alias="Trace")]
|
|
546
|
+
TraceMeta_1: Annotated[TraceMeta, Field(alias="TraceMeta")]
|
|
547
|
+
TraceWithMeta_1: Annotated[TraceWithMeta, Field(alias="TraceWithMeta")]
|
|
548
|
+
TraceListResponse_1: Annotated[TraceListResponse, Field(alias="TraceListResponse")]
|
|
549
|
+
|
|
550
|
+
|
|
551
|
+
# Injected by generate_contracts.py
|
|
552
|
+
SCHEMA_VERSION = "1.0.0"
|
|
553
|
+
TraceEvent = (
|
|
554
|
+
PromptEvent
|
|
555
|
+
| ResponseEvent
|
|
556
|
+
| ToolCallEvent
|
|
557
|
+
| ToolResultEvent
|
|
558
|
+
| HandoffEvent
|
|
559
|
+
| ErrorEvent
|
|
560
|
+
| NoteEvent
|
|
561
|
+
| StateSnapshotEvent
|
|
562
|
+
| RetrieverEvent
|
|
563
|
+
| CheckpointEvent
|
|
564
|
+
)
|