archastro.platform.v1.resources.work_items

  1# Copyright (c) 2026 ArchAstro Inc. Licensed under the MIT License.
  2# This file is auto-generated by @archastro/sdk-generator. Do not edit.
  3# Content hash: 92e0c4b9c2d0
  4
  5from __future__ import annotations
  6
  7from typing import Any, Required, TypedDict
  8
  9from ...runtime.http_client import HttpClient, SyncHttpClient
 10from ...types.common import WorkflowWorkItemList
 11
 12
 13class WorkItemFailInput(TypedDict):
 14    "Fail workflow work and route its durable execution"
 15
 16    error: dict[str, Any]
 17    "JSON-serializable failure returned by the worker."
 18    lease_owner: str
 19    "Saved lease token."
 20
 21
 22class WorkItemHeartbeatInput(TypedDict, total=False):
 23    "Extend a workflow work item lease"
 24
 25    lease_owner: Required[str]
 26    "Saved lease token."
 27    lease_seconds: int | None
 28    "Replacement lease duration from 15 through 3600 seconds. Defaults to 300."
 29
 30
 31class WorkItemStartInput(TypedDict):
 32    "Mark claimed workflow work as running"
 33
 34    lease_owner: str
 35    "Saved lease token."
 36
 37
 38class WorkItemSubmitInput(TypedDict):
 39    "Submit workflow work output and wake its durable execution"
 40
 41    lease_owner: str
 42    "Saved lease token."
 43    result: dict[str, Any]
 44    "JSON-serializable output returned to the workflow."
 45
 46
 47class AsyncWorkItemResource:
 48    def __init__(self, http: HttpClient):
 49        self._http = http
 50
 51    async def list(
 52        self,
 53        *,
 54        execution: str | None = None,
 55        limit: int | None = None,
 56        after_cursor: str | None = None,
 57    ) -> WorkflowWorkItemList:
 58        """
 59        List active workflow work available to the viewer
 60        Lists queued, claimed, and running external work yielded by durable workflows.
 61        The top-level collection includes work for every agent the viewer can execute;
 62        the agent-nested collection limits results to that agent. This discovery
 63        response never includes lease tokens. Use the agent claim endpoint to acquire
 64        new work or resume a saved lease.
 65
 66        Args:
 67            execution: Optional durable execution ID filter.
 68            limit: Maximum work items per page. Defaults to 50; maximum is 100.
 69            after_cursor: Opaque cursor for the next page of older queued work.
 70
 71        Returns:
 72            Successful response
 73        """
 74        query: dict[str, object] = {}
 75        if execution is not None:
 76            query["execution"] = execution
 77        if limit is not None:
 78            query["limit"] = limit
 79        if after_cursor is not None:
 80            query["after_cursor"] = after_cursor
 81        return await self._http.request(
 82            "/api/v1/work_items",
 83            query=query,
 84            response_type=WorkflowWorkItemList,
 85        )
 86
 87    async def fail(self, work_item: str, input: WorkItemFailInput) -> None:
 88        """
 89        Fail workflow work and route its durable execution
 90        Atomically records command failure, marks the work item failed, and either
 91        wakes the workflow at the node's error edge or fails the owning run when no
 92        error edge exists. Retrying the same lease and error is idempotent; a
 93        different terminal payload conflicts.
 94
 95        Args:
 96            work_item: Claimed or running work item ID.
 97            input: Request body.
 98            input.error: JSON-serializable failure returned by the worker.
 99            input.lease_owner: Saved lease token.
100
101        Returns:
102            No content
103        """
104        await self._http.request(f"/api/v1/work_items/{work_item}/fail", method="POST", body=input)
105
106    async def heartbeat(self, work_item: str, input: WorkItemHeartbeatInput) -> None:
107        """
108        Extend a workflow work item lease
109
110        Args:
111            work_item: Claimed or running work item ID.
112            input: Request body.
113            input.lease_owner: Saved lease token.
114            input.lease_seconds: Replacement lease duration from 15 through 3600 seconds. Defaults to 300.
115
116        Returns:
117            No content
118        """
119        await self._http.request(
120            f"/api/v1/work_items/{work_item}/heartbeat",
121            method="POST",
122            body=input,
123        )
124
125    async def start(self, work_item: str, input: WorkItemStartInput) -> None:
126        """
127        Mark claimed workflow work as running
128
129        Args:
130            work_item: Claimed work item ID.
131            input: Request body.
132            input.lease_owner: Saved lease token.
133
134        Returns:
135            No content
136        """
137        await self._http.request(f"/api/v1/work_items/{work_item}/start", method="POST", body=input)
138
139    async def submit(self, work_item: str, input: WorkItemSubmitInput) -> None:
140        """
141        Submit workflow work output and wake its durable execution
142        Atomically records the command completion, marks the work item succeeded,
143        advances the journal sequence, and enqueues the owning workflow continuation.
144        Retrying the same lease and result is idempotent; a different result conflicts.
145
146        Args:
147            work_item: Claimed or running work item ID.
148            input: Request body.
149            input.lease_owner: Saved lease token.
150            input.result: JSON-serializable output returned to the workflow.
151
152        Returns:
153            No content
154        """
155        await self._http.request(
156            f"/api/v1/work_items/{work_item}/submit",
157            method="POST",
158            body=input,
159        )
160
161
162class WorkItemResource:
163    def __init__(self, http: SyncHttpClient):
164        self._http = http
165
166    def list(
167        self,
168        *,
169        execution: str | None = None,
170        limit: int | None = None,
171        after_cursor: str | None = None,
172    ) -> WorkflowWorkItemList:
173        """
174        List active workflow work available to the viewer
175        Lists queued, claimed, and running external work yielded by durable workflows.
176        The top-level collection includes work for every agent the viewer can execute;
177        the agent-nested collection limits results to that agent. This discovery
178        response never includes lease tokens. Use the agent claim endpoint to acquire
179        new work or resume a saved lease.
180
181        Args:
182            execution: Optional durable execution ID filter.
183            limit: Maximum work items per page. Defaults to 50; maximum is 100.
184            after_cursor: Opaque cursor for the next page of older queued work.
185
186        Returns:
187            Successful response
188        """
189        query: dict[str, object] = {}
190        if execution is not None:
191            query["execution"] = execution
192        if limit is not None:
193            query["limit"] = limit
194        if after_cursor is not None:
195            query["after_cursor"] = after_cursor
196        return self._http.request(
197            "/api/v1/work_items",
198            query=query,
199            response_type=WorkflowWorkItemList,
200        )
201
202    def fail(self, work_item: str, input: WorkItemFailInput) -> None:
203        """
204        Fail workflow work and route its durable execution
205        Atomically records command failure, marks the work item failed, and either
206        wakes the workflow at the node's error edge or fails the owning run when no
207        error edge exists. Retrying the same lease and error is idempotent; a
208        different terminal payload conflicts.
209
210        Args:
211            work_item: Claimed or running work item ID.
212            input: Request body.
213            input.error: JSON-serializable failure returned by the worker.
214            input.lease_owner: Saved lease token.
215
216        Returns:
217            No content
218        """
219        self._http.request(f"/api/v1/work_items/{work_item}/fail", method="POST", body=input)
220
221    def heartbeat(self, work_item: str, input: WorkItemHeartbeatInput) -> None:
222        """
223        Extend a workflow work item lease
224
225        Args:
226            work_item: Claimed or running work item ID.
227            input: Request body.
228            input.lease_owner: Saved lease token.
229            input.lease_seconds: Replacement lease duration from 15 through 3600 seconds. Defaults to 300.
230
231        Returns:
232            No content
233        """
234        self._http.request(f"/api/v1/work_items/{work_item}/heartbeat", method="POST", body=input)
235
236    def start(self, work_item: str, input: WorkItemStartInput) -> None:
237        """
238        Mark claimed workflow work as running
239
240        Args:
241            work_item: Claimed work item ID.
242            input: Request body.
243            input.lease_owner: Saved lease token.
244
245        Returns:
246            No content
247        """
248        self._http.request(f"/api/v1/work_items/{work_item}/start", method="POST", body=input)
249
250    def submit(self, work_item: str, input: WorkItemSubmitInput) -> None:
251        """
252        Submit workflow work output and wake its durable execution
253        Atomically records the command completion, marks the work item succeeded,
254        advances the journal sequence, and enqueues the owning workflow continuation.
255        Retrying the same lease and result is idempotent; a different result conflicts.
256
257        Args:
258            work_item: Claimed or running work item ID.
259            input: Request body.
260            input.lease_owner: Saved lease token.
261            input.result: JSON-serializable output returned to the workflow.
262
263        Returns:
264            No content
265        """
266        self._http.request(f"/api/v1/work_items/{work_item}/submit", method="POST", body=input)
class WorkItemFailInput(typing.TypedDict):
14class WorkItemFailInput(TypedDict):
15    "Fail workflow work and route its durable execution"
16
17    error: dict[str, Any]
18    "JSON-serializable failure returned by the worker."
19    lease_owner: str
20    "Saved lease token."

