|
7 | 7 | from ..scope import Scope |
8 | 8 | from ..._models import BaseModel |
9 | 9 | from .run_state import RunState |
10 | | -from .agent_skill import AgentSkill |
| 10 | +from ..error_code import ErrorCode |
11 | 11 | from ..user_profile import UserProfile |
12 | 12 | from .artifact_item import ArtifactItem |
13 | | -from .request_usage import RequestUsage |
14 | | -from .schedule_info import ScheduleInfo |
15 | 13 | from .run_source_type import RunSourceType |
16 | | -from .run_status_message import RunStatusMessage |
17 | 14 | from ..ambient_agent_config import AmbientAgentConfig |
18 | 15 |
|
19 | | -__all__ = ["RunItem"] |
| 16 | +__all__ = ["RunItem", "AgentSkill", "RequestUsage", "Schedule", "StatusMessage"] |
| 17 | + |
| 18 | + |
| 19 | +class AgentSkill(BaseModel): |
| 20 | + """ |
| 21 | + Information about the agent skill used for the run. |
| 22 | + Either full_path or bundled_skill_id will be set, but not both. |
| 23 | + """ |
| 24 | + |
| 25 | + bundled_skill_id: Optional[str] = None |
| 26 | + """Unique identifier for bundled skills""" |
| 27 | + |
| 28 | + description: Optional[str] = None |
| 29 | + """Description of the skill""" |
| 30 | + |
| 31 | + full_path: Optional[str] = None |
| 32 | + """Path to the SKILL.md file (for file-based skills)""" |
| 33 | + |
| 34 | + name: Optional[str] = None |
| 35 | + """Human-readable name of the skill""" |
| 36 | + |
| 37 | + |
| 38 | +class RequestUsage(BaseModel): |
| 39 | + """Resource usage information for the run""" |
| 40 | + |
| 41 | + compute_cost: Optional[float] = None |
| 42 | + """Cost of compute resources for the run""" |
| 43 | + |
| 44 | + inference_cost: Optional[float] = None |
| 45 | + """Cost of LLM inference for the run""" |
| 46 | + |
| 47 | + |
| 48 | +class Schedule(BaseModel): |
| 49 | + """ |
| 50 | + Information about the schedule that triggered this run (only present for scheduled runs) |
| 51 | + """ |
| 52 | + |
| 53 | + cron_schedule: str |
| 54 | + """Cron expression at the time the run was created""" |
| 55 | + |
| 56 | + schedule_id: str |
| 57 | + """Unique identifier for the schedule""" |
| 58 | + |
| 59 | + schedule_name: str |
| 60 | + """Name of the schedule at the time the run was created""" |
| 61 | + |
| 62 | + |
| 63 | +class StatusMessage(BaseModel): |
| 64 | + """Status message for a run. |
| 65 | +
|
| 66 | + For terminal error states, includes structured |
| 67 | + error code and retryability info from the platform error catalog. |
| 68 | + """ |
| 69 | + |
| 70 | + message: str |
| 71 | + """Human-readable status message""" |
| 72 | + |
| 73 | + error_code: Optional[ErrorCode] = None |
| 74 | + """ |
| 75 | + Machine-readable error code identifying the problem type. Used in the `type` URI |
| 76 | + of Error responses and in the `error_code` field of RunStatusMessage. |
| 77 | +
|
| 78 | + User errors (run transitions to FAILED): |
| 79 | +
|
| 80 | + - `insufficient_credits` — Team has no remaining add-on credits |
| 81 | + - `feature_not_available` — Required feature not enabled for user's plan |
| 82 | + - `external_authentication_required` — User hasn't authorized a required |
| 83 | + external service |
| 84 | + - `not_authorized` — Principal lacks permission for the requested operation |
| 85 | + - `invalid_request` — Request is malformed or contains invalid parameters |
| 86 | + - `resource_not_found` — Referenced resource does not exist |
| 87 | + - `budget_exceeded` — Spending budget limit has been reached |
| 88 | + - `integration_disabled` — Integration is disabled and must be enabled |
| 89 | + - `integration_not_configured` — Integration setup is incomplete |
| 90 | + - `operation_not_supported` — Requested operation not supported for this |
| 91 | + resource/state |
| 92 | + - `environment_setup_failed` — Client-side environment setup failed |
| 93 | + - `content_policy_violation` — Prompt or setup commands violated content policy |
| 94 | + - `conflict` — Request conflicts with the current state of the resource |
| 95 | +
|
| 96 | + Warp errors (run transitions to ERROR): |
| 97 | +
|
| 98 | + - `authentication_required` — Request lacks valid authentication credentials |
| 99 | + - `resource_unavailable` — Transient infrastructure issue (retryable) |
| 100 | + - `internal_error` — Unexpected server-side error (retryable) |
| 101 | + """ |
| 102 | + |
| 103 | + retryable: Optional[bool] = None |
| 104 | + """Whether the error is transient and the client may retry by submitting a new run. |
| 105 | +
|
| 106 | + Only present on terminal error states. When false, retrying without addressing |
| 107 | + the underlying cause will not succeed. |
| 108 | + """ |
20 | 109 |
|
21 | 110 |
|
22 | 111 | class RunItem(BaseModel): |
@@ -85,7 +174,7 @@ class RunItem(BaseModel): |
85 | 174 | request_usage: Optional[RequestUsage] = None |
86 | 175 | """Resource usage information for the run""" |
87 | 176 |
|
88 | | - schedule: Optional[ScheduleInfo] = None |
| 177 | + schedule: Optional[Schedule] = None |
89 | 178 | """ |
90 | 179 | Information about the schedule that triggered this run (only present for |
91 | 180 | scheduled runs) |
@@ -117,7 +206,7 @@ class RunItem(BaseModel): |
117 | 206 | started_at: Optional[datetime] = None |
118 | 207 | """Timestamp when the agent started working on the run (RFC3339)""" |
119 | 208 |
|
120 | | - status_message: Optional[RunStatusMessage] = None |
| 209 | + status_message: Optional[StatusMessage] = None |
121 | 210 | """Status message for a run. |
122 | 211 |
|
123 | 212 | For terminal error states, includes structured error code and retryability info |
|
0 commit comments