swarmbox
Async Python client for swarmbox: Sandboxes for agentic RL rollouts and evals, 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 raisesWorldFailedif 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 itsrefas a Sandbox'simage. No Docker and no registry access needed.World.exec,uploadanddownloadact in one Sandbox, by name. An exec is killed after itstimeout(10 minutes if none is given); the request waits that long whatever the client's own timeout.get_worldandlist_worldslook 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://api.swarmbox.vibrantlabs.com # or your own API server
export SWARMBOX_TOKEN=... # your token
harbor run -p tasks/ -a oracle --environment-import-path swarmbox_sdk.harbor:SwarmboxEnvironment
tasks/ is a directory of Harbor tasks.
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 |
platform |
SWARMBOX_PLATFORM |
this machine's architecture (used only with registry) |
ttl |
3h: each trial World's lifetime, and the longest an agent's run may take (Harbor's own agent timeout usually ends it first) |
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
- Quickstart: the hosted test bed, from token to rollouts.
- Docs and API reference: the Harbor provider, the SDK, the HTTP API and the World spec. Their source is
docs/. - Renamed from opendsec: what to change.
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.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| swarmbox_sdk-0.4.1.tar.gz | 24.9 kB | With provenance | Details for swarmbox_sdk-0.4.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| swarmbox_sdk-0.4.1-py3-none-any.whl | Python 3 | none | any | Details for swarmbox_sdk-0.4.1-py3-none-any.whl |
Total release size: 52.8 kB
Release files / swarmbox_sdk-0.4.1.tar.gz
| Download URL | swarmbox_sdk-0.4.1.tar.gz |
|---|---|
| Size | 24.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b1a1ffcbfa0c33ab3db16cc1a917c31bde291085ab72c4638857965973784c18
|
|
BLAKE2b-256 checksum How to use checksums |
9d1a582e2edc8bf583c23f8f9c27b42dae65a083c08f4dfaf832090bc8f4f223
|
| 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 25, 2026.
Transparency logRelease files / swarmbox_sdk-0.4.1-py3-none-any.whl
| Download URL | swarmbox_sdk-0.4.1-py3-none-any.whl |
|---|---|
| Size | 28.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
39bfa1cd4925564faa53738bbec880e0f55eba4d8975b6b44b88dbbac81c7df5
|
|
BLAKE2b-256 checksum How to use checksums |
bbe1d9a2e5462bcb7184ac8ac1bc5ad53964bb402209860dc7c9efb0465766c8
|
| 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 25, 2026.
Transparency logSecurity for swarmbox-sdk 0.4.1
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.
Attestation for swarmbox_sdk-0.4.1.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 25, 2026.
Transparency logA 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.