Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 36
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/runloop-ai%2Frunloop-ea589851f2dbba35fea6c010ac4c577cad56aa44e1d5bd4e5b472c802b2f13c4.yml
configured_endpoints: 24
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/runloop-ai%2Frunloop-2085d09cb7954db9bd300c0d93f1f08e25b69906011c0d65e899951880372ef1.yml
49 changes: 12 additions & 37 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,36 +43,16 @@ Types:
from runloop_api_client.types import CodeMountParameters
```

# Deployments

Types:

```python
from runloop_api_client.types import (
DeploymentRetrieveResponse,
DeploymentGetResponse,
DeploymentLogsResponse,
DeploymentRedeployResponse,
DeploymentTailResponse,
)
```

Methods:

- <code title="get /v1/deployments/{deployment_id}">client.deployments.<a href="./src/runloop_api_client/resources/deployments.py">retrieve</a>(deployment_id) -> <a href="./src/runloop_api_client/types/deployment_retrieve_response.py">DeploymentRetrieveResponse</a></code>
- <code title="get /v1/deployments">client.deployments.<a href="./src/runloop_api_client/resources/deployments.py">get</a>(\*\*<a href="src/runloop_api_client/types/deployment_get_params.py">params</a>) -> <a href="./src/runloop_api_client/types/deployment_get_response.py">DeploymentGetResponse</a></code>
- <code title="get /v1/deployments/{deployment_id}/logs">client.deployments.<a href="./src/runloop_api_client/resources/deployments.py">logs</a>(deployment_id) -> <a href="./src/runloop_api_client/types/deployment_logs_response.py">DeploymentLogsResponse</a></code>
- <code title="post /v1/deployments/{deployment_id}/redeploy">client.deployments.<a href="./src/runloop_api_client/resources/deployments.py">redeploy</a>(deployment_id) -> <a href="./src/runloop_api_client/types/deployment_redeploy_response.py">DeploymentRedeployResponse</a></code>
- <code title="get /v1/deployments/{deployment_id}/logs/tail">client.deployments.<a href="./src/runloop_api_client/resources/deployments.py">tail</a>(deployment_id) -> <a href="./src/runloop_api_client/types/deployment_tail_response.py">DeploymentTailResponse</a></code>

# Devboxes

Types:

```python
from runloop_api_client.types import (
DevboxAsyncExecutionDetailView,
DevboxExecutionDetailView,
DevboxListView,
DevboxView,
DevboxListResponse,
DevboxCreateSSHKeyResponse,
DevboxReadFileContentsResponse,
DevboxUploadFileResponse,
Expand All @@ -83,7 +63,7 @@ Methods:

- <code title="post /v1/devboxes">client.devboxes.<a href="./src/runloop_api_client/resources/devboxes/devboxes.py">create</a>(\*\*<a href="src/runloop_api_client/types/devbox_create_params.py">params</a>) -> <a href="./src/runloop_api_client/types/devbox_view.py">DevboxView</a></code>
- <code title="get /v1/devboxes/{id}">client.devboxes.<a href="./src/runloop_api_client/resources/devboxes/devboxes.py">retrieve</a>(id) -> <a href="./src/runloop_api_client/types/devbox_view.py">DevboxView</a></code>
- <code title="get /v1/devboxes">client.devboxes.<a href="./src/runloop_api_client/resources/devboxes/devboxes.py">list</a>(\*\*<a href="src/runloop_api_client/types/devbox_list_params.py">params</a>) -> <a href="./src/runloop_api_client/types/devbox_list_response.py">DevboxListResponse</a></code>
- <code title="get /v1/devboxes">client.devboxes.<a href="./src/runloop_api_client/resources/devboxes/devboxes.py">list</a>(\*\*<a href="src/runloop_api_client/types/devbox_list_params.py">params</a>) -> <a href="./src/runloop_api_client/types/devbox_list_view.py">DevboxListView</a></code>
- <code title="post /v1/devboxes/{id}/create_ssh_key">client.devboxes.<a href="./src/runloop_api_client/resources/devboxes/devboxes.py">create_ssh_key</a>(id) -> <a href="./src/runloop_api_client/types/devbox_create_ssh_key_response.py">DevboxCreateSSHKeyResponse</a></code>
- <code title="post /v1/devboxes/{id}/executions/execute_async">client.devboxes.<a href="./src/runloop_api_client/resources/devboxes/devboxes.py">execute_async</a>(id, \*\*<a href="src/runloop_api_client/types/devbox_execute_async_params.py">params</a>) -> <a href="./src/runloop_api_client/types/devboxes/devbox_async_execution_detail_view.py">DevboxAsyncExecutionDetailView</a></code>
- <code title="post /v1/devboxes/{id}/execute_sync">client.devboxes.<a href="./src/runloop_api_client/resources/devboxes/devboxes.py">execute_sync</a>(id, \*\*<a href="src/runloop_api_client/types/devbox_execute_sync_params.py">params</a>) -> <a href="./src/runloop_api_client/types/devboxes/devbox_execution_detail_view.py">DevboxExecutionDetailView</a></code>
Expand All @@ -94,10 +74,15 @@ Methods:

## Logs

Types:

```python
from runloop_api_client.types.devboxes import DevboxLogsListView
```

Methods:

- <code title="get /v1/devboxes/{id}/logs">client.devboxes.logs.<a href="./src/runloop_api_client/resources/devboxes/logs.py">list</a>(id) -> <a href="./src/runloop_api_client/types/devboxes/devbox_logs_list_view.py">DevboxLogsListView</a></code>
- <code title="get /v1/devboxes/{id}/logs/tail">client.devboxes.logs.<a href="./src/runloop_api_client/resources/devboxes/logs.py">tail</a>(id) -> None</code>

## Executions

Expand All @@ -113,46 +98,36 @@ from runloop_api_client.types.devboxes import (

Methods:

- <code title="post /v1/devboxes/{id}/executions/{exeId}">client.devboxes.executions.<a href="./src/runloop_api_client/resources/devboxes/executions.py">retrieve</a>(exe_id, \*, id, \*\*<a href="src/runloop_api_client/types/devboxes/execution_retrieve_params.py">params</a>) -> <a href="./src/runloop_api_client/types/devboxes/devbox_async_execution_detail_view.py">DevboxAsyncExecutionDetailView</a></code>
- <code title="post /v1/devboxes/{id}/executions/execute_async">client.devboxes.executions.<a href="./src/runloop_api_client/resources/devboxes/executions.py">execute_async</a>(id, \*\*<a href="src/runloop_api_client/types/devboxes/execution_execute_async_params.py">params</a>) -> <a href="./src/runloop_api_client/types/devboxes/devbox_async_execution_detail_view.py">DevboxAsyncExecutionDetailView</a></code>
- <code title="post /v1/devboxes/{id}/execute_sync">client.devboxes.executions.<a href="./src/runloop_api_client/resources/devboxes/executions.py">execute_sync</a>(id, \*\*<a href="src/runloop_api_client/types/devboxes/execution_execute_sync_params.py">params</a>) -> <a href="./src/runloop_api_client/types/devboxes/devbox_execution_detail_view.py">DevboxExecutionDetailView</a></code>
- <code title="post /v1/devboxes/{id}/executions/{exeId}/kill">client.devboxes.executions.<a href="./src/runloop_api_client/resources/devboxes/executions.py">kill</a>(exe_id, \*, id) -> <a href="./src/runloop_api_client/types/devboxes/devbox_async_execution_detail_view.py">DevboxAsyncExecutionDetailView</a></code>
- <code title="get /v1/devboxes/{id}/executions/{execution_id}/logs">client.devboxes.executions.<a href="./src/runloop_api_client/resources/devboxes/executions.py">logs</a>(execution_id, \*, id) -> <a href="./src/runloop_api_client/types/devboxes/devbox_logs_list_view.py">DevboxLogsListView</a></code>
- <code title="get /v1/devboxes/{id}/executions/{execution_id}/logs/tail">client.devboxes.executions.<a href="./src/runloop_api_client/resources/devboxes/executions.py">tail</a>(execution_id, \*, id) -> None</code>

# Functions

Types:

```python
from runloop_api_client.types import FunctionListView, FunctionListOpenAPIResponse
from runloop_api_client.types import FunctionListView
```

Methods:

- <code title="get /v1/functions">client.functions.<a href="./src/runloop_api_client/resources/functions/functions.py">list</a>() -> <a href="./src/runloop_api_client/types/function_list_view.py">FunctionListView</a></code>
- <code title="post /v1/functions/{project_name}/{function_name}/invoke_async">client.functions.<a href="./src/runloop_api_client/resources/functions/functions.py">invoke_async</a>(function_name, \*, project_name, \*\*<a href="src/runloop_api_client/types/function_invoke_async_params.py">params</a>) -> <a href="./src/runloop_api_client/types/shared/function_invocation_execution_detail_view.py">FunctionInvocationExecutionDetailView</a></code>
- <code title="post /v1/functions/{project_name}/{function_name}/invoke_sync">client.functions.<a href="./src/runloop_api_client/resources/functions/functions.py">invoke_sync</a>(function_name, \*, project_name, \*\*<a href="src/runloop_api_client/types/function_invoke_sync_params.py">params</a>) -> <a href="./src/runloop_api_client/types/shared/function_invocation_execution_detail_view.py">FunctionInvocationExecutionDetailView</a></code>
- <code title="get /v1/functions/openapi">client.functions.<a href="./src/runloop_api_client/resources/functions/functions.py">list_openapi</a>() -> <a href="./src/runloop_api_client/types/function_list_openapi_response.py">object</a></code>

## Invocations

Types:

```python
from runloop_api_client.types.functions import (
FunctionInvocationListView,
KillOperationResponse,
InvocationLogsResponse,
)
from runloop_api_client.types.functions import FunctionInvocationListView, KillOperationResponse
```

Methods:

- <code title="get /v1/functions/invocations/{invocationId}">client.functions.invocations.<a href="./src/runloop_api_client/resources/functions/invocations.py">retrieve</a>(invocation_id) -> <a href="./src/runloop_api_client/types/shared/function_invocation_execution_detail_view.py">FunctionInvocationExecutionDetailView</a></code>
- <code title="get /v1/functions/invocations">client.functions.invocations.<a href="./src/runloop_api_client/resources/functions/invocations.py">list</a>(\*\*<a href="src/runloop_api_client/types/functions/invocation_list_params.py">params</a>) -> <a href="./src/runloop_api_client/types/functions/function_invocation_list_view.py">FunctionInvocationListView</a></code>
- <code title="post /v1/functions/invocations/{invocationId}/kill">client.functions.invocations.<a href="./src/runloop_api_client/resources/functions/invocations.py">kill</a>(invocation_id) -> <a href="./src/runloop_api_client/types/functions/kill_operation_response.py">object</a></code>
- <code title="get /v1/functions/invocations/{invocation_id}/logs">client.functions.invocations.<a href="./src/runloop_api_client/resources/functions/invocations.py">logs</a>(invocation_id) -> <a href="./src/runloop_api_client/types/functions/invocation_logs_response.py">InvocationLogsResponse</a></code>

# Projects

Expand Down
12 changes: 0 additions & 12 deletions src/runloop_api_client/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@

class Runloop(SyncAPIClient):
blueprints: resources.BlueprintsResource
deployments: resources.DeploymentsResource
devboxes: resources.DevboxesResource
functions: resources.FunctionsResource
projects: resources.ProjectsResource
Expand Down Expand Up @@ -108,10 +107,7 @@ def __init__(
_strict_response_validation=_strict_response_validation,
)

self._default_stream_cls = Stream

self.blueprints = resources.BlueprintsResource(self)
self.deployments = resources.DeploymentsResource(self)
self.devboxes = resources.DevboxesResource(self)
self.functions = resources.FunctionsResource(self)
self.projects = resources.ProjectsResource(self)
Expand Down Expand Up @@ -225,7 +221,6 @@ def _make_status_error(

class AsyncRunloop(AsyncAPIClient):
blueprints: resources.AsyncBlueprintsResource
deployments: resources.AsyncDeploymentsResource
devboxes: resources.AsyncDevboxesResource
functions: resources.AsyncFunctionsResource
projects: resources.AsyncProjectsResource
Expand Down Expand Up @@ -286,10 +281,7 @@ def __init__(
_strict_response_validation=_strict_response_validation,
)

self._default_stream_cls = AsyncStream

self.blueprints = resources.AsyncBlueprintsResource(self)
self.deployments = resources.AsyncDeploymentsResource(self)
self.devboxes = resources.AsyncDevboxesResource(self)
self.functions = resources.AsyncFunctionsResource(self)
self.projects = resources.AsyncProjectsResource(self)
Expand Down Expand Up @@ -404,7 +396,6 @@ def _make_status_error(
class RunloopWithRawResponse:
def __init__(self, client: Runloop) -> None:
self.blueprints = resources.BlueprintsResourceWithRawResponse(client.blueprints)
self.deployments = resources.DeploymentsResourceWithRawResponse(client.deployments)
self.devboxes = resources.DevboxesResourceWithRawResponse(client.devboxes)
self.functions = resources.FunctionsResourceWithRawResponse(client.functions)
self.projects = resources.ProjectsResourceWithRawResponse(client.projects)
Expand All @@ -413,7 +404,6 @@ def __init__(self, client: Runloop) -> None:
class AsyncRunloopWithRawResponse:
def __init__(self, client: AsyncRunloop) -> None:
self.blueprints = resources.AsyncBlueprintsResourceWithRawResponse(client.blueprints)
self.deployments = resources.AsyncDeploymentsResourceWithRawResponse(client.deployments)
self.devboxes = resources.AsyncDevboxesResourceWithRawResponse(client.devboxes)
self.functions = resources.AsyncFunctionsResourceWithRawResponse(client.functions)
self.projects = resources.AsyncProjectsResourceWithRawResponse(client.projects)
Expand All @@ -422,7 +412,6 @@ def __init__(self, client: AsyncRunloop) -> None:
class RunloopWithStreamedResponse:
def __init__(self, client: Runloop) -> None:
self.blueprints = resources.BlueprintsResourceWithStreamingResponse(client.blueprints)
self.deployments = resources.DeploymentsResourceWithStreamingResponse(client.deployments)
self.devboxes = resources.DevboxesResourceWithStreamingResponse(client.devboxes)
self.functions = resources.FunctionsResourceWithStreamingResponse(client.functions)
self.projects = resources.ProjectsResourceWithStreamingResponse(client.projects)
Expand All @@ -431,7 +420,6 @@ def __init__(self, client: Runloop) -> None:
class AsyncRunloopWithStreamedResponse:
def __init__(self, client: AsyncRunloop) -> None:
self.blueprints = resources.AsyncBlueprintsResourceWithStreamingResponse(client.blueprints)
self.deployments = resources.AsyncDeploymentsResourceWithStreamingResponse(client.deployments)
self.devboxes = resources.AsyncDevboxesResourceWithStreamingResponse(client.devboxes)
self.functions = resources.AsyncFunctionsResourceWithStreamingResponse(client.functions)
self.projects = resources.AsyncProjectsResourceWithStreamingResponse(client.projects)
Expand Down
48 changes: 2 additions & 46 deletions src/runloop_api_client/_streaming.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,29 +55,7 @@ def __stream__(self) -> Iterator[_T]:
iterator = self._iter_events()

for sse in iterator:
if sse.event == "completion":
yield process_data(data=sse.json(), cast_to=cast_to, response=response)

if sse.event == "message_start" or sse.event == "content_block_stop":
yield process_data(data=sse.json(), cast_to=cast_to, response=response)

if sse.event == "ping":
continue

if sse.event == "error":
body = sse.data

try:
body = sse.json()
err_msg = f"{body}"
except Exception:
err_msg = sse.data or f"Error code: {response.status_code}"

raise self._client._make_status_error(
err_msg,
body=body,
response=self.response,
)
yield process_data(data=sse.json(), cast_to=cast_to, response=response)

# Ensure the entire stream is consumed
for _sse in iterator:
Expand Down Expand Up @@ -141,29 +119,7 @@ async def __stream__(self) -> AsyncIterator[_T]:
iterator = self._iter_events()

async for sse in iterator:
if sse.event == "completion":
yield process_data(data=sse.json(), cast_to=cast_to, response=response)

if sse.event == "message_start" or sse.event == "content_block_stop":
yield process_data(data=sse.json(), cast_to=cast_to, response=response)

if sse.event == "ping":
continue

if sse.event == "error":
body = sse.data

try:
body = sse.json()
err_msg = f"{body}"
except Exception:
err_msg = sse.data or f"Error code: {response.status_code}"

raise self._client._make_status_error(
err_msg,
body=body,
response=self.response,
)
yield process_data(data=sse.json(), cast_to=cast_to, response=response)

# Ensure the entire stream is consumed
async for _sse in iterator:
Expand Down
14 changes: 0 additions & 14 deletions src/runloop_api_client/resources/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,6 @@
BlueprintsResourceWithStreamingResponse,
AsyncBlueprintsResourceWithStreamingResponse,
)
from .deployments import (
DeploymentsResource,
AsyncDeploymentsResource,
DeploymentsResourceWithRawResponse,
AsyncDeploymentsResourceWithRawResponse,
DeploymentsResourceWithStreamingResponse,
AsyncDeploymentsResourceWithStreamingResponse,
)

__all__ = [
"BlueprintsResource",
Expand All @@ -48,12 +40,6 @@
"AsyncBlueprintsResourceWithRawResponse",
"BlueprintsResourceWithStreamingResponse",
"AsyncBlueprintsResourceWithStreamingResponse",
"DeploymentsResource",
"AsyncDeploymentsResource",
"DeploymentsResourceWithRawResponse",
"AsyncDeploymentsResourceWithRawResponse",
"DeploymentsResourceWithStreamingResponse",
"AsyncDeploymentsResourceWithStreamingResponse",
"DevboxesResource",
"AsyncDevboxesResource",
"DevboxesResourceWithRawResponse",
Expand Down
10 changes: 5 additions & 5 deletions src/runloop_api_client/resources/devboxes/devboxes.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
)
from ..._base_client import make_request_options
from ...types.devbox_view import DevboxView
from ...types.devbox_list_response import DevboxListResponse
from ...types.devbox_list_view import DevboxListView
from ...types.devbox_create_ssh_key_response import DevboxCreateSSHKeyResponse
from ...types.devboxes.devbox_execution_detail_view import DevboxExecutionDetailView
from ...types.devboxes.devbox_async_execution_detail_view import DevboxAsyncExecutionDetailView
Expand Down Expand Up @@ -198,7 +198,7 @@ def list(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> DevboxListResponse:
) -> DevboxListView:
"""List all devboxes or filter by status.

If no status is provided, all devboxes
Expand Down Expand Up @@ -235,7 +235,7 @@ def list(
devbox_list_params.DevboxListParams,
),
),
cast_to=DevboxListResponse,
cast_to=DevboxListView,
)

def create_ssh_key(
Expand Down Expand Up @@ -656,7 +656,7 @@ async def list(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> DevboxListResponse:
) -> DevboxListView:
"""List all devboxes or filter by status.

If no status is provided, all devboxes
Expand Down Expand Up @@ -693,7 +693,7 @@ async def list(
devbox_list_params.DevboxListParams,
),
),
cast_to=DevboxListResponse,
cast_to=DevboxListView,
)

async def create_ssh_key(
Expand Down
Loading