Skip to main content

solari-sandbox (Python)

Python SDK for Solari Sandboxes — fast, ephemeral code sandboxes (micro-VMs) with a code interpreter, filesystem, ports, and git. Mirrors the TypeScript @solarisdk/sandbox package.

Install

pip install solari-sandbox

Quickstart

import asyncio, os
from solari_sandbox import SandboxClient

async def main():
    client = SandboxClient(api_key=os.environ["SOLARI_API_KEY"])
    sb = await client.create(template="base")
    await sb.connect()
    result = await sb.run_code("print(6 * 7)")
    print(result.stdout)                      # -> 42
    await sb.kill()

asyncio.run(main())

SandboxClient(...) accepts api_key, base_url (default https://api.getsolari.com), and call_timeout_ms. The same slr_live_… key authenticates against both the browser and desktop/sandbox APIs.

Restarting a stopped sandbox

When the guest powers itself off the sandbox goes to state stopped; the host keeps its disk. start() boots it again (a cold boot: processes and memory are gone, files on disk are kept) and returns a live handle on the fresh control URL:

sb = await client.start(sandbox_id)       # sync client: client.start(sandbox_id)
await sb.connect()

Calling it on an already-running sandbox is fine. Errors carry .status and .code: 409 NotStopped (a paused sandbox needs resume), 409 StartInProgress (poll get until it is running), 409 StoppedDiskMissing / StoppedDiskUnsafe / GoldenMismatch / DiskPlatformMismatch / DiskShaMismatch / DiskExceedsSpec / DiskOwnerMismatch (the host cannot start this disk), 409 HostCapabilityMissing (the host pool is not armed for start; not retryable), 500 StartFailed (the sandbox stays stopped with its disk, so calling again is safe), 502 StartHostError (host unreachable, retryable), NoCapacityError (503 NoCapacity or StartTimeout, retryable) and ConcurrencyLimitError (429). A stopped sandbox reports state == "stopped" from get; every other route on it answers 409 SandboxStopped (only get and kill still work). start() is not retried automatically. The gateway route is POST /sandboxes/:id/start.

Docs: https://getsolari.com

Metadata

Release files for solari-sandbox 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for solari-sandbox 0.3.0
File Size Uploaded Provenance
solari_sandbox-0.3.0.tar.gz 10.5 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for solari-sandbox 0.3.0
File Interpreter ABI Platform
solari_sandbox-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 18.9 kB

Release files / solari_sandbox-0.3.0.tar.gz

Download URL solari_sandbox-0.3.0.tar.gz
Size 10.5 kB
Tags Source
SHA-256 checksum
How to use checksums
431e298852d5e57c368da33c3d5dbea5bb3d7805dcf382b834750a5524807458
BLAKE2b-256 checksum
How to use checksums
b5162985fc71e1875ef6dfe3dbfafeca1bd598d98c930630612fd01f9e7fb86b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.15

Release files / solari_sandbox-0.3.0-py3-none-any.whl

Download URL solari_sandbox-0.3.0-py3-none-any.whl
Size 8.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f79a96d87ca088fc45576ec43c81adf5c1cf9a79a6e8167f9151e809fe0726f1
BLAKE2b-256 checksum
How to use checksums
4af362d86278ec3174dc762a9d4596af05b875bac18befeb08fbc6d160c10de7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.15

Security for solari-sandbox 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page