Fail workflow work and route its durable execution

error: dict[str, typing.Any]

JSON-serializable failure returned by the worker.

lease_owner: str

Saved lease token.

class WorkItemHeartbeatInput(typing.TypedDict):
23class WorkItemHeartbeatInput(TypedDict, total=False):
24    "Extend a workflow work item lease"
25
26    lease_owner: Required[str]
27    "Saved lease token."
28    lease_seconds: int | None
29    "Replacement lease duration from 15 through 3600 seconds. Defaults to 300."

Extend a workflow work item lease

lease_owner: Required[str]

Saved lease token.

lease_seconds: int | None

Replacement lease duration from 15 through 3600 seconds. Defaults to 300.

class WorkItemStartInput(typing.TypedDict):
32class WorkItemStartInput(TypedDict):
33    "Mark claimed workflow work as running"
34
35    lease_owner: str
36    "Saved lease token."

Mark claimed workflow work as running

lease_owner: str

Saved lease token.

class WorkItemSubmitInput(typing.TypedDict):
39class WorkItemSubmitInput(TypedDict):
40    "Submit workflow work output and wake its durable execution"
41
42    lease_owner: str
43    "Saved lease token."
44    result: dict[str, Any]
45    "JSON-serializable output returned to the workflow."

Submit workflow work output and wake its durable execution

