Skip to content

Commit 8bfda3e

Browse files
feat(api): manual updates
adding platform error codes
1 parent 8e21bd6 commit 8bfda3e

File tree

3 files changed

+81
-5
lines changed

3 files changed

+81
-5
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 14
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/warp-bnavetta%2Fwarp-api-d3d485104a1c344076e6268935d0a5371036c95885b3fa6200c635f1351d2e25.yml
3-
openapi_spec_hash: 34c237455d4b5b60f9db14068d1a9999
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/warp-bnavetta%2Fwarp-api-39e18bbb8b0af73eca7a880f56afbdecd69e3e5bab82a04c4d6429c32d7e6727.yml
3+
openapi_spec_hash: 7a0de988bb37416d6e80f4a4bbe9d0d0
44
config_hash: 0884847870200ee9d34bb00ce94aaa8e

src/oz_agent_sdk/resources/agent/runs.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,11 @@ def cancel(
204204
"""Cancel an agent run that is currently queued or in progress.
205205
206206
Once cancelled, the
207-
run will transition to a failed state.
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.
208212
209213
Args:
210214
extra_headers: Send extra headers
@@ -402,7 +406,11 @@ async def cancel(
402406
"""Cancel an agent run that is currently queued or in progress.
403407
404408
Once cancelled, the
405-
run will transition to a failed state.
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.
406414
407415
Args:
408416
extra_headers: Send extra headers

src/oz_agent_sdk/types/agent/run_item.py

Lines changed: 69 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from typing import List, Optional
44
from datetime import datetime
5+
from typing_extensions import Literal
56

67
from ..scope import Scope
78
from ..._models import BaseModel
@@ -59,9 +60,71 @@ class Schedule(BaseModel):
5960

6061

6162
class StatusMessage(BaseModel):
62-
message: Optional[str] = None
63+
"""Status message for a run.
64+
65+
For terminal error states, includes structured
66+
error code and retryability info from the platform error catalog.
67+
"""
68+
69+
message: str
6370
"""Human-readable status message"""
6471

72+
error_code: Optional[
73+
Literal[
74+
"insufficient_credits",
75+
"feature_not_available",
76+
"external_authentication_required",
77+
"not_authorized",
78+
"invalid_request",
79+
"resource_not_found",
80+
"budget_exceeded",
81+
"integration_disabled",
82+
"integration_not_configured",
83+
"operation_not_supported",
84+
"environment_setup_failed",
85+
"content_policy_violation",
86+
"conflict",
87+
"authentication_required",
88+
"resource_unavailable",
89+
"internal_error",
90+
]
91+
] = None
92+
"""
93+
Machine-readable error code identifying the problem type. Used in the `type` URI
94+
of Error responses and in the `error_code` field of RunStatusMessage.
95+
96+
User errors (run transitions to FAILED):
97+
98+
- `insufficient_credits` — Team has no remaining add-on credits
99+
- `feature_not_available` — Required feature not enabled for user's plan
100+
- `external_authentication_required` — User hasn't authorized a required
101+
external service
102+
- `not_authorized` — Principal lacks permission for the requested operation
103+
- `invalid_request` — Request is malformed or contains invalid parameters
104+
- `resource_not_found` — Referenced resource does not exist
105+
- `budget_exceeded` — Spending budget limit has been reached
106+
- `integration_disabled` — Integration is disabled and must be enabled
107+
- `integration_not_configured` — Integration setup is incomplete
108+
- `operation_not_supported` — Requested operation not supported for this
109+
resource/state
110+
- `environment_setup_failed` — Client-side environment setup failed
111+
- `content_policy_violation` — Prompt or setup commands violated content policy
112+
- `conflict` — Request conflicts with the current state of the resource
113+
114+
Warp errors (run transitions to ERROR):
115+
116+
- `authentication_required` — Request lacks valid authentication credentials
117+
- `resource_unavailable` — Transient infrastructure issue (retryable)
118+
- `internal_error` — Unexpected server-side error (retryable)
119+
"""
120+
121+
retryable: Optional[bool] = None
122+
"""Whether the error is transient and the client may retry by submitting a new run.
123+
124+
Only present on terminal error states. When false, retrying without addressing
125+
the underlying cause will not succeed.
126+
"""
127+
65128

66129
class RunItem(BaseModel):
67130
created_at: datetime
@@ -155,3 +218,8 @@ class RunItem(BaseModel):
155218
"""Timestamp when the agent started working on the run (RFC3339)"""
156219

157220
status_message: Optional[StatusMessage] = None
221+
"""Status message for a run.
222+
223+
For terminal error states, includes structured error code and retryability info
224+
from the platform error catalog.
225+
"""

0 commit comments

Comments
 (0)