Skip to content

Commit ce55350

Browse files
feat(blueprints): prevent deletion of blueprints with dependent snapshots
1 parent 50340b2 commit ce55350

26 files changed

Lines changed: 1123 additions & 19 deletions

.stats.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 94
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/runloop-ai%2Frunloop-4f5fe47eea7a16fba1ba473532c7cb9687a113cf97e7b92bac014bca728f9505.yml
3-
openapi_spec_hash: ae55e0436d54e239a548e245fd19a863
4-
config_hash: 95facb8cef59b5a1b05763b871bf6a4b
1+
configured_endpoints: 97
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/runloop-ai%2Frunloop-4a14147d9603516ef2245584e4e44af8324cb1cbf130c3718bea39ad15b8084d.yml
3+
openapi_spec_hash: bfeae3e75e496683934b941a19396c4b
4+
config_hash: 2363f563f42501d2b1587a4f64bdccaf

api.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from runloop_api_client.types import (
55
AfterIdle,
66
AgentMountParameters,
7+
AgentSource,
78
CodeMountParameters,
89
LaunchParameters,
910
Mount,
@@ -47,6 +48,20 @@ Methods:
4748
- <code title="post /v1/benchmarks/runs/{id}/complete">client.benchmarks.runs.<a href="./src/runloop_api_client/resources/benchmarks/runs.py">complete</a>(id) -> <a href="./src/runloop_api_client/types/benchmark_run_view.py">BenchmarkRunView</a></code>
4849
- <code title="get /v1/benchmarks/runs/{id}/scenario_runs">client.benchmarks.runs.<a href="./src/runloop_api_client/resources/benchmarks/runs.py">list_scenario_runs</a>(id, \*\*<a href="src/runloop_api_client/types/benchmarks/run_list_scenario_runs_params.py">params</a>) -> <a href="./src/runloop_api_client/types/scenario_run_view.py">SyncBenchmarkRunsCursorIDPage[ScenarioRunView]</a></code>
4950

51+
# Agents
52+
53+
Types:
54+
55+
```python
56+
from runloop_api_client.types import AgentCreateParameters, AgentListView, AgentView
57+
```
58+
59+
Methods:
60+
61+
- <code title="post /v1/agents">client.agents.<a href="./src/runloop_api_client/resources/agents.py">create</a>(\*\*<a href="src/runloop_api_client/types/agent_create_params.py">params</a>) -> <a href="./src/runloop_api_client/types/agent_view.py">AgentView</a></code>
62+
- <code title="get /v1/agents/{id}">client.agents.<a href="./src/runloop_api_client/resources/agents.py">retrieve</a>(id) -> <a href="./src/runloop_api_client/types/agent_view.py">AgentView</a></code>
63+
- <code title="get /v1/agents">client.agents.<a href="./src/runloop_api_client/resources/agents.py">list</a>(\*\*<a href="src/runloop_api_client/types/agent_list_params.py">params</a>) -> <a href="./src/runloop_api_client/types/agent_view.py">SyncAgentsCursorIDPage[AgentView]</a></code>
64+
5065
# Blueprints
5166

5267
Types:

src/runloop_api_client/_client.py

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@
3131
)
3232

3333
if TYPE_CHECKING:
34-
from .resources import objects, secrets, devboxes, scenarios, benchmarks, blueprints, repositories
34+
from .resources import agents, objects, secrets, devboxes, scenarios, benchmarks, blueprints, repositories
35+
from .resources.agents import AgentsResource, AsyncAgentsResource
3536
from .resources.objects import ObjectsResource, AsyncObjectsResource
3637
from .resources.secrets import SecretsResource, AsyncSecretsResource
3738
from .resources.blueprints import BlueprintsResource, AsyncBlueprintsResource
@@ -106,6 +107,12 @@ def benchmarks(self) -> BenchmarksResource:
106107

107108
return BenchmarksResource(self)
108109