lease_owner: str

Saved lease token.

result: dict[str, typing.Any]

JSON-serializable output returned to the workflow.

class AsyncWorkItemResource:
 48class AsyncWorkItemResource:
 49    def __init__(self, http: HttpClient):
 50        self._http = http
 51
 52    async def list(
 53        self,
 54        *,
 55        execution: str | None = None,
 56        limit: int | None = None,
 57        after_cursor: str | None = None,
 58    ) -> WorkflowWorkItemList:
 59        """
 60        List active workflow work available to the viewer
 61        Lists queued, claimed, and running external work yielded by durable workflows.
 62        The top-level collection includes work for every agent the viewer can execute;
 63        the agent-nested collection limits results to that agent. This discovery
 64        response never includes lease tokens. Use the agent claim endpoint to acquire
 65        new work or resume a saved lease.
 66
 67        Args:
 68            execution: Optional durable execution ID filter.
 69            limit: Maximum work items per page. Defaults to 50; maximum is 100.
 70            after_cursor: Opaque cursor for the next page of older queued work.
 71
 72        Returns:
 73            Successful response
 74        """
 75        query: dict[str, object] = {}
 76        if execution is not None:
 77            query["execution"] = execution
 78        if limit is not None:
 79            query["limit"] = limit
 80        if after_cursor is not None:
 81            query["after_cursor"] = after_cursor
 82        return await self._http.request(
 83            "/api/v1/work_items",
 84            query=query,
 85            response_type=WorkflowWorkItemList,
 86        )
 87
 88    async def fail(self, work_item: str, input: WorkItemFailInput) -> None:
 89        """
 90        Fail workflow work and route its durable execution
 91        Atomically records command failure, marks the work item failed, and either
 92        wakes the workflow at the node's error edge or fails the owning run when no
 93        error edge exists. Retrying the same lease and error is idempotent; a
 94        different terminal payload conflicts.
 95
 96        Args:
 97            work_item: Claimed or running work item ID.
 98            input: Request body.
 99            input.error: JSON-serializable failure returned by the worker.
100            input.lease_owner: Saved lease token.
101
102        Returns:
103            No content
104        """
105        await self._http.request(f"/api/v1/work_items/{work_item}/fail", method="POST", body=input)
106
107    async def heartbeat(self, work_item: str, input: WorkItemHeartbeatInput) -> None:
108        """
109        Extend a workflow work item lease
110
111        Args:
112            work_item: Claimed or running work item ID.
113            input: Request body.
114            input.lease_owner: Saved lease token.
115            input.lease_seconds: Replacement lease duration from 15 through 3600 seconds. Defaults to 300.
116
117        Returns:
118            No content
119        """
120        await self._http.request(
121            f"/api/v1/work_items/{work_item}/heartbeat",
122            method="POST",
123            body=input,
124        )
125
126    async def start(self, work_item: str, input: WorkItemStartInput) -> None:
127        """
128        Mark claimed workflow work as running
129
130        Args:
131            work_item: Claimed work item ID.
132            input: Request body.
133            input.lease_owner: Saved lease token.
134
135        Returns:
136            No content
137        """
138        await self._http.request(f"/api/v1/work_items/{work_item}/start", method="POST", body=input)
139
140    async def submit(self, work_item: str, input: WorkItemSubmitInput) -> None:
141        """
142        Submit workflow work output and wake its durable execution
143        Atomically records the command completion, marks the work item succeeded,
144        advances the journal sequence, and enqueues the owning workflow continuation.
145        Retrying the same lease and result is idempotent; a different result conflicts.
146
147        Args:
148            work_item: Claimed or running work item ID.
149            input: Request body.
150            input.lease_owner: Saved lease token.
151            input.result: JSON-serializable output returned to the workflow.
152
153        Returns:
154            No content
155        """
156        await self._http.request(
157            f"/api/v1/work_items/{work_item}/submit",
158            method="POST",
159            body=input,
160        )
AsyncWorkItemResource(http: archastro.platform.runtime.http_client.HttpClient)
49    def __init__(self, http: HttpClient):
50        self._http = http
async def list( self, *, execution: str | None = None, limit: int | None = None, after_cursor: str | None = None) -> archastro.platform.types.common.WorkflowWorkItemList:
52    async def list(
53        self,
54        *,
55        execution: str | None = None,
56        limit: int | None = None,
57        after_cursor: str | None = None,
58    ) -> WorkflowWorkItemList:
59        """
60        List active workflow work available to the viewer
61        Lists queued, claimed, and running external work yielded by durable workflows.
62        The top-level collection includes work for every agent the viewer can execute;
63        the agent-nested collection limits results to that agent. This discovery
64        response never includes lease tokens. Use the agent claim endpoint to acquire
65        new work or resume a saved lease.
66
67        Args:
68            execution: Optional durable execution ID filter.
69            limit: Maximum work items per page. Defaults to 50; maximum is 100.
70            after_cursor: Opaque cursor for the next page of older queued work.
71
72        Returns:
73            Successful response
74        """
75        query: dict[str, object] = {}
76        if execution is not None:
77            query["execution"] = execution
78        if limit is not None:
79            query["limit"] = limit
80        if after_cursor is not None:
81            query["after_cursor"] = after_cursor
82        return await self._http.request(
83            "/api/v1/work_items",
84            query=query,
85            response_type=WorkflowWorkItemList,
86        )

