@@ -100,6 +100,8 @@ def list(
100100 schedule_id : str | Omit = omit ,
101101 skill : str | Omit = omit ,
102102 skill_spec : str | Omit = omit ,
103+ sort_by : Literal ["updated_at" , "created_at" , "title" , "agent" ] | Omit = omit ,
104+ sort_order : Literal ["asc" , "desc" ] | Omit = omit ,
103105 source : RunSourceType | Omit = omit ,
104106 state : List [RunState ] | Omit = omit ,
105107 updated_after : Union [str , datetime ] | Omit = omit ,
@@ -112,8 +114,8 @@ def list(
112114 ) -> RunListResponse :
113115 """Retrieve a paginated list of agent runs with optional filtering.
114116
115- Results are
116- ordered by creation time (newest first) .
117+ Results default
118+ to `sort_by=updated_at` and `sort_order=desc` .
117119
118120 Args:
119121 artifact_type: Filter runs by artifact type (PLAN or PULL_REQUEST)
@@ -143,6 +145,15 @@ def list(
143145
144146 skill_spec: Filter runs by skill spec (e.g., "owner/repo:path/to/SKILL.md")
145147
148+ sort_by: Sort field for results.
149+
150+ - `updated_at`: Sort by last update timestamp (default)
151+ - `created_at`: Sort by creation timestamp
152+ - `title`: Sort alphabetically by run title
153+ - `agent`: Sort alphabetically by skill. Runs without a skill are grouped last.
154+
155+ sort_order: Sort direction
156+
146157 source: Filter by run source type
147158
148159 state: Filter by run state. Can be specified multiple times to match any of the given
@@ -180,6 +191,8 @@ def list(
180191 "schedule_id" : schedule_id ,
181192 "skill" : skill ,
182193 "skill_spec" : skill_spec ,
194+ "sort_by" : sort_by ,
195+ "sort_order" : sort_order ,
183196 "source" : source ,
184197 "state" : state ,
185198 "updated_after" : updated_after ,
@@ -204,11 +217,7 @@ def cancel(
204217 """Cancel an agent run that is currently queued or in progress.
205218
206219 Once cancelled, the
207- run will transition to a cancelled state.
208-
209- Not all runs can be cancelled. Runs that are in a terminal state (SUCCEEDED,
210- FAILED, ERROR, BLOCKED, CANCELLED) return 400. Runs in PENDING state return 409
211- (retry after a moment). Self-hosted, local, and GitHub Action runs return 422.
220+ run will transition to a failed state.
212221
213222 Args:
214223 extra_headers: Send extra headers
@@ -302,6 +311,8 @@ async def list(
302311 schedule_id : str | Omit = omit ,
303312 skill : str | Omit = omit ,
304313 skill_spec : str | Omit = omit ,
314+ sort_by : Literal ["updated_at" , "created_at" , "title" , "agent" ] | Omit = omit ,
315+ sort_order : Literal ["asc" , "desc" ] | Omit = omit ,
305316 source : RunSourceType | Omit = omit ,
306317 state : List [RunState ] | Omit = omit ,
307318 updated_after : Union [str , datetime ] | Omit = omit ,
@@ -314,8 +325,8 @@ async def list(
314325 ) -> RunListResponse :
315326 """Retrieve a paginated list of agent runs with optional filtering.
316327
317- Results are
318- ordered by creation time (newest first) .
328+ Results default
329+ to `sort_by=updated_at` and `sort_order=desc` .
319330
320331 Args:
321332 artifact_type: Filter runs by artifact type (PLAN or PULL_REQUEST)
@@ -345,6 +356,15 @@ async def list(
345356
346357 skill_spec: Filter runs by skill spec (e.g., "owner/repo:path/to/SKILL.md")
347358
359+ sort_by: Sort field for results.
360+
361+ - `updated_at`: Sort by last update timestamp (default)
362+ - `created_at`: Sort by creation timestamp
363+ - `title`: Sort alphabetically by run title
364+ - `agent`: Sort alphabetically by skill. Runs without a skill are grouped last.
365+
366+ sort_order: Sort direction
367+
348368 source: Filter by run source type
349369
350370 state: Filter by run state. Can be specified multiple times to match any of the given
@@ -382,6 +402,8 @@ async def list(
382402 "schedule_id" : schedule_id ,
383403 "skill" : skill ,
384404 "skill_spec" : skill_spec ,
405+ "sort_by" : sort_by ,
406+ "sort_order" : sort_order ,
385407 "source" : source ,
386408 "state" : state ,
387409 "updated_after" : updated_after ,
@@ -406,11 +428,7 @@ async def cancel(
406428 """Cancel an agent run that is currently queued or in progress.
407429
408430 Once cancelled, the
409- run will transition to a cancelled state.
410-
411- Not all runs can be cancelled. Runs that are in a terminal state (SUCCEEDED,
412- FAILED, ERROR, BLOCKED, CANCELLED) return 400. Runs in PENDING state return 409
413- (retry after a moment). Self-hosted, local, and GitHub Action runs return 422.
431+ run will transition to a failed state.
414432
415433 Args:
416434 extra_headers: Send extra headers
0 commit comments