Skip to content

Commit ed4d23c

Browse files
feat(api): api update
1 parent 1355d67 commit ed4d23c

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
@@ -249,6 +249,7 @@ def test_method_rpc_with_all_params(self, client: Agentex) -> None:
249249
params={
250250
"name": "name",
251251
"params": {"foo": "bar"},
252+
"task_metadata": {"foo": "bar"},
252253
},
253254
id=0,
254255
jsonrpc="2.0",
@@ -314,6 +315,7 @@ def test_method_rpc_by_name_with_all_params(self, client: Agentex) -> None:
314315
params={
315316
"name": "name",
316317
"params": {"foo": "bar"},
318+
"task_metadata": {"foo": "bar"},
317319
},
318320
id=0,
319321
jsonrpc="2.0",
@@ -593,6 +595,7 @@ async def test_method_rpc_with_all_params(self, async_client: AsyncAgentex) -> N
593595
params={
594596
"name": "name",
595597
"params": {"foo": "bar"},
598+
"task_metadata": {"foo": "bar"},
596599
},
597600
id=0,
598601
jsonrpc="2.0",
@@ -658,6 +661,7 @@ async def test_method_rpc_by_name_with_all_params(self, async_client: AsyncAgent
658661
params={
659662
"name": "name",
660663
"params": {"foo": "bar"},
664+
"task_metadata": {"foo": "bar"},
661665
},
662666
id=0,
663667
jsonrpc="2.0",

tests/api_resources/test_tasks.py

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

@@ -817,6 +819,8 @@ async def test_method_list_with_all_params(self, async_client: AsyncAgentex) ->
817819
order_direction="order_direction",
818820
page_number=0,
819821
relationships=["agents"],
822+
status="CANCELED",
823+
task_metadata="task_metadata",
820824
)
821825
assert_matches_type(TaskListResponse, task, path=["response"])
822826

0 commit comments

Comments
 (0)