Skip to main content

swarmbox

Async Python client for swarmbox: open-source Sandboxes for RL rollouts, with a Harbor environment provider.

Each trial gets a World: a Sandbox for the agent's workspace and one for every service the task needs, on one private network, started and torn down as one.

pip install swarmbox-sdk
import asyncio

import swarmbox_sdk


async def main():
    # Reads SWARMBOX_URL (default http://localhost:7700) and SWARMBOX_TOKEN.
    async with swarmbox_sdk.Client() as client:
        world = await client.create_world(
            [
                swarmbox_sdk.Sandbox(name="env", image="docker.io/library/python:3.12-slim",
                                     command=["python", "-m", "http.server", "8080"],
                                     aliases=["svc.internal"]),
                swarmbox_sdk.Sandbox(name="main", image="docker.io/library/python:3.12-slim",
                                     command=["sleep", "infinity"]),
            ],
            ttl="5m",
        )
        result = await world.exec("main", "getent hosts svc.internal")
        print(result.exit_code, result.stdout)
        await world.stop()


asyncio.run(main())
  • Client.create_world(sandboxes, ttl) returns once every Sandbox is ready, or raises WorldFailed if the platform couldn't deliver the World.
  • Client.build_image(dir) builds an image on the platform from a Dockerfile and its build context, and returns once it is ready (a lookup if those files were built before). Use its ref as a Sandbox's image. No Docker and no registry access needed.
  • World.exec, upload and download act in one Sandbox, by name.
  • get_world and list_worlds look Worlds up.

Harbor

Each Harbor trial runs as one World, and each service in the task's compose file as one Sandbox in it. The agent and the task stay the same; only the environment flag changes.

pip install 'swarmbox-sdk[harbor]'
export SWARMBOX_URL=https://your-apiserver SWARMBOX_TOKEN=...
harbor run -p path/to/task -a oracle -e swarmbox_sdk.harbor:SwarmboxEnvironment

A token is all the machine running Harbor needs: the provider uploads each task's files and swarmbox builds its image, tagged by a hash of those files, so a task whose files haven't changed is a lookup, not a rebuild.

To build on your own machine instead, set SWARMBOX_REGISTRY to a registry your swarmbox nodes pull from. The provider then builds each image with docker and pushes it there (it needs docker, crane and push access), which is how python -m swarmbox_sdk.harbor.prebuild loads a batch of tasks ahead of a run.

Option (--ek key=value) Variable Default
url SWARMBOX_URL http://localhost:7700
token SWARMBOX_TOKEN none
registry SWARMBOX_REGISTRY none: swarmbox builds the images
pull_registry SWARMBOX_PULL_REGISTRY registry; host.lima.internal:5001 when registry is localhost:5001
platform SWARMBOX_PLATFORM this machine's architecture (used only with registry)
ttl 3h

Tasks may use only the compose keys image, build, command, environment, volumes, expose, networks, healthcheck and depends_on; anything else fails the trial before it starts rather than running it wrong.

More: Run a Harbor job.

Docs

Contributing

See AGENTS.md for how the repo is laid out, how to run the checks, and how docs and releases work. It is written for people and coding agents alike.

Licensed under Apache-2.0.

Metadata

Release files for swarmbox-sdk 0.4.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 swarmbox-sdk 0.4.0
File Size Uploaded Provenance Actions
swarmbox_sdk-0.4.0.tar.gz 23.7 kB With provenance Details for swarmbox_sdk-0.4.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for swarmbox-sdk 0.4.0
File Interpreter ABI Platform Actions
swarmbox_sdk-0.4.0-py3-none-any.whl Python 3 none any Details for swarmbox_sdk-0.4.0-py3-none-any.whl

Total release size: 50.6 kB

Release files / swarmbox_sdk-0.4.0.tar.gz

Download URL swarmbox_sdk-0.4.0.tar.gz
Size 23.7 kB
Tags Source
SHA-256 checksum
How to use checksums
0b97f9398c6eadce5946520730f2517f5f2122dec20bbf8c853ef6881691b205
BLAKE2b-256 checksum
How to use checksums
e3ecf44a28229ab18cac0c2ce2d6986f3d0861005635aa306331ea450dbde8be
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.

Transparency log

Release files / swarmbox_sdk-0.4.0-py3-none-any.whl

Download URL swarmbox_sdk-0.4.0-py3-none-any.whl
Size 26.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cb8fc5df56cd9020f66cf68d35b00cfd0987c37c187e2402f5f36f0efbba6375
BLAKE2b-256 checksum
How to use checksums
d23d4d0788470bcaf14592a23a3d80d0f844c14b19807f63473e59617363b02a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.

Transparency log

Security for swarmbox-sdk 0.4.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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for swarmbox_sdk-0.4.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.

Transparency log

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.

Release history Release notifications | RSS feed

This release

0.4.0 This release

2 release files Full provenance

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