Skip to content

Commit ffaecd5

Browse files
feat(api): api update
1 parent 168cc44 commit ffaecd5

7 files changed

Lines changed: 61 additions & 6 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/agentex-sdk-77d6129c9334f3e5fafbbfe9e6e31b5328a90042d36a83b7ebdf5ac803c84fad.yml
3-
openapi_spec_hash: 29b1c8e19be86501217b5a6c1858f73a
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/sgp/agentex-sdk-b997afde6595db62caea38bca035fda2812ea52cc8f360dab829b71178e826e6.yml
3+
openapi_spec_hash: d195a98bf64b6edb826bc420773ca52e
44
config_hash: fb079ef7936611b032568661b8165f19

src/agentex/resources/tasks.py

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,17 +109,27 @@ def list(
109109
order_direction: str | Omit = omit,
110110
page_number: int | Omit = omit,
111111
relationships: List[Literal["agents"]] | Omit = omit,
112+
status: Optional[Literal["CANCELED", "COMPLETED", "FAILED", "RUNNING", "TERMINATED", "TIMED_OUT", "DELETED"]]
113+
| Omit = omit,
114+
task_metadata: Optional[str] | Omit = omit,
112115
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
113116
# The extra values given here take precedence over values defined on the client or passed to this method.
114117
extra_headers: Headers | None = None,
115118
extra_query: Query | None = None,
116119
extra_body: Body | None = None,
117120
timeout: float | httpx.Timeout | None | NotGiven = not_given,
118121
) -> TaskListResponse:
119-
"""
120-
List all tasks.
122+
"""List all tasks.
121123
122124
Args:
125+
status: Filter tasks by status (e.g.
126+
127+
RUNNING, COMPLETED).
128+
129+
task_metadata:
130+
JSON-encoded object used to filter tasks via JSONB containment. Example:
131+
{"created_by_user_id": "abc-123"}.
132+
123133
extra_headers: Send extra headers
124134
125135
extra_query: Add additional query parameters to the request
@@ -144,6 +154,8 @@ def list(
144154
"order_direction": order_direction,
145155
"page_number": page_number,
146156
"relationships": relationships,
157+
"status": status,
158+
"task_metadata": task_metadata,
147159
},
148160
task_list_params.TaskListParams,
149161
),
@@ -679,17 +691,27 @@ async def list(
679691
order_direction: str | Omit = omit,
680692
page_number: int | Omit = omit,
681693
relationships: List[Literal["agents"]] | Omit = omit,
694+
status: Optional[Literal["CANCELED", "COMPLETED", "FAILED", "RUNNING", "TERMINATED", "TIMED_OUT", "DELETED"]]
695+
| Omit = omit,
696+
task_metadata: Optional[str] | Omit = omit,
682697
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
683698
# The extra values given here take precedence over values defined on the client or passed to this method.
684699
extra_headers: Headers | None = None,
685700
extra_query: Query | None = None,
686701
extra_body: Body | None = None,
687702
timeout: float | httpx.Timeout | None | NotGiven = not_given,
688703
) -> TaskListResponse:
689-
"""
690-
List all tasks.
704+
"""List all tasks.
691705
692706
Args:
707+
status: Filter tasks by status (e.g.
708+
709+
RUNNING, COMPLETED).
710+
711+
task_metadata:
712+
JSON-encoded object used to filter tasks via JSONB containment. Example:
713+
{"created_by_user_id": "abc-123"}.
714+
693715
extra_headers: Send extra headers
694716
695717
extra_query: Add additional query parameters to the request
@@ -714,6 +736,8 @@ async def list(
714736
"order_direction": order_direction,
715737
"page_number": page_number,
716738
"relationships": relationships,
739+
"status": status,
740+
"task_metadata": task_metadata,
717741
},
718742
task_list_params.TaskListParams,
719743
),

