|
2 | 2 |
|
3 | 3 | from typing import List, Optional |
4 | 4 | from datetime import datetime |
| 5 | +from typing_extensions import Literal |
5 | 6 |
|
6 | 7 | from ..scope import Scope |
7 | 8 | from ..._models import BaseModel |
@@ -59,9 +60,71 @@ class Schedule(BaseModel): |
59 | 60 |
|
60 | 61 |
|
61 | 62 | 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 |
63 | 70 | """Human-readable status message""" |
64 | 71 |
|
| 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 | + |
65 | 128 |
|
66 | 129 | class RunItem(BaseModel): |
67 | 130 | created_at: datetime |
@@ -155,3 +218,8 @@ class RunItem(BaseModel): |
155 | 218 | """Timestamp when the agent started working on the run (RFC3339)""" |
156 | 219 |
|
157 | 220 | 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