110+
@cached_property
111+
def agents(self) -> AgentsResource:
112+
from .resources.agents import AgentsResource
113+
114+
return AgentsResource(self)
115+
109116
@cached_property
110117
def blueprints(self) -> BlueprintsResource:
111118
from .resources.blueprints import BlueprintsResource
@@ -318,6 +325,12 @@ def benchmarks(self) -> AsyncBenchmarksResource:
318325

319326
return AsyncBenchmarksResource(self)
320327

328+
@cached_property
329+
def agents(self) -> AsyncAgentsResource:
330+
from .resources.agents import AsyncAgentsResource
331+
332+
return AsyncAgentsResource(self)
333+
321334
@cached_property
322335
def blueprints(self) -> AsyncBlueprintsResource:
323336
from .resources.blueprints import AsyncBlueprintsResource
@@ -479,6 +492,12 @@ def benchmarks(self) -> benchmarks.BenchmarksResourceWithRawResponse:
479492

480493
return BenchmarksResourceWithRawResponse(self._client.benchmarks)
481494

495+
@cached_property
496+
def agents(self) -> agents.AgentsResourceWithRawResponse:
497+
from .resources.agents import AgentsResourceWithRawResponse
498+
499+
return AgentsResourceWithRawResponse(self._client.agents)
500+
482501
@cached_property
483502
def blueprints(self) -> blueprints.BlueprintsResourceWithRawResponse:
484503
from .resources.blueprints import BlueprintsResourceWithRawResponse
@@ -528,6 +547,12 @@ def benchmarks(self) -> benchmarks.AsyncBenchmarksResourceWithRawResponse:
528547

529548
return AsyncBenchmarksResourceWithRawResponse(self._client.benchmarks)
530549

550+
@cached_property
551+
def agents(self) -> agents.AsyncAgentsResourceWithRawResponse:
552+
from .resources.agents import AsyncAgentsResourceWithRawResponse
553+
554+
return AsyncAgentsResourceWithRawResponse(self._client.agents)
555+
531556
@cached_property
532557
def blueprints(self) -> blueprints.AsyncBlueprintsResourceWithRawResponse:
533558
from .resources.blueprints import AsyncBlueprintsResourceWithRawResponse
@@ -577,6 +602,12 @@ def benchmarks(self) -> benchmarks.BenchmarksResourceWithStreamingResponse:
577602

578603
return BenchmarksResourceWithStreamingResponse(self._client.benchmarks)
579604

605+
@cached_property
606+
def agents(self) -> agents.AgentsResourceWithStreamingResponse:
607+
from .resources.agents import AgentsResourceWithStreamingResponse
608+
609+
return AgentsResourceWithStreamingResponse(self._client.agents)
610+
580611
@cached_property
581612
def blueprints(self) -> blueprints.BlueprintsResourceWithStreamingResponse:
582613
from .resources.blueprints import BlueprintsResourceWithStreamingResponse
@@ -626,6 +657,12 @@ def benchmarks(self) -> benchmarks.AsyncBenchmarksResourceWithStreamingResponse:
626657

627658
return AsyncBenchmarksResourceWithStreamingResponse(self._client.benchmarks)
628659

660+
@cached_property
661+
def agents(self) -> agents.AsyncAgentsResourceWithStreamingResponse:
662+
from .resources.agents import AsyncAgentsResourceWithStreamingResponse
663+
664+
return AsyncAgentsResourceWithStreamingResponse(self._client.agents)
665+
629666
@cached_property
630667
def blueprints(self) -> blueprints.AsyncBlueprintsResourceWithStreamingResponse:
631668
from .resources.blueprints import AsyncBlueprintsResourceWithStreamingResponse

src/runloop_api_client/pagination.py

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
"AsyncDiskSnapshotsCursorIDPage",
1717
"SyncBenchmarksCursorIDPage",
1818
"AsyncBenchmarksCursorIDPage",
19+
"SyncAgentsCursorIDPage",
20+
"AsyncAgentsCursorIDPage",
1921
"SyncBenchmarkRunsCursorIDPage",
2022
"AsyncBenchmarkRunsCursorIDPage",
2123
"SyncScenariosCursorIDPage",
@@ -56,6 +58,11 @@ class BenchmarksCursorIDPageItem(Protocol):
5658
id: str
5759

