Skip to content

Commit 710c63f

Browse files
feat(api): api update
1 parent b5c4787 commit 710c63f

7 files changed

Lines changed: 41 additions & 4 deletions

File tree

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 45
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/sgp%2Fagentex-sdk-636aa63c588134e6f47fc45212049593d91f810a9c7bd8d7a57810cf1b5ffc92.yml
3-
openapi_spec_hash: c76a42d4510aeafd896bc0d596f17af4
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/sgp%2Fagentex-sdk-eeb5bf63b18d948611eec48d0225e9bba63b170f64eeeb35d91825724b7cf6c3.yml
3+
openapi_spec_hash: df8eb2eb2e32b18c1e3a5d8879d14270
44
config_hash: fb079ef7936611b032568661b8165f19

src/agentex/resources/spans.py

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ def create(
5757
input: Union[Dict[str, object], Iterable[Dict[str, object]], None] | Omit = omit,
5858
output: Union[Dict[str, object], Iterable[Dict[str, object]], None] | Omit = omit,
5959
parent_id: Optional[str] | Omit = omit,
60+
task_id: Optional[str] | Omit = omit,
6061
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
6162
# The extra values given here take precedence over values defined on the client or passed to this method.
6263
extra_headers: Headers | None = None,
@@ -86,6 +87,8 @@ def create(
8687
8788
parent_id: ID of the parent span if this is a child span in a trace
8889
90+
task_id: ID of the task this span belongs to
91+
8992
extra_headers: Send extra headers
9093
9194
extra_query: Add additional query parameters to the request
@@ -107,6 +110,7 @@ def create(
107110
"input": input,
108111
"output": output,
109112
"parent_id": parent_id,
113+
"task_id": task_id,
110114
},
111115
span_create_params.SpanCreateParams,
112116
),
@@ -160,6 +164,7 @@ def update(
160164
output: Union[Dict[str, object], Iterable[Dict[str, object]], None] | Omit = omit,
161165
parent_id: Optional[str] | Omit = omit,
162166
start_time: Union[str, datetime, None] | Omit = omit,
167+
task_id: Optional[str] | Omit = omit,
163168
trace_id: Optional[str] | Omit = omit,
164169
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
165170
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -186,6 +191,8 @@ def update(
186191
187192
start_time: The time the span started
188193
194+
task_id: ID of the task this span belongs to
195+
189196
trace_id: Unique identifier for the trace this span belongs to
190197
191198
extra_headers: Send extra headers
@@ -209,6 +216,7 @@ def update(
209216
"output": output,
210217
"parent_id": parent_id,
211218
"start_time": start_time,
219+
"task_id": task_id,
212220
"trace_id": trace_id,
213221
},
214222
span_update_params.SpanUpdateParams,
@@ -226,6 +234,7 @@ def list(
226234
order_by: Optional[str] | Omit = omit,
227235
order_direction: str | Omit = omit,
228236
page_number: int | Omit = omit,
237+
task_id: Optional[str] | Omit = omit,
229238
trace_id: Optional[str] | Omit = omit,
230239
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
231240
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -235,7 +244,7 @@ def list(
235244
timeout: float | httpx.Timeout | None | NotGiven = not_given,
236245
) -> SpanListResponse:
237246
"""
238-
List all spans for a given trace ID
247+
List spans, optionally filtered by trace_id and/or task_id
239248
240249
Args:
241250
extra_headers: Send extra headers
@@ -259,6 +268,7 @@ def list(
259268
"order_by": order_by,
260269
"order_direction": order_direction,
261270
"page_number": page_number,
271+
"task_id": task_id,
262272
"trace_id": trace_id,
263273
},
264274
span_list_params.SpanListParams,
@@ -300,6 +310,7 @@ async def create(
300310
input: Union[Dict[str, object], Iterable[Dict[str, object]], None] | Omit = omit,
301311
output: Union[Dict[str, object], Iterable[Dict[str, object]], None] | Omit = omit,
302312
parent_id: Optional[str] | Omit = omit,
313+
task_id: Optional[str] | Omit = omit,
303314
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
304315
# The extra values given here take precedence over values defined on the client or passed to this method.
305316
extra_headers: Headers | None = None,
@@ -329,6 +340,8 @@ async def create(
329340
330341
parent_id: ID of the parent span if this is a child span in a trace
331342
343+
task_id: ID of the task this span belongs to
344+
332345
extra_headers: Send extra headers
333346
334347
extra_query: Add additional query parameters to the request
@@ -350,6 +363,7 @@ async def create(
350363
"input": input,
351364
"output": output,
352365
"parent_id": parent_id,
366+
"task_id": task_id,
353367
},
354368
span_create_params.SpanCreateParams,
355369
),
@@ -403,6 +417,7 @@ async def update(
403417
output: Union[Dict[str, object], Iterable[Dict[str, object]], None] | Omit = omit,
404418
parent_id: Optional[str] | Omit = omit,
405419
start_time: Union[str, datetime, None] | Omit = omit,
420+
task_id: Optional[str] | Omit = omit,
406421
trace_id: Optional[str] | Omit = omit,
407422
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
408423
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -429,6 +444,8 @@ async def update(
429444
430445
start_time: The time the span started
431446
447+
task_id: ID of the task this span belongs to
448+
432449
trace_id: Unique identifier for the trace this span belongs to
433450
434451
extra_headers: Send extra headers
@@ -452,6 +469,7 @@ async def update(
452469
"output": output,
453470
"parent_id": parent_id,
454471
"start_time": start_time,
472+
"task_id": task_id,
455473
"trace_id": trace_id,
456474
},
457475
span_update_params.SpanUpdateParams,
@@ -469,6 +487,7 @@ async def list(
469487
order_by: Optional[str] | Omit = omit,
470488
order_direction: str | Omit = omit,
471489
page_number: int | Omit = omit,
490+
task_id: Optional[str] | Omit = omit,
472491
trace_id: Optional[str] | Omit = omit,
473492
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
474493
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -478,7 +497,7 @@ async def list(
478497
timeout: float | httpx.Timeout | None | NotGiven = not_given,
479498
) -> SpanListResponse:
480499
"""
481-
List all spans for a given trace ID
500+
List spans, optionally filtered by trace_id and/or task_id
482501
483502
Args:
484503
extra_headers: Send extra headers
@@ -502,6 +521,7 @@ async def list(
502521
"order_by": order_by,
503522
"order_direction": order_direction,
504523
"page_number": page_number,
524+
"task_id": task_id,
505525
"trace_id": trace_id,
506526
},
507527
span_list_params.SpanListParams,

src/agentex/types/span.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,6 @@ class Span(BaseModel):
3434

3535
parent_id: Optional[str] = None
3636
"""ID of the parent span if this is a child span in a trace"""
37+
38+
task_id: Optional[str] = None
39+
"""ID of the task this span belongs to"""

src/agentex/types/span_create_params.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,6 @@ class SpanCreateParams(TypedDict, total=False):
3838

3939
parent_id: Optional[str]
4040
"""ID of the parent span if this is a child span in a trace"""
41+
42+
task_id: Optional[str]
43+
"""ID of the task this span belongs to"""

src/agentex/types/span_list_params.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,6 @@ class SpanListParams(TypedDict, total=False):
1717

1818
page_number: int
1919

20+
task_id: Optional[str]
21+
2022
trace_id: Optional[str]

src/agentex/types/span_update_params.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,8 @@ class SpanUpdateParams(TypedDict, total=False):
3333
start_time: Annotated[Union[str, datetime, None], PropertyInfo(format="iso8601")]
3434
"""The time the span started"""
3535

36+
task_id: Optional[str]
37+
"""ID of the task this span belongs to"""
38+
3639
trace_id: Optional[str]
3740
"""Unique identifier for the trace this span belongs to"""

tests/api_resources/test_spans.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ def test_method_create_with_all_params(self, client: Agentex) -> None:
4242
input={"foo": "bar"},
4343
output={"foo": "bar"},
4444
parent_id="parent_id",
45+
task_id="task_id",
4546
)
4647
assert_matches_type(Span, span, path=["response"])
4748

@@ -137,6 +138,7 @@ def test_method_update_with_all_params(self, client: Agentex) -> None:
137138
output={"foo": "bar"},
138139
parent_id="parent_id",
139140
start_time=parse_datetime("2019-12-27T18:11:19.117Z"),
141+
task_id="task_id",
140142
trace_id="trace_id",
141143
)
142144
assert_matches_type(Span, span, path=["response"])
@@ -189,6 +191,7 @@ def test_method_list_with_all_params(self, client: Agentex) -> None:
189191
order_by="order_by",
190192
order_direction="order_direction",
191193
page_number=1,
194+
task_id="task_id",
192195
trace_id="trace_id",
193196
)
194197
assert_matches_type(SpanListResponse, span, path=["response"])
@@ -244,6 +247,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncAgentex) -
244247
input={"foo": "bar"},
245248
output={"foo": "bar"},
246249
parent_id="parent_id",
250+
task_id="task_id",
247251
)
248252
assert_matches_type(Span, span, path=["response"])
249253

@@ -339,6 +343,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncAgentex) -
339343
output={"foo": "bar"},
340344
parent_id="parent_id",
341345
start_time=parse_datetime("2019-12-27T18:11:19.117Z"),
346+
task_id="task_id",
342347
trace_id="trace_id",
343348
)
344349
assert_matches_type(Span, span, path=["response"])
@@ -391,6 +396,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncAgentex) ->
391396
order_by="order_by",
392397
order_direction="order_direction",
393398
page_number=1,
399+
task_id="task_id",
394400
trace_id="trace_id",
395401
)
396402
assert_matches_type(SpanListResponse, span, path=["response"])

0 commit comments

Comments
 (0)