agentex-sdk 0.6.7__py3-none-any.whl → 0.7.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.
- agentex/_streaming.py +12 -10
- agentex/_types.py +3 -2
- agentex/_version.py +1 -1
- agentex/lib/core/temporal/plugins/claude_agents/__init__.py +72 -0
- agentex/lib/core/temporal/plugins/claude_agents/activities.py +154 -0
- agentex/lib/core/temporal/plugins/claude_agents/hooks/__init__.py +11 -0
- agentex/lib/core/temporal/plugins/claude_agents/hooks/hooks.py +212 -0
- agentex/lib/core/temporal/plugins/claude_agents/message_handler.py +178 -0
- agentex/lib/core/temporal/plugins/openai_agents/interceptors/context_interceptor.py +4 -2
- agentex/lib/environment_variables.py +6 -0
- agentex/lib/utils/completions.py +14 -0
- agentex/resources/agents.py +16 -0
- agentex/resources/messages/messages.py +163 -3
- agentex/resources/spans.py +8 -0
- agentex/resources/states.py +16 -0
- agentex/resources/tasks.py +8 -0
- agentex/resources/tracker.py +16 -0
- agentex/types/__init__.py +2 -0
- agentex/types/agent_list_params.py +6 -0
- agentex/types/agent_rpc_result.py +8 -0
- agentex/types/data_delta.py +2 -0
- agentex/types/message_list_paginated_params.py +19 -0
- agentex/types/message_list_paginated_response.py +21 -0
- agentex/types/message_list_params.py +5 -0
- agentex/types/reasoning_content_delta.py +2 -0
- agentex/types/reasoning_summary_delta.py +2 -0
- agentex/types/span_list_params.py +4 -0
- agentex/types/state.py +10 -0
- agentex/types/state_list_params.py +6 -0
- agentex/types/task_list_params.py +4 -0
- agentex/types/task_list_response.py +2 -0
- agentex/types/task_message.py +6 -0
- agentex/types/task_message_update.py +8 -0
- agentex/types/task_retrieve_by_name_response.py +2 -0
- agentex/types/task_retrieve_response.py +2 -0
- agentex/types/text_content.py +2 -0
- agentex/types/text_content_param.py +2 -0
- agentex/types/text_delta.py +2 -0
- agentex/types/tool_request_delta.py +2 -0
- agentex/types/tool_response_delta.py +2 -0
- agentex/types/tracker_list_params.py +6 -0
- {agentex_sdk-0.6.7.dist-info → agentex_sdk-0.7.1.dist-info}/METADATA +5 -2
- {agentex_sdk-0.6.7.dist-info → agentex_sdk-0.7.1.dist-info}/RECORD +46 -39
- {agentex_sdk-0.6.7.dist-info → agentex_sdk-0.7.1.dist-info}/WHEEL +0 -0
- {agentex_sdk-0.6.7.dist-info → agentex_sdk-0.7.1.dist-info}/entry_points.txt +0 -0
- {agentex_sdk-0.6.7.dist-info → agentex_sdk-0.7.1.dist-info}/licenses/LICENSE +0 -0
|
@@ -85,10 +85,12 @@ class ContextWorkflowOutboundInterceptor(WorkflowOutboundInterceptor):
|
|
|
85
85
|
def start_activity(self, input: StartActivityInput) -> workflow.ActivityHandle:
|
|
86
86
|
"""Add task_id, trace_id, and parent_span_id to headers when starting model activities."""
|
|
87
87
|
|
|
88
|
-
# Only add headers for
|
|
88
|
+
# Only add headers for model activity calls (OpenAI and Claude)
|
|
89
89
|
activity_name = str(input.activity) if hasattr(input, 'activity') else ""
|
|
90
90
|
|
|
91
|
-
if "invoke_model_activity" in activity_name or
|
|
91
|
+
if ("invoke_model_activity" in activity_name or
|
|
92
|
+
"invoke-model-activity" in activity_name or
|
|
93
|
+
"run_claude_agent_activity" in activity_name):
|
|
92
94
|
# Get task_id, trace_id, and parent_span_id from workflow instance instead of inbound interceptor
|
|
93
95
|
try:
|
|
94
96
|
workflow_instance = workflow.instance()
|
|
@@ -39,6 +39,9 @@ class EnvVarKeys(str, Enum):
|
|
|
39
39
|
# Build Information
|
|
40
40
|
BUILD_INFO_PATH = "BUILD_INFO_PATH"
|
|
41
41
|
AGENT_INPUT_TYPE = "AGENT_INPUT_TYPE"
|
|
42
|
+
# Claude Agents SDK Configuration
|
|
43
|
+
ANTHROPIC_API_KEY = "ANTHROPIC_API_KEY"
|
|
44
|
+
CLAUDE_WORKSPACE_ROOT = "CLAUDE_WORKSPACE_ROOT"
|
|
42
45
|
|
|
43
46
|
|
|
44
47
|
class Environment(str, Enum):
|
|
@@ -75,6 +78,9 @@ class EnvironmentVariables(BaseModel):
|
|
|
75
78
|
AUTH_PRINCIPAL_B64: str | None = None
|
|
76
79
|
# Build Information
|
|
77
80
|
BUILD_INFO_PATH: str | None = None
|
|
81
|
+
# Claude Agents SDK Configuration
|
|
82
|
+
ANTHROPIC_API_KEY: str | None = None
|
|
83
|
+
CLAUDE_WORKSPACE_ROOT: str | None = None # Defaults to project/workspace if not set
|
|
78
84
|
|
|
79
85
|
@classmethod
|
|
80
86
|
def refresh(cls) -> EnvironmentVariables:
|
agentex/lib/utils/completions.py
CHANGED
|
@@ -6,6 +6,7 @@ from functools import reduce, singledispatch
|
|
|
6
6
|
|
|
7
7
|
from agentex.lib.types.llm_messages import (
|
|
8
8
|
Delta,
|
|
9
|
+
Usage,
|
|
9
10
|
Choice,
|
|
10
11
|
ToolCall,
|
|
11
12
|
Completion,
|
|
@@ -21,6 +22,8 @@ def _concat_chunks(_a: None, b: Any):
|
|
|
21
22
|
@_concat_chunks.register
|
|
22
23
|
def _(a: Completion, b: Completion) -> Completion:
|
|
23
24
|
a.choices = [_concat_chunks(*c) for c in zip(a.choices, b.choices, strict=False)]
|
|
25
|
+
a.usage = _concat_chunks(a.usage, b.usage)
|
|
26
|
+
|
|
24
27
|
return a
|
|
25
28
|
|
|
26
29
|
|
|
@@ -35,6 +38,17 @@ def _(a: Choice, b: Choice) -> Choice:
|
|
|
35
38
|
a.finish_reason = a.finish_reason or b.finish_reason
|
|
36
39
|
return a
|
|
37
40
|
|
|
41
|
+
@_concat_chunks.register
|
|
42
|
+
def _(a: Usage | None, b: Usage | None) -> Usage | None:
|
|
43
|
+
if a is not None and b is not None:
|
|
44
|
+
return Usage(
|
|
45
|
+
prompt_tokens=a.prompt_tokens + b.prompt_tokens,
|
|
46
|
+
completion_tokens=a.completion_tokens + b.completion_tokens,
|
|
47
|
+
total_tokens=a.total_tokens + b.total_tokens,
|
|
48
|
+
)
|
|
49
|
+
else:
|
|
50
|
+
return a or b
|
|
51
|
+
|
|
38
52
|
|
|
39
53
|
@_concat_chunks.register
|
|
40
54
|
def _(a: Delta, b: Delta) -> Delta:
|
agentex/resources/agents.py
CHANGED
|
@@ -93,6 +93,8 @@ class AgentsResource(SyncAPIResource):
|
|
|
93
93
|
self,
|
|
94
94
|
*,
|
|
95
95
|
limit: int | Omit = omit,
|
|
96
|
+
order_by: Optional[str] | Omit = omit,
|
|
97
|
+
order_direction: str | Omit = omit,
|
|
96
98
|
page_number: int | Omit = omit,
|
|
97
99
|
task_id: Optional[str] | Omit = omit,
|
|
98
100
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
@@ -108,6 +110,10 @@ class AgentsResource(SyncAPIResource):
|
|
|
108
110
|
Args:
|
|
109
111
|
limit: Limit
|
|
110
112
|
|
|
113
|
+
order_by: Field to order by
|
|
114
|
+
|
|
115
|
+
order_direction: Order direction (asc or desc)
|
|
116
|
+
|
|
111
117
|
page_number: Page number
|
|
112
118
|
|
|
113
119
|
task_id: Task ID
|
|
@@ -130,6 +136,8 @@ class AgentsResource(SyncAPIResource):
|
|
|
130
136
|
query=maybe_transform(
|
|
131
137
|
{
|
|
132
138
|
"limit": limit,
|
|
139
|
+
"order_by": order_by,
|
|
140
|
+
"order_direction": order_direction,
|
|
133
141
|
"page_number": page_number,
|
|
134
142
|
"task_id": task_id,
|
|
135
143
|
},
|
|
@@ -653,6 +661,8 @@ class AsyncAgentsResource(AsyncAPIResource):
|
|
|
653
661
|
self,
|
|
654
662
|
*,
|
|
655
663
|
limit: int | Omit = omit,
|
|
664
|
+
order_by: Optional[str] | Omit = omit,
|
|
665
|
+
order_direction: str | Omit = omit,
|
|
656
666
|
page_number: int | Omit = omit,
|
|
657
667
|
task_id: Optional[str] | Omit = omit,
|
|
658
668
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
@@ -668,6 +678,10 @@ class AsyncAgentsResource(AsyncAPIResource):
|
|
|
668
678
|
Args:
|
|
669
679
|
limit: Limit
|
|
670
680
|
|
|
681
|
+
order_by: Field to order by
|
|
682
|
+
|
|
683
|
+
order_direction: Order direction (asc or desc)
|
|
684
|
+
|
|
671
685
|
page_number: Page number
|
|
672
686
|
|
|
673
687
|
task_id: Task ID
|
|
@@ -690,6 +704,8 @@ class AsyncAgentsResource(AsyncAPIResource):
|
|
|
690
704
|
query=await async_maybe_transform(
|
|
691
705
|
{
|
|
692
706
|
"limit": limit,
|
|
707
|
+
"order_by": order_by,
|
|
708
|
+
"order_direction": order_direction,
|
|
693
709
|
"page_number": page_number,
|
|
694
710
|
"task_id": task_id,
|
|
695
711
|
},
|
|
@@ -15,7 +15,12 @@ from .batch import (
|
|
|
15
15
|
BatchResourceWithStreamingResponse,
|
|
16
16
|
AsyncBatchResourceWithStreamingResponse,
|
|
17
17
|
)
|
|
18
|
-
from ...types import
|
|
18
|
+
from ...types import (
|
|
19
|
+
message_list_params,
|
|
20
|
+
message_create_params,
|
|
21
|
+
message_update_params,
|
|
22
|
+
message_list_paginated_params,
|
|
23
|
+
)
|
|
19
24
|
from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
|
|
20
25
|
from ..._utils import maybe_transform, async_maybe_transform
|
|
21
26
|
from ..._compat import cached_property
|
|
@@ -30,6 +35,7 @@ from ..._base_client import make_request_options
|
|
|
30
35
|
from ...types.task_message import TaskMessage
|
|
31
36
|
from ...types.message_list_response import MessageListResponse
|
|
32
37
|
from ...types.task_message_content_param import TaskMessageContentParam
|
|
38
|
+
from ...types.message_list_paginated_response import MessageListPaginatedResponse
|
|
33
39
|
|
|
34
40
|
__all__ = ["MessagesResource", "AsyncMessagesResource"]
|
|
35
41
|
|
|
@@ -181,6 +187,8 @@ class MessagesResource(SyncAPIResource):
|
|
|
181
187
|
*,
|
|
182
188
|
task_id: str,
|
|
183
189
|
limit: int | Omit = omit,
|
|
190
|
+
order_by: Optional[str] | Omit = omit,
|
|
191
|
+
order_direction: str | Omit = omit,
|
|
184
192
|
page_number: int | Omit = omit,
|
|
185
193
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
186
194
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
@@ -190,7 +198,10 @@ class MessagesResource(SyncAPIResource):
|
|
|
190
198
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
191
199
|
) -> MessageListResponse:
|
|
192
200
|
"""
|
|
193
|
-
List
|
|
201
|
+
List messages for a task with offset-based pagination.
|
|
202
|
+
|
|
203
|
+
For cursor-based pagination with infinite scroll support, use
|
|
204
|
+
/messages/paginated.
|
|
194
205
|
|
|
195
206
|
Args:
|
|
196
207
|
task_id: The task ID
|
|
@@ -214,6 +225,8 @@ class MessagesResource(SyncAPIResource):
|
|
|
214
225
|
{
|
|
215
226
|
"task_id": task_id,
|
|
216
227
|
"limit": limit,
|
|
228
|
+
"order_by": order_by,
|
|
229
|
+
"order_direction": order_direction,
|
|
217
230
|
"page_number": page_number,
|
|
218
231
|
},
|
|
219
232
|
message_list_params.MessageListParams,
|
|
@@ -222,6 +235,70 @@ class MessagesResource(SyncAPIResource):
|
|
|
222
235
|
cast_to=MessageListResponse,
|
|
223
236
|
)
|
|
224
237
|
|
|
238
|
+
def list_paginated(
|
|
239
|
+
self,
|
|
240
|
+
*,
|
|
241
|
+
task_id: str,
|
|
242
|
+
cursor: Optional[str] | Omit = omit,
|
|
243
|
+
direction: Literal["older", "newer"] | Omit = omit,
|
|
244
|
+
limit: int | Omit = omit,
|
|
245
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
246
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
247
|
+
extra_headers: Headers | None = None,
|
|
248
|
+
extra_query: Query | None = None,
|
|
249
|
+
extra_body: Body | None = None,
|
|
250
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
251
|
+
) -> MessageListPaginatedResponse:
|
|
252
|
+
"""
|
|
253
|
+
List messages for a task with cursor-based pagination.
|
|
254
|
+
|
|
255
|
+
This endpoint is designed for infinite scroll UIs where new messages may arrive
|
|
256
|
+
while paginating through older ones.
|
|
257
|
+
|
|
258
|
+
Args: task_id: The task ID to filter messages by limit: Maximum number of
|
|
259
|
+
messages to return (default: 50) cursor: Opaque cursor string for pagination.
|
|
260
|
+
Pass the `next_cursor` from a previous response to get the next page. direction:
|
|
261
|
+
Pagination direction - "older" to get older messages (default), "newer" to get
|
|
262
|
+
newer messages.
|
|
263
|
+
|
|
264
|
+
Returns: PaginatedMessagesResponse with: - data: List of messages (newest first
|
|
265
|
+
when direction="older") - next_cursor: Cursor for fetching the next page (null
|
|
266
|
+
if no more pages) - has_more: Whether there are more messages to fetch
|
|
267
|
+
|
|
268
|
+
Example: First request: GET /messages/paginated?task_id=xxx&limit=50 Next page:
|
|
269
|
+
GET /messages/paginated?task_id=xxx&limit=50&cursor=<next_cursor>
|
|
270
|
+
|
|
271
|
+
Args:
|
|
272
|
+
task_id: The task ID
|
|
273
|
+
|
|
274
|
+
extra_headers: Send extra headers
|
|
275
|
+
|
|
276
|
+
extra_query: Add additional query parameters to the request
|
|
277
|
+
|
|
278
|
+
extra_body: Add additional JSON properties to the request
|
|
279
|
+
|
|
280
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
281
|
+
"""
|
|
282
|
+
return self._get(
|
|
283
|
+
"/messages/paginated",
|
|
284
|
+
options=make_request_options(
|
|
285
|
+
extra_headers=extra_headers,
|
|
286
|
+
extra_query=extra_query,
|
|
287
|
+
extra_body=extra_body,
|
|
288
|
+
timeout=timeout,
|
|
289
|
+
query=maybe_transform(
|
|
290
|
+
{
|
|
291
|
+
"task_id": task_id,
|
|
292
|
+
"cursor": cursor,
|
|
293
|
+
"direction": direction,
|
|
294
|
+
"limit": limit,
|
|
295
|
+
},
|
|
296
|
+
message_list_paginated_params.MessageListPaginatedParams,
|
|
297
|
+
),
|
|
298
|
+
),
|
|
299
|
+
cast_to=MessageListPaginatedResponse,
|
|
300
|
+
)
|
|
301
|
+
|
|
225
302
|
|
|
226
303
|
class AsyncMessagesResource(AsyncAPIResource):
|
|
227
304
|
@cached_property
|
|
@@ -370,6 +447,8 @@ class AsyncMessagesResource(AsyncAPIResource):
|
|
|
370
447
|
*,
|
|
371
448
|
task_id: str,
|
|
372
449
|
limit: int | Omit = omit,
|
|
450
|
+
order_by: Optional[str] | Omit = omit,
|
|
451
|
+
order_direction: str | Omit = omit,
|
|
373
452
|
page_number: int | Omit = omit,
|
|
374
453
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
375
454
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
@@ -379,7 +458,10 @@ class AsyncMessagesResource(AsyncAPIResource):
|
|
|
379
458
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
380
459
|
) -> MessageListResponse:
|
|
381
460
|
"""
|
|
382
|
-
List
|
|
461
|
+
List messages for a task with offset-based pagination.
|
|
462
|
+
|
|
463
|
+
For cursor-based pagination with infinite scroll support, use
|
|
464
|
+
/messages/paginated.
|
|
383
465
|
|
|
384
466
|
Args:
|
|
385
467
|
task_id: The task ID
|
|
@@ -403,6 +485,8 @@ class AsyncMessagesResource(AsyncAPIResource):
|
|
|
403
485
|
{
|
|
404
486
|
"task_id": task_id,
|
|
405
487
|
"limit": limit,
|
|
488
|
+
"order_by": order_by,
|
|
489
|
+
"order_direction": order_direction,
|
|
406
490
|
"page_number": page_number,
|
|
407
491
|
},
|
|
408
492
|
message_list_params.MessageListParams,
|
|
@@ -411,6 +495,70 @@ class AsyncMessagesResource(AsyncAPIResource):
|
|
|
411
495
|
cast_to=MessageListResponse,
|
|
412
496
|
)
|
|
413
497
|
|
|
498
|
+
async def list_paginated(
|
|
499
|
+
self,
|
|
500
|
+
*,
|
|
501
|
+
task_id: str,
|
|
502
|
+
cursor: Optional[str] | Omit = omit,
|
|
503
|
+
direction: Literal["older", "newer"] | Omit = omit,
|
|
504
|
+
limit: int | Omit = omit,
|
|
505
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
506
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
507
|
+
extra_headers: Headers | None = None,
|
|
508
|
+
extra_query: Query | None = None,
|
|
509
|
+
extra_body: Body | None = None,
|
|
510
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
511
|
+
) -> MessageListPaginatedResponse:
|
|
512
|
+
"""
|
|
513
|
+
List messages for a task with cursor-based pagination.
|
|
514
|
+
|
|
515
|
+
This endpoint is designed for infinite scroll UIs where new messages may arrive
|
|
516
|
+
while paginating through older ones.
|
|
517
|
+
|
|
518
|
+
Args: task_id: The task ID to filter messages by limit: Maximum number of
|
|
519
|
+
messages to return (default: 50) cursor: Opaque cursor string for pagination.
|
|
520
|
+
Pass the `next_cursor` from a previous response to get the next page. direction:
|
|
521
|
+
Pagination direction - "older" to get older messages (default), "newer" to get
|
|
522
|
+
newer messages.
|
|
523
|
+
|
|
524
|
+
Returns: PaginatedMessagesResponse with: - data: List of messages (newest first
|
|
525
|
+
when direction="older") - next_cursor: Cursor for fetching the next page (null
|
|
526
|
+
if no more pages) - has_more: Whether there are more messages to fetch
|
|
527
|
+
|
|
528
|
+
Example: First request: GET /messages/paginated?task_id=xxx&limit=50 Next page:
|
|
529
|
+
GET /messages/paginated?task_id=xxx&limit=50&cursor=<next_cursor>
|
|
530
|
+
|
|
531
|
+
Args:
|
|
532
|
+
task_id: The task ID
|
|
533
|
+
|
|
534
|
+
extra_headers: Send extra headers
|
|
535
|
+
|
|
536
|
+
extra_query: Add additional query parameters to the request
|
|
537
|
+
|
|
538
|
+
extra_body: Add additional JSON properties to the request
|
|
539
|
+
|
|
540
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
541
|
+
"""
|
|
542
|
+
return await self._get(
|
|
543
|
+
"/messages/paginated",
|
|
544
|
+
options=make_request_options(
|
|
545
|
+
extra_headers=extra_headers,
|
|
546
|
+
extra_query=extra_query,
|
|
547
|
+
extra_body=extra_body,
|
|
548
|
+
timeout=timeout,
|
|
549
|
+
query=await async_maybe_transform(
|
|
550
|
+
{
|
|
551
|
+
"task_id": task_id,
|
|
552
|
+
"cursor": cursor,
|
|
553
|
+
"direction": direction,
|
|
554
|
+
"limit": limit,
|
|
555
|
+
},
|
|
556
|
+
message_list_paginated_params.MessageListPaginatedParams,
|
|
557
|
+
),
|
|
558
|
+
),
|
|
559
|
+
cast_to=MessageListPaginatedResponse,
|
|
560
|
+
)
|
|
561
|
+
|
|
414
562
|
|
|
415
563
|
class MessagesResourceWithRawResponse:
|
|
416
564
|
def __init__(self, messages: MessagesResource) -> None:
|
|
@@ -428,6 +576,9 @@ class MessagesResourceWithRawResponse:
|
|
|
428
576
|
self.list = to_raw_response_wrapper(
|
|
429
577
|
messages.list,
|
|
430
578
|
)
|
|
579
|
+
self.list_paginated = to_raw_response_wrapper(
|
|
580
|
+
messages.list_paginated,
|
|
581
|
+
)
|
|
431
582
|
|
|
432
583
|
@cached_property
|
|
433
584
|
def batch(self) -> BatchResourceWithRawResponse:
|
|
@@ -450,6 +601,9 @@ class AsyncMessagesResourceWithRawResponse:
|
|
|
450
601
|
self.list = async_to_raw_response_wrapper(
|
|
451
602
|
messages.list,
|
|
452
603
|
)
|
|
604
|
+
self.list_paginated = async_to_raw_response_wrapper(
|
|
605
|
+
messages.list_paginated,
|
|
606
|
+
)
|
|
453
607
|
|
|
454
608
|
@cached_property
|
|
455
609
|
def batch(self) -> AsyncBatchResourceWithRawResponse:
|
|
@@ -472,6 +626,9 @@ class MessagesResourceWithStreamingResponse:
|
|
|
472
626
|
self.list = to_streamed_response_wrapper(
|
|
473
627
|
messages.list,
|
|
474
628
|
)
|
|
629
|
+
self.list_paginated = to_streamed_response_wrapper(
|
|
630
|
+
messages.list_paginated,
|
|
631
|
+
)
|
|
475
632
|
|
|
476
633
|
@cached_property
|
|
477
634
|
def batch(self) -> BatchResourceWithStreamingResponse:
|
|
@@ -494,6 +651,9 @@ class AsyncMessagesResourceWithStreamingResponse:
|
|
|
494
651
|
self.list = async_to_streamed_response_wrapper(
|
|
495
652
|
messages.list,
|
|
496
653
|
)
|
|
654
|
+
self.list_paginated = async_to_streamed_response_wrapper(
|
|
655
|
+
messages.list_paginated,
|
|
656
|
+
)
|
|
497
657
|
|
|
498
658
|
@cached_property
|
|
499
659
|
def batch(self) -> AsyncBatchResourceWithStreamingResponse:
|
agentex/resources/spans.py
CHANGED
|
@@ -223,6 +223,8 @@ class SpansResource(SyncAPIResource):
|
|
|
223
223
|
self,
|
|
224
224
|
*,
|
|
225
225
|
limit: int | Omit = omit,
|
|
226
|
+
order_by: Optional[str] | Omit = omit,
|
|
227
|
+
order_direction: str | Omit = omit,
|
|
226
228
|
page_number: int | Omit = omit,
|
|
227
229
|
trace_id: Optional[str] | Omit = omit,
|
|
228
230
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
@@ -254,6 +256,8 @@ class SpansResource(SyncAPIResource):
|
|
|
254
256
|
query=maybe_transform(
|
|
255
257
|
{
|
|
256
258
|
"limit": limit,
|
|
259
|
+
"order_by": order_by,
|
|
260
|
+
"order_direction": order_direction,
|
|
257
261
|
"page_number": page_number,
|
|
258
262
|
"trace_id": trace_id,
|
|
259
263
|
},
|
|
@@ -462,6 +466,8 @@ class AsyncSpansResource(AsyncAPIResource):
|
|
|
462
466
|
self,
|
|
463
467
|
*,
|
|
464
468
|
limit: int | Omit = omit,
|
|
469
|
+
order_by: Optional[str] | Omit = omit,
|
|
470
|
+
order_direction: str | Omit = omit,
|
|
465
471
|
page_number: int | Omit = omit,
|
|
466
472
|
trace_id: Optional[str] | Omit = omit,
|
|
467
473
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
@@ -493,6 +499,8 @@ class AsyncSpansResource(AsyncAPIResource):
|
|
|
493
499
|
query=await async_maybe_transform(
|
|
494
500
|
{
|
|
495
501
|
"limit": limit,
|
|
502
|
+
"order_by": order_by,
|
|
503
|
+
"order_direction": order_direction,
|
|
496
504
|
"page_number": page_number,
|
|
497
505
|
"trace_id": trace_id,
|
|
498
506
|
},
|
agentex/resources/states.py
CHANGED
|
@@ -167,6 +167,8 @@ class StatesResource(SyncAPIResource):
|
|
|
167
167
|
*,
|
|
168
168
|
agent_id: Optional[str] | Omit = omit,
|
|
169
169
|
limit: int | Omit = omit,
|
|
170
|
+
order_by: Optional[str] | Omit = omit,
|
|
171
|
+
order_direction: str | Omit = omit,
|
|
170
172
|
page_number: int | Omit = omit,
|
|
171
173
|
task_id: Optional[str] | Omit = omit,
|
|
172
174
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
@@ -184,6 +186,10 @@ class StatesResource(SyncAPIResource):
|
|
|
184
186
|
|
|
185
187
|
limit: Limit
|
|
186
188
|
|
|
189
|
+
order_by: Field to order by
|
|
190
|
+
|
|
191
|
+
order_direction: Order direction (asc or desc)
|
|
192
|
+
|
|
187
193
|
page_number: Page number
|
|
188
194
|
|
|
189
195
|
task_id: Task ID
|
|
@@ -207,6 +213,8 @@ class StatesResource(SyncAPIResource):
|
|
|
207
213
|
{
|
|
208
214
|
"agent_id": agent_id,
|
|
209
215
|
"limit": limit,
|
|
216
|
+
"order_by": order_by,
|
|
217
|
+
"order_direction": order_direction,
|
|
210
218
|
"page_number": page_number,
|
|
211
219
|
"task_id": task_id,
|
|
212
220
|
},
|
|
@@ -393,6 +401,8 @@ class AsyncStatesResource(AsyncAPIResource):
|
|
|
393
401
|
*,
|
|
394
402
|
agent_id: Optional[str] | Omit = omit,
|
|
395
403
|
limit: int | Omit = omit,
|
|
404
|
+
order_by: Optional[str] | Omit = omit,
|
|
405
|
+
order_direction: str | Omit = omit,
|
|
396
406
|
page_number: int | Omit = omit,
|
|
397
407
|
task_id: Optional[str] | Omit = omit,
|
|
398
408
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
@@ -410,6 +420,10 @@ class AsyncStatesResource(AsyncAPIResource):
|
|
|
410
420
|
|
|
411
421
|
limit: Limit
|
|
412
422
|
|
|
423
|
+
order_by: Field to order by
|
|
424
|
+
|
|
425
|
+
order_direction: Order direction (asc or desc)
|
|
426
|
+
|
|
413
427
|
page_number: Page number
|
|
414
428
|
|
|
415
429
|
task_id: Task ID
|
|
@@ -433,6 +447,8 @@ class AsyncStatesResource(AsyncAPIResource):
|
|
|
433
447
|
{
|
|
434
448
|
"agent_id": agent_id,
|
|
435
449
|
"limit": limit,
|
|
450
|
+
"order_by": order_by,
|
|
451
|
+
"order_direction": order_direction,
|
|
436
452
|
"page_number": page_number,
|
|
437
453
|
"task_id": task_id,
|
|
438
454
|
},
|
agentex/resources/tasks.py
CHANGED
|
@@ -92,6 +92,8 @@ class TasksResource(SyncAPIResource):
|
|
|
92
92
|
agent_id: Optional[str] | Omit = omit,
|
|
93
93
|
agent_name: Optional[str] | Omit = omit,
|
|
94
94
|
limit: int | Omit = omit,
|
|
95
|
+
order_by: Optional[str] | Omit = omit,
|
|
96
|
+
order_direction: str | Omit = omit,
|
|
95
97
|
page_number: int | Omit = omit,
|
|
96
98
|
relationships: List[Literal["agents"]] | Omit = omit,
|
|
97
99
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
@@ -125,6 +127,8 @@ class TasksResource(SyncAPIResource):
|
|
|
125
127
|
"agent_id": agent_id,
|
|
126
128
|
"agent_name": agent_name,
|
|
127
129
|
"limit": limit,
|
|
130
|
+
"order_by": order_by,
|
|
131
|
+
"order_direction": order_direction,
|
|
128
132
|
"page_number": page_number,
|
|
129
133
|
"relationships": relationships,
|
|
130
134
|
},
|
|
@@ -377,6 +381,8 @@ class AsyncTasksResource(AsyncAPIResource):
|
|
|
377
381
|
agent_id: Optional[str] | Omit = omit,
|
|
378
382
|
agent_name: Optional[str] | Omit = omit,
|
|
379
383
|
limit: int | Omit = omit,
|
|
384
|
+
order_by: Optional[str] | Omit = omit,
|
|
385
|
+
order_direction: str | Omit = omit,
|
|
380
386
|
page_number: int | Omit = omit,
|
|
381
387
|
relationships: List[Literal["agents"]] | Omit = omit,
|
|
382
388
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
@@ -410,6 +416,8 @@ class AsyncTasksResource(AsyncAPIResource):
|
|
|
410
416
|
"agent_id": agent_id,
|
|
411
417
|
"agent_name": agent_name,
|
|
412
418
|
"limit": limit,
|
|
419
|
+
"order_by": order_by,
|
|
420
|
+
"order_direction": order_direction,
|
|
413
421
|
"page_number": page_number,
|
|
414
422
|
"relationships": relationships,
|
|
415
423
|
},
|
agentex/resources/tracker.py
CHANGED
|
@@ -132,6 +132,8 @@ class TrackerResource(SyncAPIResource):
|
|
|
132
132
|
*,
|
|
133
133
|
agent_id: Optional[str] | Omit = omit,
|
|
134
134
|
limit: int | Omit = omit,
|
|
135
|
+
order_by: Optional[str] | Omit = omit,
|
|
136
|
+
order_direction: str | Omit = omit,
|
|
135
137
|
page_number: int | Omit = omit,
|
|
136
138
|
task_id: Optional[str] | Omit = omit,
|
|
137
139
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
@@ -149,6 +151,10 @@ class TrackerResource(SyncAPIResource):
|
|
|
149
151
|
|
|
150
152
|
limit: Limit
|
|
151
153
|
|
|
154
|
+
order_by: Field to order by
|
|
155
|
+
|
|
156
|
+
order_direction: Order direction (asc or desc)
|
|
157
|
+
|
|
152
158
|
page_number: Page number
|
|
153
159
|
|
|
154
160
|
task_id: Task ID
|
|
@@ -172,6 +178,8 @@ class TrackerResource(SyncAPIResource):
|
|
|
172
178
|
{
|
|
173
179
|
"agent_id": agent_id,
|
|
174
180
|
"limit": limit,
|
|
181
|
+
"order_by": order_by,
|
|
182
|
+
"order_direction": order_direction,
|
|
175
183
|
"page_number": page_number,
|
|
176
184
|
"task_id": task_id,
|
|
177
185
|
},
|
|
@@ -290,6 +298,8 @@ class AsyncTrackerResource(AsyncAPIResource):
|
|
|
290
298
|
*,
|
|
291
299
|
agent_id: Optional[str] | Omit = omit,
|
|
292
300
|
limit: int | Omit = omit,
|
|
301
|
+
order_by: Optional[str] | Omit = omit,
|
|
302
|
+
order_direction: str | Omit = omit,
|
|
293
303
|
page_number: int | Omit = omit,
|
|
294
304
|
task_id: Optional[str] | Omit = omit,
|
|
295
305
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
@@ -307,6 +317,10 @@ class AsyncTrackerResource(AsyncAPIResource):
|
|
|
307
317
|
|
|
308
318
|
limit: Limit
|
|
309
319
|
|
|
320
|
+
order_by: Field to order by
|
|
321
|
+
|
|
322
|
+
order_direction: Order direction (asc or desc)
|
|
323
|
+
|
|
310
324
|
page_number: Page number
|
|
311
325
|
|
|
312
326
|
task_id: Task ID
|
|
@@ -330,6 +344,8 @@ class AsyncTrackerResource(AsyncAPIResource):
|
|
|
330
344
|
{
|
|
331
345
|
"agent_id": agent_id,
|
|
332
346
|
"limit": limit,
|
|
347
|
+
"order_by": order_by,
|
|
348
|
+
"order_direction": order_direction,
|
|
333
349
|
"page_number": page_number,
|
|
334
350
|
"task_id": task_id,
|
|
335
351
|
},
|
agentex/types/__init__.py
CHANGED
|
@@ -64,5 +64,7 @@ from .tool_request_content_param import ToolRequestContentParam as ToolRequestCo
|
|
|
64
64
|
from .tool_response_content_param import ToolResponseContentParam as ToolResponseContentParam
|
|
65
65
|
from .task_retrieve_by_name_params import TaskRetrieveByNameParams as TaskRetrieveByNameParams
|
|
66
66
|
from .deployment_history_list_params import DeploymentHistoryListParams as DeploymentHistoryListParams
|
|
67
|
+
from .message_list_paginated_params import MessageListPaginatedParams as MessageListPaginatedParams
|
|
67
68
|
from .task_retrieve_by_name_response import TaskRetrieveByNameResponse as TaskRetrieveByNameResponse
|
|
68
69
|
from .deployment_history_list_response import DeploymentHistoryListResponse as DeploymentHistoryListResponse
|
|
70
|
+
from .message_list_paginated_response import MessageListPaginatedResponse as MessageListPaginatedResponse
|
|
@@ -20,6 +20,8 @@ __all__ = [
|
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
class StreamTaskMessageStart(BaseModel):
|
|
23
|
+
"""Event for starting a streaming message"""
|
|
24
|
+
|
|
23
25
|
content: TaskMessageContent
|
|
24
26
|
|
|
25
27
|
index: Optional[int] = None
|
|
@@ -35,6 +37,8 @@ class StreamTaskMessageStart(BaseModel):
|
|
|
35
37
|
|
|
36
38
|
|
|
37
39
|
class StreamTaskMessageDelta(BaseModel):
|
|
40
|
+
"""Event for streaming chunks of content"""
|
|
41
|
+
|
|
38
42
|
delta: Optional[TaskMessageDelta] = None
|
|
39
43
|
"""Delta for text updates"""
|
|
40
44
|
|
|
@@ -51,6 +55,8 @@ class StreamTaskMessageDelta(BaseModel):
|
|
|
51
55
|
|
|
52
56
|
|
|
53
57
|
class StreamTaskMessageFull(BaseModel):
|
|
58
|
+
"""Event for streaming the full content"""
|
|
59
|
+
|
|
54
60
|
content: TaskMessageContent
|
|
55
61
|
|
|
56
62
|
index: Optional[int] = None
|
|
@@ -66,6 +72,8 @@ class StreamTaskMessageFull(BaseModel):
|
|
|
66
72
|
|
|
67
73
|
|
|
68
74
|
class StreamTaskMessageDone(BaseModel):
|
|
75
|
+
"""Event for indicating the task is done"""
|
|
76
|
+
|
|
69
77
|
index: Optional[int] = None
|
|
70
78
|
|
|
71
79
|
parent_task_message: Optional[TaskMessage] = None
|
agentex/types/data_delta.py
CHANGED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Optional
|
|
6
|
+
from typing_extensions import Literal, Required, TypedDict
|
|
7
|
+
|
|
8
|
+
__all__ = ["MessageListPaginatedParams"]
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class MessageListPaginatedParams(TypedDict, total=False):
|
|
12
|
+
task_id: Required[str]
|
|
13
|
+
"""The task ID"""
|
|
14
|
+
|
|
15
|
+
cursor: Optional[str]
|
|
16
|
+
|
|
17
|
+
direction: Literal["older", "newer"]
|
|
18
|
+
|
|
19
|
+
limit: int
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from typing import List, Optional
|
|
4
|
+
|
|
5
|
+
from .._models import BaseModel
|
|
6
|
+
from .task_message import TaskMessage
|
|
7
|
+
|
|
8
|
+
__all__ = ["MessageListPaginatedResponse"]
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class MessageListPaginatedResponse(BaseModel):
|
|
12
|
+
"""Response with cursor pagination metadata."""
|
|
13
|
+
|
|
14
|
+
data: List[TaskMessage]
|
|
15
|
+
"""List of messages"""
|
|
16
|
+
|
|
17
|
+
has_more: Optional[bool] = None
|
|
18
|
+
"""Whether there are more messages to fetch"""
|
|
19
|
+
|
|
20
|
+
next_cursor: Optional[str] = None
|
|
21
|
+
"""Cursor for fetching the next page of older messages"""
|