List active workflow work available to the viewer Lists queued, claimed, and running external work yielded by durable workflows. The top-level collection includes work for every agent the viewer can execute; the agent-nested collection limits results to that agent. This discovery response never includes lease tokens. Use the agent claim endpoint to acquire new work or resume a saved lease.

Arguments:
  • execution: Optional durable execution ID filter.
  • limit: Maximum work items per page. Defaults to 50; maximum is 100.
  • after_cursor: Opaque cursor for the next page of older queued work.
Returns:

Successful response

async def fail( self, work_item: str, input: WorkItemFailInput) -> None:
 88    async def fail(self, work_item: str, input: WorkItemFailInput) -> None:
 89        """
 90        Fail workflow work and route its durable execution
 91        Atomically records command failure, marks the work item failed, and either
 92        wakes the workflow at the node's error edge or fails the owning run when no
 93        error edge exists. Retrying the same lease and error is idempotent; a
 94        different terminal payload conflicts.
 95
 96        Args:
 97            work_item: Claimed or running work item ID.
 98            input: Request body.
 99            input.error: JSON-serializable failure returned by the worker.
100            input.lease_owner: Saved lease token.
101
102        Returns:
103            No content
104        """
105        await self._http.request(f"/api/v1/work_items/{work_item}/fail", method="POST", body=input)