src/agentex/types/agent_rpc_by_name_params.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,13 @@ class ParamsCreateTaskRequest(TypedDict, total=False):
3535
params: Optional[Dict[str, object]]
3636
"""The parameters for the task"""
3737

38+
task_metadata: Optional[Dict[str, object]]
39+
"""Caller-provided metadata to persist on the task row.
40+
41+
Only applied at task creation; ignored if a task with this name already exists.
42+
Forwarded to the agent inside the ACP payload for backward compatibility.
43+
"""
44+
3845

3946
class ParamsCancelTaskRequest(TypedDict, total=False):
4047
task_id: Optional[str]

src/agentex/types/agent_rpc_params.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,13 @@ class ParamsCreateTaskRequest(TypedDict, total=False):
3535
params: Optional[Dict[str, object]]
3636
"""The parameters for the task"""
3737

38+
task_metadata: Optional[Dict[str, object]]
39+
"""Caller-provided metadata to persist on the task row.
40+
41+
Only applied at task creation; ignored if a task with this name already exists.
42+
Forwarded to the agent inside the ACP payload for backward compatibility.
43+
"""
44+
3845

3946
class ParamsCancelTaskRequest(TypedDict, total=False):
4047
task_id: Optional[str]

src/agentex/types/task_list_params.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,12 @@ class TaskListParams(TypedDict, total=False):
2222
page_number: int
2323

2424
relationships: List[Literal["agents"]]
25+
26+
status: Optional[Literal["CANCELED", "COMPLETED", "FAILED", "RUNNING", "TERMINATED", "TIMED_OUT", "DELETED"]]
27+
"""Filter tasks by status (e.g. RUNNING, COMPLETED)."""
28+
29+
task_metadata: Optional[str]
30+
"""JSON-encoded object used to filter tasks via JSONB containment.
31+
32+
Example: {"created_by_user_id": "abc-123"}.
33+
"""

tests/api_resources/test_agents.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@ def test_method_rpc_with_all_params(self, client: Agentex) -> None:
250250
params={
251251
"name": "name",
252252
"params": {"foo": "bar"},
253+
"task_metadata": {"foo": "bar"},
253254
},
254255
id=0,
255256
jsonrpc="2.0",
@@ -315,6 +316,7 @@ def test_method_rpc_by_name_with_all_params(self, client: Agentex) -> None:
315316
params={
316317
"name": "name",
317318
"params": {"foo": "bar"},
319+
"task_metadata": {"foo": "bar"},
318320
},
319321
id=0,
320322
jsonrpc="2.0",
@@ -594,6 +596,7 @@ async def test_method_rpc_with_all_params(self, async_client: AsyncAgentex) -> N
594596
params={
595597
"name": "name",
596598
"params": {"foo": "bar"},
599+
"task_metadata": {"foo": "bar"},
597600
},
598601
id=0,
599602
jsonrpc="2.0",
@@ -659,6 +662,7 @@ async def test_method_rpc_by_name_with_all_params(self, async_client: AsyncAgent
659662
params={
660663
"name": "name",
661664
"params": {"foo": "bar"},
665+
"task_metadata": {"foo": "bar"},
662666
},
663667
id=0,
664668
jsonrpc="2.0",

tests/api_resources/test_tasks.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ def test_method_list_with_all_params(self, client: Agentex) -> None:
9393
order_direction="order_direction",
9494
page_number=0,
9595
relationships=["agents"],
96+
status="CANCELED",
97+
task_metadata="task_metadata",
9698
)
9799
assert_matches_type(TaskListResponse, task, path=["response"])
98100

@@ -818,6 +820,8 @@ async def test_method_list_with_all_params(self, async_client: AsyncAgentex) ->
818820
order_direction="order_direction",
819821
page_number=0,
820822
relationships=["agents"],
823+
status="CANCELED",
824+
task_metadata="task_metadata",
821825
)
822826
assert_matches_type(TaskListResponse, task, path=["response"])
823827

0 commit comments

Comments
 (0)