Skip to content

Commit 9c2f6a3

Browse files
feat(api): fix schema version issues
1 parent 0cc041e commit 9c2f6a3

File tree

10 files changed

+134
-39
lines changed

10 files changed

+134
-39
lines changed

.stats.yml

Lines changed: 3 additions & 3 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-a368122275968e270e3e786e6cf176ae87aa56ef85e3270ed59da99c87996dc8.yml
3-
openapi_spec_hash: 86cab7da7cb620fc90482f50d92acf70
4-
config_hash: 25c1059aa958c8c2ad60ef16c318514d
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/warp-bnavetta%2Fwarp-api-6c175d34cab49d79dbb24289ae516867404c42f3097264bbae171aced72ecc49.yml
3+
openapi_spec_hash: 5abb55a1fc2836207bc88d4815f47f24
4+
config_hash: a28c6f6a70109573c79cd87a158124dc

api.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ from oz_agent_sdk.types import (
77
AgentSkill,
88
AmbientAgentConfig,
99
CloudEnvironmentConfig,
10+
Error,
11+
ErrorCode,
1012
McpServerConfig,
13+
Scope,
1114
UserProfile,
1215
AgentListResponse,
1316
AgentGetArtifactResponse,
@@ -48,6 +51,7 @@ Types:
4851

4952
```python
5053
from oz_agent_sdk.types.agent import (
54+
ScheduleHistoryItem,
5155
ScheduledAgentItem,
5256
ScheduleListResponse,
5357
ScheduleDeleteResponse,

src/oz_agent_sdk/resources/agent/runs.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,11 @@ def cancel(
217217
"""Cancel an agent run that is currently queued or in progress.
218218
219219
Once cancelled, the
220-
run will transition to a failed state.
220+
run will transition to a cancelled state.
221+
222+
Not all runs can be cancelled. Runs that are in a terminal state (SUCCEEDED,
223+
FAILED, ERROR, BLOCKED, CANCELLED) return 400. Runs in PENDING state return 409
224+
(retry after a moment). Self-hosted, local, and GitHub Action runs return 422.
221225
222226
Args:
223227
extra_headers: Send extra headers
@@ -428,7 +432,11 @@ async def cancel(
428432
"""Cancel an agent run that is currently queued or in progress.
429433
430434
Once cancelled, the
431-
run will transition to a failed state.
435+
run will transition to a cancelled state.
436+
437+
Not all runs can be cancelled. Runs that are in a terminal state (SUCCEEDED,
438+
FAILED, ERROR, BLOCKED, CANCELLED) return 400. Runs in PENDING state return 409
439+
(retry after a moment). Self-hosted, local, and GitHub Action runs return 422.
432440
433441
Args:
434442
extra_headers: Send extra headers

src/oz_agent_sdk/types/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
from __future__ import annotations
44

5+
from .scope import Scope as Scope
6+
from .error_code import ErrorCode as ErrorCode
57
from .agent_skill import AgentSkill as AgentSkill
68
from .user_profile import UserProfile as UserProfile
79
from .agent_run_params import AgentRunParams as AgentRunParams

src/oz_agent_sdk/types/agent/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from .run_list_response import RunListResponse as RunListResponse
1111
from .run_cancel_response import RunCancelResponse as RunCancelResponse
1212
from .scheduled_agent_item import ScheduledAgentItem as ScheduledAgentItem
13+
from .schedule_history_item import ScheduleHistoryItem as ScheduleHistoryItem
1314
from .schedule_create_params import ScheduleCreateParams as ScheduleCreateParams
1415
from .schedule_list_response import ScheduleListResponse as ScheduleListResponse
1516
from .schedule_update_params import ScheduleUpdateParams as ScheduleUpdateParams

src/oz_agent_sdk/types/agent/run_item.py

Lines changed: 50 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,17 @@
22

33
from typing import List, Optional
44
from datetime import datetime
5-
from typing_extensions import Literal
65

6+
from ..scope import Scope
77
from ..._models import BaseModel
88
from .run_state import RunState
9+
from ..error_code import ErrorCode
910
from ..user_profile import UserProfile
1011
from .artifact_item import ArtifactItem
1112
from .run_source_type import RunSourceType
1213
from ..ambient_agent_config import AmbientAgentConfig
1314

14-
__all__ = ["RunItem", "AgentSkill", "RequestUsage", "Schedule", "Scope", "StatusMessage"]
15+
__all__ = ["RunItem", "AgentSkill", "RequestUsage", "Schedule", "StatusMessage"]
1516

1617

1718
class AgentSkill(BaseModel):
@@ -58,19 +59,52 @@ class Schedule(BaseModel):
5859
"""Name of the schedule at the time the run was created"""
5960

6061

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+
"""
6368

64-
type: Literal["User", "Team"]
65-
"""Type of ownership ("User" for personal, "Team" for team-owned)"""
69+
message: str
70+
"""Human-readable status message"""
6671

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+
"""
69101

102+
retryable: Optional[bool] = None
103+
"""Whether the error is transient and the client may retry by submitting a new run.
70104
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+
"""
74108

75109

76110
class RunItem(BaseModel):
@@ -165,3 +199,8 @@ class RunItem(BaseModel):
165199
"""Timestamp when the agent started working on the run (RFC3339)"""
166200

167201
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+
"""
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from typing import Optional
4+
from datetime import datetime
5+
6+
from ..._models import BaseModel
7+
8+
__all__ = ["ScheduleHistoryItem"]
9+
10+
11+
class ScheduleHistoryItem(BaseModel):
12+
"""Scheduler-derived history metadata for a scheduled agent"""
13+
14+
last_ran: Optional[datetime] = None
15+
"""Timestamp of the last successful run (RFC3339)"""
16+
17+
next_run: Optional[datetime] = None
18+
"""Timestamp of the next scheduled run (RFC3339)"""

src/oz_agent_sdk/types/agent/scheduled_agent_item.py

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,15 @@
22

33
from typing import Optional
44
from datetime import datetime
5-
from typing_extensions import Literal
65

6+
from ..scope import Scope
77
from ..._models import BaseModel
88
from ..user_profile import UserProfile
99
from ..ambient_agent_config import AmbientAgentConfig
10+
from .schedule_history_item import ScheduleHistoryItem
1011
from ..cloud_environment_config import CloudEnvironmentConfig
1112

12-
__all__ = ["ScheduledAgentItem", "History", "Scope"]
13-
14-
15-
class History(BaseModel):
16-
"""Scheduler-derived history metadata for a scheduled agent"""
17-
18-
last_ran: Optional[datetime] = None
19-
"""Timestamp of the last successful run (RFC3339)"""
20-
21-
next_run: Optional[datetime] = None
22-
"""Timestamp of the next scheduled run (RFC3339)"""
23-
24-
25-
class Scope(BaseModel):
26-
"""Ownership scope for a resource (team or personal)"""
27-
28-
type: Literal["User", "Team"]
29-
"""Type of ownership ("User" for personal, "Team" for team-owned)"""
30-
31-
uid: Optional[str] = None
32-
"""UID of the owning user or team"""
13+
__all__ = ["ScheduledAgentItem"]
3314

3415

3516
class ScheduledAgentItem(BaseModel):
@@ -65,7 +46,7 @@ class ScheduledAgentItem(BaseModel):
6546
environment: Optional[CloudEnvironmentConfig] = None
6647
"""Configuration for a cloud environment used by scheduled agents"""
6748

68-
history: Optional[History] = None
49+
history: Optional[ScheduleHistoryItem] = None
6950
"""Scheduler-derived history metadata for a scheduled agent"""
7051

7152
last_spawn_error: Optional[str] = None
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from typing_extensions import Literal, TypeAlias
4+
5+
__all__ = ["ErrorCode"]
6+
7+
ErrorCode: TypeAlias = Literal[
8+
"insufficient_credits",
9+
"feature_not_available",
10+
"external_authentication_required",
11+
"not_authorized",
12+
"invalid_request",
13+
"resource_not_found",
14+
"budget_exceeded",
15+
"integration_disabled",
16+
"integration_not_configured",
17+
"operation_not_supported",
18+
"environment_setup_failed",
19+
"content_policy_violation",
20+
"conflict",
21+
"authentication_required",
22+
"resource_unavailable",
23+
"internal_error",
24+
]

src/oz_agent_sdk/types/scope.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from typing import Optional
4+
from typing_extensions import Literal
5+
6+
from .._models import BaseModel
7+
8+
__all__ = ["Scope"]
9+
10+
11+
class Scope(BaseModel):
12+
"""Ownership scope for a resource (team or personal)"""
13+
14+
type: Literal["User", "Team"]
15+
"""Type of ownership ("User" for personal, "Team" for team-owned)"""
16+
17+
uid: Optional[str] = None
18+
"""UID of the owning user or team"""

0 commit comments

Comments
 (0)