Fail workflow work and route its durable execution Atomically records command failure, marks the work item failed, and either wakes the workflow at the node's error edge or fails the owning run when no error edge exists. Retrying the same lease and error is idempotent; a different terminal payload conflicts.

Arguments:
  • work_item: Claimed or running work item ID.
  • input: Request body.
  • input.error: JSON-serializable failure returned by the worker.
  • input.lease_owner: Saved lease token.
Returns:

No content

async def heartbeat( self, work_item: str, input: WorkItemHeartbeatInput) -> None:
107    async def heartbeat(self, work_item: str, input: WorkItemHeartbeatInput) -> None:
108        """
109        Extend a workflow work item lease
110
111        Args:
112            work_item: Claimed or running work item ID.
113            input: Request body.
114            input.lease_owner: Saved lease token.
115            input.lease_seconds: Replacement lease duration from 15 through 3600 seconds. Defaults to 300.
116
117        Returns:
118            No content
119        """
120        await self._http.request(
121            f"/api/v1/work_items/{work_item}/heartbeat",
122            method="POST",
123            body=input,
124        )

Extend a workflow work item lease

Arguments:
  • work_item: Claimed or running work item ID.
  • input: Request body.
  • input.lease_owner: Saved lease token.
  • input.lease_seconds: Replacement lease duration from 15 through 3600 seconds. Defaults to 300.
Returns:

No content

async def start( self, work_item: str, input: WorkItemStartInput) -> None:
126    async def start(self, work_item: str, input: WorkItemStartInput) -> None:
127        """
128        Mark claimed workflow work as running
129
130        Args:
131            work_item: Claimed work item ID.
132            input: Request body.
133            input.lease_owner: Saved lease token.
134
135        Returns:
136            No content
137        """
138        await self._http.request(f"/api/v1/work_items/{work_item}/start", method="POST", body=input)

Mark claimed workflow work as running

Arguments:
  • work_item: Claimed work item ID.
  • input: Request body.
  • input.lease_owner: Saved lease token.
Returns:

No content

async def submit( self, work_item: str, input: WorkItemSubmitInput) -> None:
140    async def submit(self, work_item: str, input: WorkItemSubmitInput) -> None:
141        """
142        Submit workflow work output and wake its durable execution
143        Atomically records the command completion, marks the work item succeeded,
144        advances the journal sequence, and enqueues the owning workflow continuation.
145        Retrying the same lease and result is idempotent; a different result conflicts.
146
147        Args:
148            work_item: Claimed or running work item ID.
149            input: Request body.
150            input.lease_owner: Saved lease token.
151            input.result: JSON-serializable output returned to the workflow.
152
153        Returns:
154            No content
155        """
156        await self._http.request(
157            f"/api/v1/work_items/{work_item}/submit",
158            method="POST",
159            body=input,
160        )

Submit workflow work output and wake its durable execution Atomically records the command completion, marks the work item succeeded, advances the journal sequence, and enqueues the owning workflow continuation. Retrying the same lease and result is idempotent; a different result conflicts.

Arguments:
  • work_item: Claimed or running work item ID.
  • input: Request body.
  • input.lease_owner: Saved lease token.
  • input.result: JSON-serializable output returned to the workflow.
Returns:

No content

