Run a multi-service Compose task as isolated attempts on a sandbox platform.
Flotilla reads a task directory, resolves it into one sandbox per service, uploads the task's files into them, connects them under an explicit network policy, and cleans up its private state afterwards. Resolving a task is a local computation: it reads the task's own files plus each image's config from the registry, and writes nothing it later reads back. There is no build step, no intermediate artifact to publish, and no dataset staging area.
flowchart LR
subgraph task["<task>/environment/docker-compose.yaml"]
m[main]
c[cache]
end
task --> F["plan()<br/>parse Compose · read image configs"]
F --> P
subgraph P["Sandbox platform"]
direction LR
sm["sandbox: main"] <--> sc["sandbox: cache"]
end
A task is a directory with a task.toml and an environment/ directory. A multi-service task has a Compose file there; a single-service task can
instead name its image in task.toml as [environment].docker_image. Images are published and named
by digest, and nothing is built:
task/
instruction.md
tests/test.sh # required Harbor verifier script
task.toml # Harbor task configuration
environment/
docker-compose.yaml
services:
main:
image: alpine@sha256:d9e853e87e55526f6b2917df91a2115c36dd7c696a35be12163d44e6e2a4b6bc # alpine:3.20
depends_on:
cache:
condition: service_healthy
cache:
image: redis@sha256:7f7d30b7fdd09467bac58198a1f166dd69789d348d4fe859cccb20e0cf287fbe # redis:7-alpine
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 2s
retries: 15The run names that directory, wherever it is: Flotilla reads it on the client and uploads what each service needs. Nothing is generated in between, so what runs is the tree you have.
A deployment is a platform's TOML file. Whoever runs your sandbox platform gives you its values; put the file next to the rest of your configuration, and the schema tells you what is missing:
# platform.toml
backend = "opensandbox"
[opensandbox]
endpoint = "https://sandbox.example.com"
credential_env = "SANDBOX_CREDENTIAL"
[opensandbox.network]
sandbox_cidrs = ["10.42.0.0/16"]
[storage]
host_path = "/shared"
[storage_sandbox]
image = "registry.example.com/team/flotilla-storage@sha256:..."Measure the deployment's isolation once, before running anything on it. Commands outside your process load the same file:
flotilla probe --config platform.toml --env sandbox.envSee Running tasks for path binding and Deployment for credentials and the storage image.
import asyncio
from pathlib import Path
from flotilla import Deployment, OpenOptions
async def main():
deployment = Deployment.from_toml("platform.toml")
plan = deployment.plan(Path("tasks/demo/redis"), OpenOptions(startup_timeout=600, lifetime=300))
async with deployment.client() as fleet:
async with fleet.environment(plan) as env:
pong = await env.service("cache").exec(["redis-cli", "ping"], timeout=30)
print(pong.stdout.decode().strip())
assert fleet.cleanup_report is not None and fleet.cleanup_report.clean
asyncio.run(main())Deployment.plan resolves the task directory into the trial open runs, as a local computation,
so a caller can check a whole set of tasks before spending a sandbox on any of it. fleet.environment
opens the plan and releases it on exit. The task's own files are uploaded into each sandbox before
its services start. This is the runtime. flotilla.flow.run wraps it into a whole run -- the Actors
through a harness you supply, then collect, verify and verdict.json; see
task flow -- and harbor's own trial machinery drives the same runtime in its loop.
Harbor drives the same lifecycle itself, in place of this loop:
harbor run --env flotilla.integrations.harbor:FlotillaTaskEnvironment \
--ek config=platform.toml \
--path /srv/tasks/example/ds/demoSee running harbor trials for what the environment does per trial.
- Compose semantics, checked up front.
depends_onwith health conditions, healthchecks, multiple and internal networks, aliases, named volumes, bind mounts,env_file,.envinterpolation, resource limits, anduser. Every key is classified as equivalent, warned, or rejected, and a rejected key fails the task with its field path before anything is created. The Compose subset is parsed by Flotilla itself, with nodocker composebinary;flotilla inspectshows the result locally. See Compose support. - Explicit isolation. Network policies are compiled from the Compose networks and the deployment's egress policy: none, an allowlist, or any. A task can turn off internet access entirely. An isolation property
flotilla probecannot demonstrate must be accepted by name in the spec. - Confirmed cleanup. Every sandbox and directory is labeled with its owner. A lost create response is reconciled, capacity is released only after deletion is confirmed, and
flotilla gccollects what a crashed process left behind. - No silent replays. A command is never sent twice.
timed_out=Truemeans the remote process was confirmed stopped; if that cannot be confirmed, you getExecOutcomeUnknownand the environment is retired. - Built for many concurrent environments. One client manages admission, create and exec rate limits, sandbox renewal, and per-service resource defaults for every environment it opens.
- Pluggable backends. OpenSandbox is built in. Another backend lives in the source tree and is added to the
BACKENDStable in theflotilla/configpackage; see Writing a backend.
Flotilla runs on Linux x86_64 with Python 3.12. A task's task.toml is Harbor's format, so
harbor is a required dependency; nothing needs Docker, a Compose binary or a GPU stack. A
deployment's isolation must pass flotilla probe before use; see the
deployment guide.
git clone https://github.com/matrix72c/flotilla.git
cd flotilla
python -m pip install .The distribution, import name and CLI are flotilla. Install from this repository or a wheel built from a fixed commit; do not run bare pip install flotilla, which selects an unrelated public PyPI project. Use a fresh environment when migrating from flotilla-compose; the two distributions must not share an environment because they own the same Python module.
Then pick a path:
| You have | Start with |
|---|---|
| One Linux machine with Docker, and want to try it | Local quick start: run OpenSandbox and Flotilla on one machine |
| Deployment values from whoever runs your sandbox platform | Quick start: write a task and run it from Python |
| Harbor tasks such as Terminal-Bench | Running tasks: run Harbor-format tasks from Python, or drive them with harbor run itself |
| A sandbox platform to set up for your team | Deployment guide |
Using Flotilla
- Quick start: write a multi-service task and run it.
- Running tasks: task layout, task files, and
flotilla inspect. - Task flow:
flotilla.flow.runend to end -- the modules, the nine steps, verdicts and the grading SDK. - Runtime API: execution, files, background processes, timeouts, cancellation, and errors.
- Compose support: which Compose keys are supported, approximated, or rejected.
Operating a deployment
- Deployment guide: one-time setup of the storage image, the isolation probe, and feature enablement.
- Configuration reference: every field of a deployment spec.
- OpenSandbox backend: the execd protocol, storage/network mapping, and read-only rootfs, tmpfs and shared memory.
Extending Flotilla
- SDK surface: what may be imported from
flotilla,flotilla.flow,flotilla.verifier,flotilla.integrations.harbor, andflotilla.testing, and the stability commitments. - Integration guide: use Flotilla from an evaluation runner or RL framework, or run harbor trials directly.
- Writing a backend: support another sandbox platform.
- Architecture: internals and terminology.
Flotilla is alpha software. The supported targets are Linux x86_64, Python 3.12, the OpenSandbox backend with execd release 1.1.1 or later, and released Harbor (harbor>=0.26.0,<0.27) for harbor-driven trials. APIs and configuration may change between minor versions before 1.0; the commit history records each change.
Contributions are welcome; see CONTRIBUTING.md. Report vulnerabilities privately as described in SECURITY.md. This project follows a code of conduct.
Flotilla is licensed under the Apache License 2.0. The storage image includes BusyBox, which is licensed under GPLv2; see third-party components.