|
2 | 2 |
|
3 | 3 | from typing import List, Optional |
4 | 4 | from datetime import datetime |
5 | | -from typing_extensions import Literal |
6 | 5 |
|
| 6 | +from ..scope import Scope |
7 | 7 | from ..._models import BaseModel |
8 | 8 | from .run_state import RunState |
| 9 | +from ..error_code import ErrorCode |
9 | 10 | from ..user_profile import UserProfile |
10 | 11 | from .artifact_item import ArtifactItem |
11 | 12 | from .run_source_type import RunSourceType |
12 | 13 | from ..ambient_agent_config import AmbientAgentConfig |
13 | 14 |
|
14 | | -__all__ = ["RunItem", "AgentSkill", "RequestUsage", "Schedule", "Scope", "StatusMessage"] |
| 15 | +__all__ = ["RunItem", "AgentSkill", "RequestUsage", "Schedule", "StatusMessage"] |
15 | 16 |
|
16 | 17 |
|
17 | 18 | class AgentSkill(BaseModel): |
@@ -58,19 +59,52 @@ class Schedule(BaseModel): |
58 | 59 | """Name of the schedule at the time the run was created""" |
59 | 60 |
|
60 | 61 |
|
61 | | -class Scope(BaseModel): |
62 | | - """Ownership scope for a resource (team or personal)""" |
| 62 | +class StatusMessage(BaseModel): |
| 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 | + """ |
63 | 68 |
|
64 | | - type: Literal["User", "Team"] |
65 | | - """Type of ownership ("User" for personal, "Team" for team-owned)""" |
| 69 | + message: str |
| 70 | + """Human-readable status message""" |
66 | 71 |
|
67 | | - uid: Optional[str] = None |
68 | | - """UID of the owning user or team""" |
| 72 | + error_code: Optional[ErrorCode] = None |
| 73 | + """ |
| 74 | + Machine-readable error code identifying the problem type. Used in the `type` URI |
| 75 | + of Error responses and in the `error_code` field of RunStatusMessage. |
| 76 | +
|
| 77 | + User errors (run transitions to FAILED): |
| 78 | +
|
| 79 | + - `insufficient_credits` — Team has no remaining add-on credits |
| 80 | + - `feature_not_available` — Required feature not enabled for user's plan |
| 81 | + - `external_authentication_required` — User hasn't authorized a required |
| 82 | + external service |
| 83 | + - `not_authorized` — Principal lacks permission for the requested operation |
| 84 | + - `invalid_request` — Request is malformed or contains invalid parameters |
| 85 | + - `resource_not_found` — Referenced resource does not exist |
| 86 | + - `budget_exceeded` — Spending budget limit has been reached |
| 87 | + - `integration_disabled` — Integration is disabled and must be enabled |
| 88 | + - `integration_not_configured` — Integration setup is incomplete |
| 89 | + - `operation_not_supported` — Requested operation not supported for this |
| 90 | + resource/state |
| 91 | + - `environment_setup_failed` — Client-side environment setup failed |
| 92 | + - `content_policy_violation` — Prompt or setup commands violated content policy |
| 93 | + - `conflict` — Request conflicts with the current state of the resource |
| 94 | +
|
| 95 | + Warp errors (run transitions to ERROR): |
| 96 | +
|
| 97 | + - `authentication_required` — Request lacks valid authentication credentials |
| 98 | + - `resource_unavailable` — Transient infrastructure issue (retryable) |
| 99 | + - `internal_error` — Unexpected server-side error (retryable) |
| 100 | + """ |
69 | 101 |
|
| 102 | + retryable: Optional[bool] = None |
| 103 | + """Whether the error is transient and the client may retry by submitting a new run. |
70 | 104 |
|
71 | | -class StatusMessage(BaseModel): |
72 | | - message: Optional[str] = None |
73 | | - """Human-readable status message""" |
| 105 | + Only present on terminal error states. When false, retrying without addressing |
| 106 | + the underlying cause will not succeed. |
| 107 | + """ |
74 | 108 |
|
75 | 109 |
|
76 | 110 | class RunItem(BaseModel): |
@@ -165,3 +199,8 @@ class RunItem(BaseModel): |
165 | 199 | """Timestamp when the agent started working on the run (RFC3339)""" |
166 | 200 |
|
167 | 201 | status_message: Optional[StatusMessage] = None |
| 202 | + """Status message for a run. |
| 203 | +
|
| 204 | + For terminal error states, includes structured error code and retryability info |
| 205 | + from the platform error catalog. |
| 206 | + """ |
0 commit comments