class WorkItemResource:
163class WorkItemResource:
164    def __init__(self, http: SyncHttpClient):
165        self._http = http
166
167    def list(
168        self,
169        *,
170        execution: str | None = None,
171        limit: int | None = None,
172        after_cursor: str | None = None,
173    ) -> WorkflowWorkItemList:
174        """
175        List active workflow work available to the viewer
176        Lists queued, claimed, and running external work yielded by durable workflows.
177        The top-level collection includes work for every agent the viewer can execute;
178        the agent-nested collection limits results to that agent. This discovery
179        response never includes lease tokens. Use the agent claim endpoint to acquire
180        new work or resume a saved lease.
181
182        Args:
183            execution: Optional durable execution ID filter.
184            limit: Maximum work items per page. Defaults to 50; maximum is 100.
185            after_cursor: Opaque cursor for the next page of older queued work.
186
187        Returns:
188            Successful response
189        """
190        query: dict[str, object] = {}
191        if execution is not None:
192            query["execution"] = execution
193        if limit is not None:
194            query["limit"] = limit
195        if after_cursor is not None:
196            query["after_cursor"] = after_cursor
197        return self._http.request(
198            "/api/v1/work_items",
199            query=query,
200            response_type=WorkflowWorkItemList,
201        )
202
203    def fail(self, work_item: str, input: WorkItemFailInput) -> None:
204        """
205        Fail workflow work and route its durable execution
206        Atomically records command failure, marks the work item failed, and either
207        wakes the workflow at the node's error edge or fails the owning run when no
208        error edge exists. Retrying the same lease and error is idempotent; a
209        different terminal payload conflicts.
210
211        Args:
212            work_item: Claimed or running work item ID.
213            input: Request body.
214            input.error: JSON-serializable failure returned by the worker.
215            input.lease_owner: Saved lease token.
216
217        Returns:
218            No content
219        """
220        self._http.request(f"/api/v1/work_items/{work_item}/fail", method="POST", body=input)
221
222    def heartbeat(self, work_item: str, input: WorkItemHeartbeatInput) -> None:
223        """
224        Extend a workflow work item lease
225
226        Args:
227            work_item: Claimed or running work item ID.
228            input: Request body.
229            input.lease_owner: Saved lease token.
230            input.lease_seconds: Replacement lease duration from 15 through 3600 seconds. Defaults to 300.
231
232        Returns:
233            No content
234        """
235        self._http.request(f"/api/v1/work_items/{work_item}/heartbeat", method="POST", body=input)
236
237    def start(self, work_item: str, input: WorkItemStartInput) -> None:
238        """
239        Mark claimed workflow work as running
240
241        Args:
242            work_item: Claimed work item ID.
243            input: Request body.
244            input.lease_owner: Saved lease token.
245
246        Returns:
247            No content
248        """
249        self._http.request(f"/api/v1/work_items/{work_item}/start", method="POST", body=input)
250
251    def submit(self, work_item: str, input: WorkItemSubmitInput) -> None:
252        """
253        Submit workflow work output and wake its durable execution
254        Atomically records the command completion, marks the work item succeeded,
255        advances the journal sequence, and enqueues the owning workflow continuation.
256        Retrying the same lease and result is idempotent; a different result conflicts.
257
258        Args:
259            work_item: Claimed or running work item ID.
260            input: Request body.
261            input.lease_owner: Saved lease token.
262            input.result: JSON-serializable output returned to the workflow.
263
264        Returns:
265            No content
266        """
267        self._http.request(f"/api/v1/work_items/{work_item}/submit", method="POST", body=input)
WorkItemResource(http: archastro.platform.runtime.http_client.SyncHttpClient)
164    def __init__(self, http: SyncHttpClient):
165        self._http = http
def list( self, *, execution: str | None = None, limit: int | None = None, after_cursor: str | None = None) -> archastro.platform.types.common.WorkflowWorkItemList:
167    def list(
168        self,
169        *,
170        execution: str | None = None,
171        limit: int | None = None,
172        after_cursor: str | None = None,
173    ) -> WorkflowWorkItemList:
174        """
175        List active workflow work available to the viewer
176        Lists queued, claimed, and running external work yielded by durable workflows.
177        The top-level collection includes work for every agent the viewer can execute;
178        the agent-nested collection limits results to that agent. This discovery
179        response never includes lease tokens. Use the agent claim endpoint to acquire
180        new work or resume a saved lease.
181
182        Args:
183            execution: Optional durable execution ID filter.
184            limit: Maximum work items per page. Defaults to 50; maximum is 100.
185            after_cursor: Opaque cursor for the next page of older queued work.
186
187        Returns:
188            Successful response
189        """
190        query: dict[str, object] = {}
191        if execution is not None:
192            query["execution"] = execution
193        if limit is not None:
194            query["limit"] = limit
195        if after_cursor is not None:
196            query["after_cursor"] = after_cursor
197        return self._http.request(
198            "/api/v1/work_items",
199            query=query,
200            response_type=WorkflowWorkItemList,
201        )

List active workflow work available to the viewer Lists queued, claimed, and running external work yielded by durable workflows. The top-level collection includes work for every agent the viewer can execute; the agent-nested collection limits results to that agent. This discovery response never includes lease tokens. Use the agent claim endpoint to acquire new work or resume a saved lease.