5860

61+
@runtime_checkable
62+
class AgentsCursorIDPageItem(Protocol):
63+
id: str
64+
65+
5966
@runtime_checkable
6067
class BenchmarkRunsCursorIDPageItem(Protocol):
6168
id: str
@@ -421,6 +428,74 @@ def next_page_info(self) -> Optional[PageInfo]:
421428
return PageInfo(params={"starting_after": item.id})
422429

423430

431+
class SyncAgentsCursorIDPage(BaseSyncPage[_T], BasePage[_T], Generic[_T]):
432+
agents: List[_T]
433+
has_more: Optional[bool] = None
434+
total_count: Optional[int] = None
435+
436+
@override
437+
def _get_page_items(self) -> List[_T]:
438+
agents = self.agents
439+
if not agents:
440+
return []
441+
return agents
442+
443+
@override
444+
def has_next_page(self) -> bool:
445+
has_more = self.has_more
446+
if has_more is not None and has_more is False:
447+
return False
448+
449+
return super().has_next_page()
450+
451+
@override
452+
def next_page_info(self) -> Optional[PageInfo]:
453+
agents = self.agents
454+
if not agents:
455+
return None
456+
457+
item = cast(Any, agents[-1])
458+
if not isinstance(item, AgentsCursorIDPageItem) or item.id is None: # pyright: ignore[reportUnnecessaryComparison]
459+
# TODO emit warning log
460+
return None
461+
462+
return PageInfo(params={"starting_after": item.id})
463+
464+
465+
class AsyncAgentsCursorIDPage(BaseAsyncPage[_T], BasePage[_T], Generic[_T]):
466+
agents: List[_T]
467+
has_more: Optional[bool] = None
468+
total_count: Optional[int] = None
469+
470+
@override
471+
def _get_page_items(self) -> List[_T]:
472+
agents = self.agents
473+
if not agents:
474+
return []
475+
return agents
476+
477+
@override
478+
def has_next_page(self) -> bool:
479+
has_more = self.has_more
480+
if has_more is not None and has_more is False:
481+
return False
482+
483+
return super().has_next_page()
484+
485+
@override
486+
def next_page_info(self) -> Optional[PageInfo]:
487+
agents = self.agents
488+
if not agents:
489+
return None
490+
491+
item = cast(Any, agents[-1])
492+
if not isinstance(item, AgentsCursorIDPageItem) or item.id is None: # pyright: ignore[reportUnnecessaryComparison]
493+
# TODO emit warning log
494+
return None
495+
496+
return PageInfo(params={"starting_after": item.id})
497+
498+
424499
class SyncBenchmarkRunsCursorIDPage(BaseSyncPage[_T], BasePage[_T], Generic[_T]):
425500
runs: List[_T]
426501
has_more: Optional[bool] = None

src/runloop_api_client/resources/__init__.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3+
from .agents import (
4+
AgentsResource,
5+
AsyncAgentsResource,
6+
AgentsResourceWithRawResponse,
7+
AsyncAgentsResourceWithRawResponse,
8+
AgentsResourceWithStreamingResponse,
9+
AsyncAgentsResourceWithStreamingResponse,
10+
)
311
from .objects import (
412
ObjectsResource,
513
AsyncObjectsResource,
@@ -64,6 +72,12 @@
6472
"AsyncBenchmarksResourceWithRawResponse",
6573
"BenchmarksResourceWithStreamingResponse",
6674
"AsyncBenchmarksResourceWithStreamingResponse",
75+
"AgentsResource",
76+
"AsyncAgentsResource",
77+
"AgentsResourceWithRawResponse",
78+
"AsyncAgentsResourceWithRawResponse",
79+
"AgentsResourceWithStreamingResponse",
80+
"AsyncAgentsResourceWithStreamingResponse",
6781
"BlueprintsResource",
6882
"AsyncBlueprintsResource",
6983
"BlueprintsResourceWithRawResponse",

0 commit comments

Comments
 (0)