Core Module¶
- class runloop_api_client.sdk.async_.AsyncRunloopSDK(*, bearer_token=None, base_url=None, timeout=NOT_GIVEN, max_retries=5, default_headers=None, default_query=None, http_client=None, api_pool_shards=8, background_pool_shards=16, transfer_pool_shards=2)¶
High-level asynchronous entry point for the Runloop SDK.
Provides a Pythonic, object-oriented interface for managing devboxes, blueprints, snapshots, and storage objects. Exposes the generated async REST client via the
apiattribute for advanced use cases.- Variables:
api (AsyncRunloop) – Direct access to the generated async REST API client
agent (AsyncAgentOps) – High-level async interface for agent management.
axon (AsyncAxonOps) – [Beta] High-level async interface for axon management
devbox (AsyncDevboxOps) – High-level async interface for devbox management
blueprint (AsyncBlueprintOps) – High-level async interface for blueprint management
snapshot (AsyncSnapshotOps) – High-level async interface for snapshot management
storage_object (AsyncStorageObjectOps) – High-level async interface for storage object management
network_policy (AsyncNetworkPolicyOps) – High-level async interface for network policy management
gateway_config (AsyncGatewayConfigOps) – High-level async interface for gateway config management
mcp_config (AsyncMcpConfigOps) – High-level async interface for MCP config management
secret (AsyncSecretOps) – High-level async interface for secret management
Example
>>> runloop = AsyncRunloopSDK() # Uses RUNLOOP_API_KEY env var >>> devbox = await runloop.devbox.create(name="my-devbox") >>> result = await devbox.cmd.exec("echo 'hello'") >>> print(await result.stdout()) >>> await devbox.shutdown()
Asynchronous SDK entry points and management interfaces.
- class runloop_api_client.sdk.async_.AsyncDevboxOps(client)[source]¶
High-level async manager for creating and managing AsyncDevbox instances.
Accessed via
runloop.devboxfromAsyncRunloopSDK, provides coroutines to create devboxes from scratch, blueprints, or snapshots, and to list existing devboxes.Example
>>> runloop = AsyncRunloopSDK() >>> devbox = await runloop.devbox.create(name="my-devbox") >>> devboxes = await runloop.devbox.list(limit=10)
- async create(**params)[source]¶
Provision a new devbox and wait until it reaches
runningstate.- Parameters:
params (
Unpack[SDKDevboxCreateParams]) – SeeSDKDevboxCreateParamsfor available parameters- Returns:
Wrapper bound to the newly created devbox
- Return type:
- async create_from_blueprint_id(blueprint_id, **params)[source]¶
Create a devbox from an existing blueprint by identifier.
- Parameters:
blueprint_id (str) – Blueprint ID to create from
params (
Unpack[SDKDevboxCreateFromImageParams]) – SeeSDKDevboxCreateFromImageParamsfor available parameters
- Returns:
Wrapper bound to the newly created devbox
- Return type:
- async create_from_blueprint_name(blueprint_name, **params)[source]¶
Create a devbox from the latest blueprint with the given name.
- Parameters:
blueprint_name (str) – Blueprint name to create from
params (
Unpack[SDKDevboxCreateFromImageParams]) – SeeSDKDevboxCreateFromImageParamsfor available parameters
- Returns:
Wrapper bound to the newly created devbox
- Return type:
- async create_from_snapshot(snapshot_id, **params)[source]¶
Create a devbox initialized from a snapshot.
- Parameters:
snapshot_id (str) – Snapshot ID to create from
params (
Unpack[SDKDevboxCreateFromImageParams]) – SeeSDKDevboxCreateFromImageParamsfor available parameters
- Returns:
Wrapper bound to the newly created devbox
- Return type:
- from_id(devbox_id)[source]¶
Attach to an existing devbox by ID.
Returns immediately without waiting for the devbox to reach
runningstate. Callawait_running()on the returnedAsyncDevboxif you need to wait for readiness (contrast with the synchronous SDK, which blocks).- Parameters:
devbox_id (str) – Existing devbox ID
- Returns:
Wrapper bound to the requested devbox
- Return type:
- async list(**params)[source]¶
List devboxes accessible to the caller.
- Parameters:
params (
Unpack[SDKDevboxListParams]) – SeeSDKDevboxListParamsfor available parameters- Returns:
Collection of devbox wrappers
- Return type:
- class runloop_api_client.sdk.async_.AsyncSnapshotOps(client)[source]¶
High-level async manager for working with disk snapshots.
Accessed via
runloop.snapshotfromAsyncRunloopSDK, provides coroutines to list snapshots and access snapshot details.Example
>>> runloop = AsyncRunloopSDK() >>> snapshots = await runloop.snapshot.list(devbox_id="dev-123") >>> snapshot = await runloop.snapshot.from_id("snap-123")
- async list(**params)[source]¶
List snapshots created from devboxes.
- Parameters:
params (
Unpack[SDKDiskSnapshotListParams]) – SeeSDKDiskSnapshotListParamsfor available parameters- Returns:
Snapshot wrappers for each record
- Return type:
- class runloop_api_client.sdk.async_.AsyncBlueprintOps(client)[source]¶
High-level async manager for creating and managing blueprints.
Accessed via
runloop.blueprintfromAsyncRunloopSDK, provides coroutines to create Dockerfile-based blueprints, inspect build logs, and list existing blueprints.Example
>>> runloop = AsyncRunloopSDK() >>> blueprint = await runloop.blueprint.create( ... name="my-blueprint", ... dockerfile="FROM ubuntu:22.04\nRUN apt-get update", ... ) >>> blueprints = await runloop.blueprint.list()
To use a local directory as a build context, use an object.
Example
>>> from datetime import timedelta >>> from runloop_api_client.types.blueprint_build_parameters import BuildContext >>> runloop = AsyncRunloopSDK() >>> obj = await runloop.object_storage.upload_from_dir( ... "./", ... ttl=timedelta(hours=1), ... ) >>> blueprint = await runloop.blueprint.create( ... name="my-blueprint", ... dockerfile="FROM ubuntu:22.04\nCOPY . .\n", ... build_context=BuildContext(type="object", object_id=obj.id), ... )
- async create(**params)[source]¶
Create a blueprint and wait for the build to finish.
- Parameters:
params (
Unpack[SDKBlueprintCreateParams]) – SeeSDKBlueprintCreateParamsfor available parameters- Returns:
Wrapper bound to the finished blueprint
- Return type:
- from_id(blueprint_id)[source]¶
Return a blueprint wrapper for the given ID.
- Parameters:
blueprint_id (str) – Blueprint ID to wrap
- Returns:
Wrapper for the blueprint resource
- Return type:
- async list(**params)[source]¶
List available blueprints.
- Parameters:
params (
Unpack[SDKBlueprintListParams]) – SeeSDKBlueprintListParamsfor available parameters- Returns:
Blueprint wrappers for each record
- Return type:
- class runloop_api_client.sdk.async_.AsyncStorageObjectOps(client)[source]¶
High-level async manager for creating and managing storage objects.
Accessed via
runloop.storage_objectfromAsyncRunloopSDK, provides coroutines to create, upload, download, and list storage objects with convenient helpers for file and text uploads.Example
>>> runloop = AsyncRunloopSDK() >>> obj = await runloop.storage_object.upload_from_text("Hello!", "greeting.txt") >>> content = await obj.download_as_text() >>> objects = await runloop.storage_object.list()
- async create(**params)[source]¶
Create a storage object and obtain an upload URL.
- Parameters:
params (
Unpack[SDKObjectCreateParams]) – SeeSDKObjectCreateParamsfor available parameters- Returns:
Wrapper with upload URL set for immediate uploads
- Return type:
- from_id(object_id)[source]¶
Return a storage object wrapper by identifier.
- Parameters:
object_id (str) – Storage object identifier to wrap
- Returns:
Wrapper for the storage object resource
- Return type:
- async list(**params)[source]¶
List storage objects owned by the caller.
- Parameters:
params (
Unpack[SDKObjectListParams]) – SeeSDKObjectListParamsfor available parameters- Returns:
Storage object wrappers for each record
- Return type:
- async upload_from_file(file_path, *, name=None, content_type=None, metadata=None, ttl=None, **options)[source]¶
Create and upload an object from a local file path.
- Parameters:
file_path (str | Path) – Local filesystem path to read
name (Optional[str]) – Optional object name; defaults to the file name
content_type (Optional[ContentType]) – Optional MIME type to apply to the object
metadata (Optional[Dict[str, str]]) – Optional key-value metadata
ttl (Optional[timedelta]) – Optional Time-To-Live, after which the object is automatically deleted
options (Unpack[LongRequestOptions]) – See
LongRequestOptionsfor available options
- Returns:
Wrapper for the uploaded object
- Return type:
- Raises:
OSError – If the local file cannot be read
- async upload_from_dir(dir_path, *, name=None, metadata=None, ttl=None, ignore=None, **options)[source]¶
Create and upload an object from a local directory.
The resulting object will be uploaded as a compressed tarball.
- Parameters:
dir_path (str | Path) – Local filesystem directory path to tar
name (Optional[str]) – Optional object name; defaults to the directory name + ‘.tar.gz’
metadata (Optional[Dict[str, str]]) – Optional key-value metadata
ttl (Optional[timedelta]) – Optional Time-To-Live, after which the object is automatically deleted
ignore (Optional[TarFilter]) – Optional tar filter function compatible with
tarfile.TarFile.add(). If provided, it will be called for each member to allow modification or exclusion (by returningNone).options (Unpack[LongRequestOptions]) – See
LongRequestOptionsfor available options
- Returns:
Wrapper for the uploaded object
- Return type:
- Raises:
OSError – If the local directory cannot be read
ValueError – If
dir_pathdoes not point to a directory
- async upload_from_text(text, *, name, metadata=None, ttl=None, **options)[source]¶
Create and upload an object from a text payload.
- Parameters:
text (str) – Text content to upload
name (str) – Object display name
metadata (Optional[Dict[str, str]]) – Optional key-value metadata
ttl (Optional[timedelta]) – Optional Time-To-Live, after which the object is automatically deleted
options (
Unpack[LongRequestOptions]) – SeeLongRequestOptionsfor available options
- Returns:
Wrapper for the uploaded object
- Return type:
- async upload_from_bytes(data, *, name, content_type, metadata=None, ttl=None, **options)[source]¶
Create and upload an object from a bytes payload.
- Parameters:
data (bytes) – Binary payload to upload
name (str) – Object display name
content_type (ContentType) – MIME type describing the payload
metadata (Optional[Dict[str, str]]) – Optional key-value metadata
ttl (Optional[timedelta]) – Optional Time-To-Live, after which the object is automatically deleted
options (
Unpack[LongRequestOptions]) – SeeLongRequestOptionsfor available options
- Returns:
Wrapper for the uploaded object
- Return type:
- class runloop_api_client.sdk.async_.AsyncAxonOps(client)[source]¶
[Beta] Create and manage axons (async). Access via
runloop.axon.Example
>>> runloop = AsyncRunloopSDK() >>> axon = await runloop.axon.create() >>> await axon.publish(event_type="test", origin="USER_EVENT", payload="{}", source="sdk")
- async list(**params)[source]¶
[Beta] List all axons, including deleted axons.
- Parameters:
params (
Unpack[SDKAxonListParams]) – SeeSDKAxonListParamsfor available parameters- Returns:
Collection of axon wrappers
- Return type:
- class runloop_api_client.sdk.async_.AsyncAgentOps(client)[source]¶
High-level async manager for creating and managing agents.
Accessed via
runloop.agentfromAsyncRunloopSDK, provides coroutines to create, retrieve, and list agents from various sources (npm, pip, git, object storage).Example
>>> runloop = AsyncRunloopSDK() >>> # Create agent from NPM package >>> agent = await runloop.agent.create_from_npm(name="my-agent", package_name="@runloop/example-agent") >>> # Create agent from Git repository >>> agent = await runloop.agent.create_from_git( ... name="git-agent", repository="https://github.com/user/agent-repo", ref="main" ... ) >>> # List all agents >>> agents = await runloop.agent.list(limit=10)
- async create(**params)[source]¶
Create a new agent.
- Parameters:
params (
Unpack[SDKAgentCreateParams]) – SeeSDKAgentCreateParamsfor available parameters- Returns:
Wrapper bound to the newly created agent
- Return type:
- async create_from_npm(*, package_name, registry_url=None, agent_setup=None, **params)[source]¶
Create an agent from an NPM package.
- Parameters:
package_name (str) – NPM package name
registry_url (Optional[str], optional) – NPM registry URL, defaults to None
agent_setup (Optional[list[str]], optional) – Setup commands to run after installation, defaults to None
params (
Unpack[SDKAgentCreateParams]) – SeeSDKAgentCreateParamsfor additional parameters (excluding ‘source’)
- Returns:
Wrapper bound to the newly created agent
- Return type:
- Raises:
ValueError – If ‘source’ is provided in params
- async create_from_pip(*, package_name, registry_url=None, agent_setup=None, **params)[source]¶
Create an agent from a Pip package.
- Parameters:
package_name (str) – Pip package name
registry_url (Optional[str], optional) – Pip registry URL, defaults to None
agent_setup (Optional[list[str]], optional) – Setup commands to run after installation, defaults to None
params (
Unpack[SDKAgentCreateParams]) – SeeSDKAgentCreateParamsfor additional parameters (excluding ‘source’)
- Returns:
Wrapper bound to the newly created agent
- Return type:
- Raises:
ValueError – If ‘source’ is provided in params
- async create_from_git(*, repository, ref=None, agent_setup=None, **params)[source]¶
Create an agent from a Git repository.
- Parameters:
repository (str) – Git repository URL
ref (Optional[str], optional) – Optional Git ref (branch/tag/commit), defaults to main/HEAD
agent_setup (Optional[list[str]], optional) – Setup commands to run after cloning, defaults to None
params (
Unpack[SDKAgentCreateParams]) – SeeSDKAgentCreateParamsfor additional parameters (excluding ‘source’)
- Returns:
Wrapper bound to the newly created agent
- Return type:
- Raises:
ValueError – If ‘source’ is provided in params
- async create_from_object(*, object_id, agent_setup=None, **params)[source]¶
Create an agent from a storage object.
- Parameters:
object_id (str) – Storage object ID
agent_setup (Optional[list[str]], optional) – Setup commands to run after unpacking, defaults to None
params (
Unpack[SDKAgentCreateParams]) – SeeSDKAgentCreateParamsfor additional parameters (excluding ‘source’)
- Returns:
Wrapper bound to the newly created agent
- Return type:
- Raises:
ValueError – If ‘source’ is provided in params
- from_id(agent_id)[source]¶
Attach to an existing agent by ID.
- Parameters:
agent_id (str) – Existing agent ID
- Returns:
Wrapper bound to the requested agent
- Return type:
- async list(**params)[source]¶
List agents accessible to the caller.
- Parameters:
params (
Unpack[SDKAgentListParams]) – SeeSDKAgentListParamsfor available parameters- Returns:
Collection of agent wrappers
- Return type:
- async list_public(**params)[source]¶
List public agents.
- Parameters:
params (
Unpack[SDKAgentListPublicParams]) – SeeSDKAgentListPublicParamsfor available parameters- Returns:
Collection of public agent wrappers
- Return type:
- async devbox_counts(**options)[source]¶
Get devbox counts grouped by agent name.
- Parameters:
options (
Unpack[BaseRequestOptions]) – Optional request configuration- Returns:
Devbox counts per agent name and total
- Return type:
- class runloop_api_client.sdk.async_.AsyncNetworkPolicyOps(client)[source]¶
High-level async manager for creating and managing network policies.
Accessed via
runloop.network_policyfromAsyncRunloopSDK, provides coroutines to create, retrieve, update, delete, and list network policies.Example
>>> runloop = AsyncRunloopSDK() >>> policy = await runloop.network_policy.create( ... name="my-policy", ... allowed_hostnames=["github.com", "*.npmjs.org"], ... ) >>> policies = await runloop.network_policy.list()
- async create(**params)[source]¶
Create a new network policy.
- Parameters:
params (
Unpack[SDKNetworkPolicyCreateParams]) – SeeSDKNetworkPolicyCreateParamsfor available parameters- Returns:
The newly created network policy
- Return type:
- from_id(network_policy_id)[source]¶
Get an AsyncNetworkPolicy instance for an existing network policy ID.
- Parameters:
network_policy_id (str) – ID of the network policy
- Returns:
AsyncNetworkPolicy instance for the given ID
- Return type:
- async list(**params)[source]¶
List all network policies, optionally filtered by parameters.
- Parameters:
params (
Unpack[SDKNetworkPolicyListParams]) – SeeSDKNetworkPolicyListParamsfor available parameters- Returns:
List of network policies
- Return type:
- class runloop_api_client.sdk.async_.AsyncGatewayConfigOps(client)[source]¶
High-level async manager for creating and managing gateway configurations.
Accessed via
runloop.gateway_configfromAsyncRunloopSDK, provides coroutines to create, retrieve, update, delete, and list gateway configs. Gateway configs define how to proxy API requests through the credential gateway, enabling secure API proxying without exposing API keys.Example
>>> runloop = AsyncRunloopSDK() >>> gateway_config = await runloop.gateway_config.create( ... name="my-api-gateway", ... endpoint="https://api.example.com", ... auth_mechanism={"type": "bearer"}, ... ) >>> # Use with a devbox >>> devbox = await runloop.devbox.create( ... name="my-devbox", ... gateways={ ... "MY_API": { ... "gateway": gateway_config.id, ... "secret": "my-api-key-secret", ... }, ... }, ... )
- async create(**params)[source]¶
Create a new gateway config.
Example
>>> gateway_config = await runloop.gateway_config.create( ... name="my-gateway", ... endpoint="https://api.example.com", ... auth_mechanism={"type": "header", "key": "x-api-key"}, ... description="Gateway for My API", ... )
- Parameters:
params (
Unpack[SDKGatewayConfigCreateParams]) – SeeSDKGatewayConfigCreateParamsfor available parameters- Returns:
The newly created gateway config
- Return type:
- from_id(gateway_config_id)[source]¶
Get an AsyncGatewayConfig instance for an existing gateway config ID.
Example
>>> gateway_config = runloop.gateway_config.from_id("gwc_1234567890") >>> info = await gateway_config.get_info() >>> print(f"Gateway Config name: {info.name}")
- Parameters:
gateway_config_id (str) – ID of the gateway config
- Returns:
AsyncGatewayConfig instance for the given ID
- Return type:
- async list(**params)[source]¶
List all gateway configs, optionally filtered by parameters.
Example
>>> configs = await runloop.gateway_config.list(limit=10) >>> for config in configs: ... print(config.id)
- Parameters:
params (
Unpack[SDKGatewayConfigListParams]) – SeeSDKGatewayConfigListParamsfor available parameters- Returns:
List of gateway configs
- Return type:
- class runloop_api_client.sdk.async_.AsyncMcpConfigOps(client)[source]¶
High-level async manager for creating and managing MCP configurations.
Accessed via
runloop.mcp_configfromAsyncRunloopSDK, provides methods to create, retrieve, update, delete, and list MCP configs. MCP configs define how to connect to upstream MCP (Model Context Protocol) servers, specifying the target endpoint and which tools are allowed.Example
>>> runloop = AsyncRunloopSDK() >>> mcp_config = await runloop.mcp_config.create( ... name="my-mcp-server", ... endpoint="https://mcp.example.com", ... allowed_tools=["*"], ... )
- async create(**params)[source]¶
Create a new MCP config.
- Parameters:
params (
Unpack[SDKMcpConfigCreateParams]) – SeeSDKMcpConfigCreateParamsfor available parameters- Returns:
The newly created MCP config
- Return type:
- from_id(mcp_config_id)[source]¶
Get an AsyncMcpConfig instance for an existing MCP config ID.
- Parameters:
mcp_config_id (str) – ID of the MCP config
- Returns:
AsyncMcpConfig instance for the given ID
- Return type:
- async list(**params)[source]¶
List all MCP configs, optionally filtered by parameters.
- Parameters:
params (
Unpack[SDKMcpConfigListParams]) – SeeSDKMcpConfigListParamsfor available parameters- Returns:
List of MCP configs
- Return type:
- class runloop_api_client.sdk.async_.AsyncSecretOps(client)[source]¶
High-level async manager for creating and managing Secrets.
Accessed via
runloop.secretfromAsyncRunloopSDK, provides methods to create, retrieve, update, list, and delete secrets. Secrets are encrypted key-value pairs that can be injected into Devboxes as environment variables.Example
>>> runloop = AsyncRunloopSDK() >>> secret = await runloop.secret.create(name="MY_API_KEY", value="secret-value") >>> secrets = await runloop.secret.list()
- async create(name, value, **options)[source]¶
Create a new secret.
Example
>>> secret = await runloop.secret.create( ... name="DATABASE_PASSWORD", ... value="my-secure-password", ... ) >>> print(f"Created secret: {secret.name}")
- Parameters:
name (str) – Account-scoped secret name (must be a valid env var name)
value (str) – Secret value to store (encrypted at rest)
options (
Unpack[LongRequestOptions]) – Optional request configuration
- Returns:
The created AsyncSecret instance
- Return type:
- from_name(name)[source]¶
Get an AsyncSecret instance by name without making an API call.
Use
get_info()on the returned AsyncSecret to fetch the actual data.Example
>>> secret = runloop.secret.from_name("MY_API_KEY") >>> info = await secret.get_info() >>> print(f"Secret ID: {info.id}")
- Parameters:
name (str) – The literal account-scoped name of the secret
- Returns:
An AsyncSecret instance (no API call made)
- Return type:
- from_id(id)[source]¶
Get a lazy exact-ID handle; its operations never fall back to a name.
- Return type:
- async update(secret, value, **options)[source]¶
Update an existing secret’s value.
Example
>>> updated = await runloop.secret.update("DATABASE_PASSWORD", "new-password") >>> # Or using an AsyncSecret object >>> updated = await runloop.secret.update(secret, "new-password")
- Parameters:
secret (AsyncSecret | str) – The secret to update (AsyncSecret object or name string)
value (str) – The new secret value
options (Unpack[LongRequestOptions]) – Optional request configuration
- Returns:
The updated AsyncSecret instance
- Return type:
- async list(**options)[source]¶
List all secrets.
Example
>>> secrets = await runloop.secret.list() >>> for s in secrets: ... print(s.name)
- Parameters:
options (
Unpack[BaseRequestOptions]) – Optional request configuration- Returns:
List of AsyncSecret instances
- Return type:
- async delete(secret, **options)[source]¶
Delete a secret. This action is irreversible.
Example
>>> await runloop.secret.delete("DATABASE_PASSWORD") >>> # Or using an AsyncSecret object >>> await runloop.secret.delete(secret)
- Parameters:
secret (AsyncSecret | str) – The secret to delete (AsyncSecret object or name string)
options (Unpack[LongRequestOptions]) – Optional request configuration
- Returns:
The deleted secret metadata
- Return type:
- class runloop_api_client.sdk.sync.RunloopSDK(*, bearer_token=None, base_url=None, timeout=NOT_GIVEN, max_retries=5, default_headers=None, default_query=None, http_client=None, api_pool_shards=8, background_pool_shards=16, transfer_pool_shards=2)¶
High-level synchronous entry point for the Runloop SDK.
Provides a Pythonic, object-oriented interface for managing devboxes, blueprints, snapshots, and storage objects. Exposes the generated REST client via the
apiattribute for advanced use cases.- Variables:
api (Runloop) – Direct access to the generated REST API client
agent (AgentOps) – High-level interface for agent management.
axon (AxonOps) – [Beta] High-level interface for axon management
devbox (DevboxOps) – High-level interface for devbox management
blueprint (BlueprintOps) – High-level interface for blueprint management
snapshot (SnapshotOps) – High-level interface for snapshot management
storage_object (StorageObjectOps) – High-level interface for storage object management
network_policy (NetworkPolicyOps) – High-level interface for network policy management
gateway_config (GatewayConfigOps) – High-level interface for gateway config management
mcp_config (McpConfigOps) – High-level interface for MCP config management
secret (SecretOps) – High-level interface for secret management
Example
>>> runloop = RunloopSDK() # Uses RUNLOOP_API_KEY env var >>> devbox = runloop.devbox.create(name="my-devbox") >>> result = devbox.cmd.exec("echo 'hello'") >>> print(result.stdout()) >>> devbox.shutdown()
Synchronous SDK entry points and management interfaces.
- class runloop_api_client.sdk.sync.DevboxOps(client)[source]¶
High-level manager for creating and managing Devbox instances.
Accessed via
runloop.devboxfromRunloopSDK, provides methods to create devboxes from scratch, blueprints, or snapshots, and to list existing devboxes.Example
>>> runloop = RunloopSDK() >>> devbox = runloop.devbox.create(name="my-devbox") >>> devboxes = runloop.devbox.list(limit=10)
- create(**params)[source]¶
Provision a new devbox and wait until it reaches
runningstate.- Parameters:
params (
Unpack[SDKDevboxCreateParams]) – SeeSDKDevboxCreateParamsfor available parameters- Returns:
Wrapper bound to the newly created devbox
- Return type:
- create_from_blueprint_id(blueprint_id, **params)[source]¶
Create a devbox from an existing blueprint by identifier.
- Parameters:
blueprint_id (str) – Blueprint ID to create from
params (
Unpack[SDKDevboxCreateFromImageParams]) – SeeSDKDevboxCreateFromImageParamsfor available parameters
- Returns:
Wrapper bound to the newly created devbox
- Return type:
- create_from_blueprint_name(blueprint_name, **params)[source]¶
Create a devbox from the latest blueprint with the given name.
- Parameters:
blueprint_name (str) – Blueprint name to create from
params (
Unpack[SDKDevboxCreateFromImageParams]) – SeeSDKDevboxCreateFromImageParamsfor available parameters
- Returns:
Wrapper bound to the newly created devbox
- Return type:
- create_from_snapshot(snapshot_id, **params)[source]¶
Create a devbox initialized from a snapshot.
- Parameters:
snapshot_id (str) – Snapshot ID to create from
params (
Unpack[SDKDevboxCreateFromImageParams]) – SeeSDKDevboxCreateFromImageParamsfor available parameters
- Returns:
Wrapper bound to the newly created devbox
- Return type:
- from_id(devbox_id)[source]¶
Attach to an existing devbox by ID.
Blocks until the devbox reaches
runningstate so callers can begin issuing commands immediately.
- list(**params)[source]¶
List devboxes accessible to the caller.
- Parameters:
params (
Unpack[SDKDevboxListParams]) – SeeSDKDevboxListParamsfor available parameters- Returns:
Collection of devbox wrappers
- Return type:
- class runloop_api_client.sdk.sync.SnapshotOps(client)[source]¶
High-level manager for working with disk snapshots.
Accessed via
runloop.snapshotfromRunloopSDK, provides methods to list snapshots and access snapshot details.Example
>>> runloop = RunloopSDK() >>> snapshots = runloop.snapshot.list(devbox_id="dev-123") >>> snapshot = runloop.snapshot.from_id("snap-123")
- list(**params)[source]¶
List snapshots created from devboxes.
- Parameters:
params (
Unpack[SDKDiskSnapshotListParams]) – SeeSDKDiskSnapshotListParamsfor available parameters- Returns:
Snapshot wrappers for each record
- Return type:
- class runloop_api_client.sdk.sync.BlueprintOps(client)[source]¶
High-level manager for creating and managing blueprints.
Accessed via
runloop.blueprintfromRunloopSDK, provides methods to create blueprints with Dockerfiles and system setup commands, and to list existing blueprints.Example
>>> runloop = RunloopSDK() >>> blueprint = runloop.blueprint.create( ... name="my-blueprint", dockerfile="FROM ubuntu:22.04\nRUN apt-get update" ... ) >>> blueprints = runloop.blueprint.list()
To use a local directory as a build context, use an object.
Example
>>> from datetime import timedelta >>> from runloop_api_client.types.blueprint_build_parameters import BuildContext >>> runloop = RunloopSDK() >>> obj = runloop.object_storage.upload_from_dir( ... "./", ... ttl=timedelta(hours=1), ... ) >>> blueprint = runloop.blueprint.create( ... name="my-blueprint", ... dockerfile="FROM ubuntu:22.04\nCOPY . .\n", ... build_context=BuildContext(type="object", object_id=obj.id), ... )
- create(**params)[source]¶
Create a blueprint and wait for the build to finish.
- Parameters:
params (
Unpack[SDKBlueprintCreateParams]) – SeeSDKBlueprintCreateParamsfor available parameters- Returns:
Wrapper bound to the finished blueprint
- Return type:
- list(**params)[source]¶
List available blueprints.
- Parameters:
params (
Unpack[SDKBlueprintListParams]) – SeeSDKBlueprintListParamsfor available parameters- Returns:
Blueprint wrappers for each record
- Return type:
- class runloop_api_client.sdk.sync.StorageObjectOps(client)[source]¶
High-level manager for creating and managing storage objects.
Accessed via
runloop.storage_objectfromRunloopSDK, provides methods to create, upload, download, and list storage objects with convenient helpers for file and text uploads.Example
>>> runloop = RunloopSDK() >>> obj = runloop.storage_object.upload_from_text("Hello!", "greeting.txt") >>> content = obj.download_as_text() >>> objects = runloop.storage_object.list()
- create(**params)[source]¶
Create a storage object and obtain an upload URL.
- Parameters:
params (
Unpack[SDKObjectCreateParams]) – SeeSDKObjectCreateParamsfor available parameters- Returns:
Wrapper with upload URL set for immediate uploads
- Return type:
- from_id(object_id)[source]¶
Return a storage object wrapper by identifier.
- Parameters:
object_id (str) – Storage object identifier to wrap
- Returns:
Wrapper for the storage object resource
- Return type:
- list(**params)[source]¶
List storage objects owned by the caller.
- Parameters:
params (
Unpack[SDKObjectListParams]) – SeeSDKObjectListParamsfor available parameters- Returns:
Storage object wrappers for each record
- Return type:
- upload_from_file(file_path, *, name=None, content_type=None, metadata=None, ttl=None, **options)[source]¶
Create and upload an object from a local file path.
- Parameters:
file_path (str | Path) – Local filesystem path to read
name (Optional[str]) – Optional object name; defaults to the file name
content_type (Optional[ContentType]) – Optional MIME type to apply to the object
metadata (Optional[Dict[str, str]]) – Optional key-value metadata
ttl (Optional[timedelta]) – Optional Time-To-Live, after which the object is automatically deleted
options (Unpack[LongRequestOptions]) – See
LongRequestOptionsfor available options
- Returns:
Wrapper for the uploaded object
- Return type:
- Raises:
OSError – If the local file cannot be read
- upload_from_dir(dir_path, *, name=None, metadata=None, ttl=None, ignore=None, **options)[source]¶
Create and upload an object from a local directory.
The resulting object will be uploaded as a compressed tarball.
- Parameters:
dir_path (str | Path) – Local filesystem directory path to tar
name (Optional[str]) – Optional object name; defaults to the directory name + ‘.tar.gz’
metadata (Optional[Dict[str, str]]) – Optional key-value metadata
ttl (Optional[timedelta]) – Optional Time-To-Live, after which the object is automatically deleted
ignore (Optional[TarFilter]) – Optional tar filter function compatible with
tarfile.TarFile.add(). If provided, it will be called for each member to allow modification or exclusion (by returningNone).options (Unpack[LongRequestOptions]) – See
LongRequestOptionsfor available options
- Returns:
Wrapper for the uploaded object
- Return type:
- Raises:
OSError – If the local file cannot be read
ValueError – If
dir_pathdoes not point to a directory
- upload_from_text(text, *, name, metadata=None, ttl=None, **options)[source]¶
Create and upload an object from a text payload.
- Parameters:
text (str) – Text content to upload
name (str) – Object display name
metadata (Optional[Dict[str, str]]) – Optional key-value metadata
ttl (Optional[timedelta]) – Optional Time-To-Live, after which the object is automatically deleted
options (
Unpack[LongRequestOptions]) – SeeLongRequestOptionsfor available options
- Returns:
Wrapper for the uploaded object
- Return type:
- upload_from_bytes(data, *, name, content_type, metadata=None, ttl=None, **options)[source]¶
Create and upload an object from a bytes payload.
- Parameters:
data (bytes) – Binary payload to upload
name (str) – Object display name
content_type (ContentType) – MIME type describing the payload
metadata (Optional[Dict[str, str]]) – Optional key-value metadata
ttl (Optional[timedelta]) – Optional Time-To-Live, after which the object is automatically deleted
options (
Unpack[LongRequestOptions]) – SeeLongRequestOptionsfor available options
- Returns:
Wrapper for the uploaded object
- Return type:
- class runloop_api_client.sdk.sync.AxonOps(client)[source]¶
[Beta] Create and manage axons. Access via
runloop.axon.Example
>>> runloop = RunloopSDK() >>> axon = runloop.axon.create() >>> axon.publish(event_type="test", origin="USER_EVENT", payload="{}", source="sdk")
- list(**params)[source]¶
[Beta] List all axons, including deleted axons.
- Parameters:
params (
Unpack[SDKAxonListParams]) – SeeSDKAxonListParamsfor available parameters- Returns:
Collection of axon wrappers
- Return type:
- class runloop_api_client.sdk.sync.AgentOps(client)[source]¶
High-level manager for creating and managing agents.
Accessed via
runloop.agentfromRunloopSDK, provides methods to create, retrieve, and list agents from various sources (npm, pip, git, object storage).Example
>>> runloop = RunloopSDK() >>> # Create agent from NPM package >>> agent = runloop.agent.create_from_npm(name="my-agent", package_name="@runloop/example-agent") >>> # Create agent from Git repository >>> agent = runloop.agent.create_from_git( ... name="git-agent", repository="https://github.com/user/agent-repo", ref="main" ... ) >>> # List all agents >>> agents = runloop.agent.list(limit=10)
- create(**params)[source]¶
Create a new agent.
- Parameters:
params (
Unpack[SDKAgentCreateParams]) – SeeSDKAgentCreateParamsfor available parameters- Returns:
Wrapper bound to the newly created agent
- Return type:
- create_from_npm(*, package_name, registry_url=None, agent_setup=None, **params)[source]¶
Create an agent from an NPM package.
Example
>>> agent = runloop.agent.create_from_npm( ... name="my-npm-agent", package_name="@runloop/example-agent", version="1.0.0" ... )
- Parameters:
package_name (str) – NPM package name
registry_url (Optional[str], optional) – NPM registry URL, defaults to None
agent_setup (Optional[list[str]], optional) – Setup commands to run after installation, defaults to None
params (
Unpack[SDKAgentCreateParams]) – SeeSDKAgentCreateParamsfor additional parameters (excluding ‘source’)
- Returns:
Wrapper bound to the newly created agent
- Return type:
- Raises:
ValueError – If ‘source’ is provided in params
- create_from_pip(*, package_name, registry_url=None, agent_setup=None, **params)[source]¶
Create an agent from a Pip package.
Example
>>> agent = runloop.agent.create_from_pip( ... name="my-pip-agent", package_name="runloop-example-agent", version="1.0.0" ... )
- Parameters:
package_name (str) – Pip package name
registry_url (Optional[str], optional) – Pip registry URL, defaults to None
agent_setup (Optional[list[str]], optional) – Setup commands to run after installation, defaults to None
params (
Unpack[SDKAgentCreateParams]) – SeeSDKAgentCreateParamsfor additional parameters (excluding ‘source’)
- Returns:
Wrapper bound to the newly created agent
- Return type:
- Raises:
ValueError – If ‘source’ is provided in params
- create_from_git(*, repository, ref=None, agent_setup=None, **params)[source]¶
Create an agent from a Git repository.
Example
>>> agent = runloop.agent.create_from_git( ... name="my-git-agent", ... repository="https://github.com/user/agent-repo", ... ref="main", ... agent_setup=["npm install", "npm run build"], ... version="1.0.0", ... )
- Parameters:
repository (str) – Git repository URL
ref (Optional[str], optional) – Optional Git ref (branch/tag/commit), defaults to main/HEAD
agent_setup (Optional[list[str]], optional) – Setup commands to run after cloning, defaults to None
params (
Unpack[SDKAgentCreateParams]) – SeeSDKAgentCreateParamsfor additional parameters (excluding ‘source’)
- Returns:
Wrapper bound to the newly created agent
- Return type:
- Raises:
ValueError – If ‘source’ is provided in params
- create_from_object(*, object_id, agent_setup=None, **params)[source]¶
Create an agent from a storage object.
Example
>>> # First upload agent code as an object >>> obj = runloop.storage_object.upload_from_dir("./my-agent") >>> # Then create agent from the object >>> agent = runloop.agent.create_from_object( ... name="my-object-agent", ... object_id=obj.id, ... agent_setup=["chmod +x setup.sh", "./setup.sh"], ... version="1.0.0", ... )
- Parameters:
object_id (str) – Storage object ID
agent_setup (Optional[list[str]], optional) – Setup commands to run after unpacking, defaults to None
params (
Unpack[SDKAgentCreateParams]) – SeeSDKAgentCreateParamsfor additional parameters (excluding ‘source’)
- Returns:
Wrapper bound to the newly created agent
- Return type:
- Raises:
ValueError – If ‘source’ is provided in params
- list(**params)[source]¶
List agents accessible to the caller.
- Parameters:
params (
Unpack[SDKAgentListParams]) – SeeSDKAgentListParamsfor available parameters- Returns:
Collection of agent wrappers
- Return type:
- devbox_counts(**options)[source]¶
Get devbox counts grouped by agent name.
- Parameters:
options (
Unpack[BaseRequestOptions]) – Optional request configuration- Returns:
Devbox counts per agent name and total
- Return type:
- class runloop_api_client.sdk.sync.NetworkPolicyOps(client)[source]¶
High-level manager for creating and managing network policies.
Accessed via
runloop.network_policyfromRunloopSDK, provides methods to create, retrieve, update, delete, and list network policies.Example
>>> runloop = RunloopSDK() >>> policy = runloop.network_policy.create( ... name="my-policy", ... allowed_hostnames=["github.com", "*.npmjs.org"], ... ) >>> policies = runloop.network_policy.list()
- create(**params)[source]¶
Create a new network policy.
- Parameters:
params (
Unpack[SDKNetworkPolicyCreateParams]) – SeeSDKNetworkPolicyCreateParamsfor available parameters- Returns:
The newly created network policy
- Return type:
- from_id(network_policy_id)[source]¶
Get a NetworkPolicy instance for an existing network policy ID.
- Parameters:
network_policy_id (str) – ID of the network policy
- Returns:
NetworkPolicy instance for the given ID
- Return type:
- list(**params)[source]¶
List all network policies, optionally filtered by parameters.
- Parameters:
params (
Unpack[SDKNetworkPolicyListParams]) – SeeSDKNetworkPolicyListParamsfor available parameters- Returns:
List of network policies
- Return type:
- class runloop_api_client.sdk.sync.GatewayConfigOps(client)[source]¶
High-level manager for creating and managing gateway configurations.
Accessed via
runloop.gateway_configfromRunloopSDK, provides methods to create, retrieve, update, delete, and list gateway configs. Gateway configs define how to proxy API requests through the credential gateway, enabling secure API proxying without exposing API keys.Example
>>> runloop = RunloopSDK() >>> gateway_config = runloop.gateway_config.create( ... name="my-api-gateway", ... endpoint="https://api.example.com", ... auth_mechanism={"type": "bearer"}, ... ) >>> # Use with a devbox >>> devbox = runloop.devbox.create( ... name="my-devbox", ... gateways={ ... "MY_API": { ... "gateway": gateway_config.id, ... "secret": "my-api-key-secret", ... }, ... }, ... )
- create(**params)[source]¶
Create a new gateway config.
Example
>>> gateway_config = runloop.gateway_config.create( ... name="my-gateway", ... endpoint="https://api.example.com", ... auth_mechanism={"type": "header", "key": "x-api-key"}, ... description="Gateway for My API", ... )
- Parameters:
params (
Unpack[SDKGatewayConfigCreateParams]) – SeeSDKGatewayConfigCreateParamsfor available parameters- Returns:
The newly created gateway config
- Return type:
- from_id(gateway_config_id)[source]¶
Get a GatewayConfig instance for an existing gateway config ID.
Example
>>> gateway_config = runloop.gateway_config.from_id("gwc_1234567890") >>> info = gateway_config.get_info() >>> print(f"Gateway Config name: {info.name}")
- Parameters:
gateway_config_id (str) – ID of the gateway config
- Returns:
GatewayConfig instance for the given ID
- Return type:
- list(**params)[source]¶
List all gateway configs, optionally filtered by parameters.
Example
>>> configs = runloop.gateway_config.list(limit=10) >>> for config in configs: ... print(config.id)
- Parameters:
params (
Unpack[SDKGatewayConfigListParams]) – SeeSDKGatewayConfigListParamsfor available parameters- Returns:
List of gateway configs
- Return type:
- class runloop_api_client.sdk.sync.McpConfigOps(client)[source]¶
High-level manager for creating and managing MCP configurations.
Accessed via
runloop.mcp_configfromRunloopSDK, provides methods to create, retrieve, update, delete, and list MCP configs. MCP configs define how to connect to upstream MCP (Model Context Protocol) servers, specifying the target endpoint and which tools are allowed.Example
>>> runloop = RunloopSDK() >>> mcp_config = runloop.mcp_config.create( ... name="my-mcp-server", ... endpoint="https://mcp.example.com", ... allowed_tools=["*"], ... )
- create(**params)[source]¶
Create a new MCP config.
- Parameters:
params (
Unpack[SDKMcpConfigCreateParams]) – SeeSDKMcpConfigCreateParamsfor available parameters- Returns:
The newly created MCP config
- Return type:
- list(**params)[source]¶
List all MCP configs, optionally filtered by parameters.
- Parameters:
params (
Unpack[SDKMcpConfigListParams]) – SeeSDKMcpConfigListParamsfor available parameters- Returns:
List of MCP configs
- Return type:
- class runloop_api_client.sdk.sync.SecretOps(client)[source]¶
High-level manager for creating and managing Secrets.
Accessed via
runloop.secretfromRunloopSDK, provides methods to create, retrieve, update, list, and delete secrets. Secrets are encrypted key-value pairs that can be injected into Devboxes as environment variables.Example
>>> runloop = RunloopSDK() >>> secret = runloop.secret.create(name="MY_API_KEY", value="secret-value") >>> secrets = runloop.secret.list()
- create(name, value, **options)[source]¶
Create a new secret.
Example
>>> secret = runloop.secret.create( ... name="DATABASE_PASSWORD", ... value="my-secure-password", ... ) >>> print(f"Created secret: {secret.name}")
- Parameters:
name (str) – Account-scoped secret name (must be a valid env var name)
value (str) – Secret value to store (encrypted at rest)
options (
Unpack[LongRequestOptions]) – Optional request configuration
- Returns:
The created Secret instance
- Return type:
- from_name(name)[source]¶
Get a Secret instance by name without making an API call.
Use
get_info()on the returned Secret to fetch the actual data.Example
>>> secret = runloop.secret.from_name("MY_API_KEY") >>> info = secret.get_info() >>> print(f"Secret ID: {info.id}")
- from_id(id)[source]¶
Get a lazy exact-ID handle; its operations never fall back to a name.
- Return type:
- update(secret, value, **options)[source]¶
Update an existing secret’s value.
Example
>>> updated = runloop.secret.update("DATABASE_PASSWORD", "new-password") >>> # Or using a Secret object >>> updated = runloop.secret.update(secret, "new-password")
- list(**options)[source]¶
List all secrets.
Example
>>> secrets = runloop.secret.list() >>> for s in secrets: ... print(s.name)
- Parameters:
options (
Unpack[BaseRequestOptions]) – Optional request configuration- Returns:
List of Secret instances
- Return type:
Base REST Client¶
The SDK wraps the generated REST client. The api attribute on
AsyncRunloopSDK /
RunloopSDK provides direct access.
- class runloop_api_client.AsyncRunloop(*, bearer_token=None, base_url=None, timeout=NOT_GIVEN, max_retries=5, default_headers=None, default_query=None, http_client=None, shared_http_pool=True, api_pool_shards=8, background_pool_shards=16, transfer_pool_shards=2, _strict_response_validation=False)¶
- class runloop_api_client.Runloop(*, bearer_token=None, base_url=None, timeout=NOT_GIVEN, max_retries=5, default_headers=None, default_query=None, http_client=None, shared_http_pool=True, api_pool_shards=8, background_pool_shards=16, transfer_pool_shards=2, _strict_response_validation=False)¶