Arguments:
  • execution: Optional durable execution ID filter.
  • limit: Maximum work items per page. Defaults to 50; maximum is 100.
  • after_cursor: Opaque cursor for the next page of older queued work.
Returns:

Successful response

def fail( self, work_item: str, input: WorkItemFailInput) -> None:
203    def fail(self, work_item: str, input: WorkItemFailInput) -> None:
204        """
205        Fail workflow work and route its durable execution
206        Atomically records command failure, marks the work item failed, and either
207        wakes the workflow at the node's error edge or fails the owning run when no
208        error edge exists. Retrying the same lease and error is idempotent; a
209        different terminal payload conflicts.
210
211        Args:
212            work_item: Claimed or running work item ID.
213            input: Request body.
214            input.error: JSON-serializable failure returned by the worker.
215            input.lease_owner: Saved lease token.
216
217        Returns:
218            No content
219        """
220        self._http.request(f"/api/v1/work_items/{work_item}/fail", method="POST", body=input)

Fail workflow work and route its durable execution Atomically records command failure, marks the work item failed, and either wakes the workflow at the node's error edge or fails the owning run when no error edge exists. Retrying the same lease and error is idempotent; a different terminal payload conflicts.

Arguments:
  • work_item: Claimed or running work item ID.
  • input: Request body.
  • input.error: JSON-serializable failure returned by the worker.
  • input.lease_owner: Saved lease token.
Returns:

No content

def heartbeat( self, work_item: str, input: WorkItemHeartbeatInput) -> None:
222    def heartbeat(self, work_item: str, input: WorkItemHeartbeatInput) -> None:
223        """
224        Extend a workflow work item lease
225
226        Args:
227            work_item: Claimed or running work item ID.
228            input: Request body.
229            input.lease_owner: Saved lease token.
230            input.lease_seconds: Replacement lease duration from 15 through 3600 seconds. Defaults to 300.
231
232        Returns:
233            No content
234        """
235        self._http.request(f"/api/v1/work_items/{work_item}/heartbeat", method="POST", body=input)

Extend a workflow work item lease

Arguments:
  • work_item: Claimed or running work item ID.
  • input: Request body.
  • input.lease_owner: Saved lease token.
  • input.lease_seconds: Replacement lease duration from 15 through 3600 seconds. Defaults to 300.
Returns:

No content

def start( self, work_item: str, input: WorkItemStartInput) -> None:
237    def start(self, work_item: str, input: WorkItemStartInput) -> None:
238        """
239        Mark claimed workflow work as running
240
241        Args:
242            work_item: Claimed work item ID.
243            input: Request body.
244            input.lease_owner: Saved lease token.
245
246        Returns:
247            No content
248        """
249        self._http.request(f"/api/v1/work_items/{work_item}/start", method="POST", body=input)

Mark claimed workflow work as running

Arguments:
  • work_item: Claimed work item ID.
  • input: Request body.
  • input.lease_owner: Saved lease token.
Returns:

No content

def submit( self, work_item: str, input: WorkItemSubmitInput) -> None:
251    def submit(self, work_item: str, input: WorkItemSubmitInput) -> None:
252        """
253        Submit workflow work output and wake its durable execution
254        Atomically records the command completion, marks the work item succeeded,
255        advances the journal sequence, and enqueues the owning workflow continuation.
256        Retrying the same lease and result is idempotent; a different result conflicts.
257
258        Args:
259            work_item: Claimed or running work item ID.
260            input: Request body.
261            input.lease_owner: Saved lease token.
262            input.result: JSON-serializable output returned to the workflow.
263
264        Returns:
265            No content
266        """
267        self._http.request(f"/api/v1/work_items/{work_item}/submit", method="POST", body=input)

Submit workflow work output and wake its durable execution Atomically records the command completion, marks the work item succeeded, advances the journal sequence, and enqueues the owning workflow continuation. Retrying the same lease and result is idempotent; a different result conflicts.

Arguments:
  • work_item: Claimed or running work item ID.
  • input: Request body.
  • input.lease_owner: Saved lease token.
  • input.result: JSON-serializable output returned to the workflow.
Returns:

No content