Novita Sandbox is now a listed sandbox provider in Miles, RadixArk’s open-source framework for large-scale reinforcement learning and model post-training. The integration covers two agentic environment recipes on Miles’ main branch: Harbor trials and the Terminal-Bench-2 OpenEnv recipe. You switch providers with an environment variable and keep using the Miles training command; there is no separate provider service to run. The OpenEnv quickstart below is the shortest way to confirm the path works on your own account.
Run the OpenEnv recipe on Novita Sandbox
Run this from the Miles repository on a machine that already has a working Miles installation, plus a Novita account and API key. Replace the placeholder with your own key; the novita extra installs the Novita Sandbox SDK (novita-sandbox>=2.0.7). You also need a Terminal-Bench-2 task checkout on disk.
export NOVITA_API_KEY="<YOUR_NOVITA_API_KEY>"
pip install -e ".[novita]"
cd examples/experimental/openenv
export OPENENV_TB2_TASKS_DIR=/path/to/terminal-bench-2
export OPENENV_SANDBOX_BACKEND=novita
python run-openenv-tbench2.py
OPENENV_SANDBOX_BACKEND=novita is the switch that matters. Without it, the OpenEnv recipe uses its default behavior; with it, each episode’s sandbox is created on Novita in the region named by NOVITA_DOMAIN. The key can also live in a file instead of the environment, which is useful on shared training hosts.
The first episode pays for the image build. If you plan to run many tasks, prebuild the per-task templates so training does not wait on Dockerfile builds:
python tb2_sandbox_novita.py --tasks-dir /path/to/terminal-bench-2 --all
That command is worth running on a small task set first. A template build failure for one task is easy to debug alone and annoying to find halfway through a long rollout job.
Why an RL training loop needs a sandbox
Miles splits the work in a way that makes the sandbox boundary obvious. Rollout generation runs on SGLang for throughput. Policy updates run on Megatron-LM, with FSDP2 and torchtitan as alternatives. Between them sits the environment layer: the place where a tool-using agent runs a command, inspects a file, observes the result, and takes the next step.
In a toy environment, that layer is cheap. In agentic RL it is not. An episode may install a package, edit a repository, start a server, or leave a process running. If two episodes share a filesystem or a background process, the second rollout is not starting from the same state as the first. The reward can move for reasons that have nothing to do with the policy. Sandboxes for RL agents covers the reset and state-isolation side of that problem in detail; the short version is that repeatability depends on the runtime as much as on the reward function.
Novita’s role in the Miles integration is deliberately narrow: it supplies the execution environment. Miles keeps coordinating rollouts, rewards, and policy updates. The task environment, agent process, command execution, and verification happen inside a Novita Sandbox. If you are new to the isolation model, What Is an AI Agent Sandbox? explains the boundary that each episode gets.
That split is what makes the two recipes interchangeable at the provider level. Harbor and OpenEnv are different connectors with different task formats, but both need an isolated environment per trial or episode, a way to upload task files, and a lifecycle that ends cleanly.
Harbor: trials from the Miles rollout worker
Harbor is an open-source framework for evaluating and optimizing agents and language models in sandboxed environments. In the Miles recipe, the Harbor trials run from the Miles rollout worker while the task environment is hosted on Novita.
The Harbor path uses a specific branch, harbor-miles-v0.20.0, and the harbor[novita] extra:
export NOVITA_API_KEY="<YOUR_NOVITA_API_KEY>"
uv pip install "harbor[novita] @ git+https://github.com/harbor-framework/harbor@harbor-miles-v0.20.0"
HARBOR_ENV_TYPE=novita python examples/experimental/harbor/run.py \
--harbor-tasks-dir /path/to/harbor_tasks \
--prompt-data /path/to/tb2_train.jsonl \
--session-server-external-host <trainer-address-reachable-from-the-sandboxes>
HARBOR_ENV_TYPE=novita selects the Novita environment provider for the trials. The --session-server-external-host value has to be an address that the sandboxes can reach, not a loopback address on the trainer. Get this wrong and the run starts, the sandbox is created, and then the agent cannot talk back to the session server.
Task data, dependencies, and network requirements follow the Miles Harbor recipe rather than the generic Harbor task model. Data preparation and the model and GPU arguments are unchanged; only the environment provider moves. If you already use Harbor outside Miles for evaluations, running Harbor evaluations on Novita Agent Sandbox describes the standalone path and how it maps to the sandbox lifecycle.
OpenEnv: Terminal-Bench-2 episodes on per-task templates
OpenEnv is Hugging Face’s framework for isolated execution environments for agentic RL, built around Gymnasium-style APIs. Its connector for Miles pairs Novita with the Terminal-Bench-2 recipe: one named sandbox template per task, one sandbox per episode started from that template.
The template naming is deterministic. The name is derived from the task ID plus a digest of the build recipe, which covers the base image, build commands, resources, build user, and start command. Repeated episodes reuse the template, and editing the recipe produces a new name instead of silently reusing a stale image. That detail matters when you are iterating on an environment: a changed Dockerfile will not be masked by a cached template.
At episode start, the sandbox launches the environment server as root, and the recipe waits for the server’s health endpoint on the sandbox’s public host before handing control to the agent. When the episode ends, the sandbox is killed. The OpenEnv example that ships with the framework is a smaller version of the same flow: build a provider, start a container, wait for readiness, reset a task, send exec actions, and stop the container in a finally block.
Configuration reference
These variables control the integration. Rows with a dash have no default documented in the Miles guide and need to be set explicitly.
| Variable | Purpose | Default |
|---|---|---|
NOVITA_API_KEY | Novita API key. Takes precedence over the key file. | - |
NOVITA_API_KEY_FILE | Path to a file containing the key. | ~/.config/novita/api_key |
NOVITA_DOMAIN | Region domain for sandboxes. sandbox.novita.ai is the legacy us-virginia-1 endpoint. | us-phx-1.sandbox.novita.ai |
NOVITA_API_URL / NOVITA_SANDBOX_URL | Endpoint overrides read by the SDK and forwarded by Miles when set. | - |
OPENENV_SANDBOX_BACKEND | Set to novita to use Novita for OpenEnv per-episode sandboxes. | - |
HARBOR_ENV_TYPE | Set to novita to use Novita for Harbor trials. | - |
OPENENV_NOVITA_SANDBOX_TTL_S | Sandbox TTL in seconds. | 1800 |
Two of these are worth a second look. NOVITA_DOMAIN defaults to the Phoenix region; if your data or trainer is closer to another region, set it explicitly rather than relying on the default. OPENENV_NOVITA_SANDBOX_TTL_S defaults to 30 minutes, which is the ceiling for a sandbox whose creator process disappears, not a target episode length.
How the integration handles sandbox lifecycle
Four mechanisms do the operational work in the OpenEnv path, and the same ideas carry into Harbor.
Deterministic templates remove the ambiguity between “the environment changed” and “the cache served the old one.” The template name is a function of the task and its build recipe, so a repeat episode hits the same template while an edited recipe gets a new one.
Per-episode sandboxes keep trial state from leaking across episodes. Each episode starts fresh from the template, launches the environment server, waits for the health check, and kills the sandbox when the episode finishes. No episode inherits a running process or a modified filesystem from the one before it.
TTL with keepalive covers the failure case you will eventually hit: a trainer process dies without cleanup. Every sandbox has a bounded lifetime, and a keepalive thread re-arms the TTL while the creating process is alive. If the process is hard-killed, the sandbox is reclaimed within the TTL instead of running until someone notices the bill.
Concurrency limits and retries keep a large rollout job from stampeding the sandbox API. Sandbox creation is bounded by a configurable concurrency limit, and rate-limit responses from the Novita API are retried rather than failing the trial. This is the part of the integration that matters most at scale, and it is what makes the recipes usable beyond a smoke test.
Who this fits, and what it does not cover
Use the integration if you run Miles from main, need remote isolated environments for Harbor tasks or Terminal-Bench-2 episodes, and would rather not manage local Docker capacity for concurrent trials. The case is strongest for shared development servers, CI-style evaluation runs, and benchmark jobs that need reproducible sandbox lifecycles across many trials.
It is not a drop-in replacement for every Miles connector. Novita is currently wired into the experimental Harbor and OpenEnv recipes only; the other environment connectors Miles ships (HUD, NeMo Gym, Verifiers) are outside this integration. The recipes are also on the main branch and marked experimental, so pin your Miles revision if you need reproducibility across a long training campaign.
Selecting a sandbox backend also does not prepare the training side. You still need a working Miles installation with the model and GPU environment set up; the sandbox only replaces the execution environment for the agent’s actions. Build templates on a small task set, confirm the environments come up, and only then commit GPU hours to a long run.
The provider landed in Miles through pull request #4435, “feat(agentic): add Novita Agent Sandbox as a sandbox provider,” merged on November 4, 2026. That is the reference point if you need to confirm which Miles revision first contains the code path.
Conclusion
For agentic RL, the sandbox is part of the experiment, not an implementation detail. Miles handles rollout generation and policy updates; Novita supplies the isolated environment where each episode’s commands actually run. If you are on Miles main and running Harbor or Terminal-Bench-2 workloads, the integration lets you move that execution layer to Novita with one environment variable per recipe. Start with the OpenEnv quickstart above, prebuild a few templates, watch one full episode complete, and then scale the concurrency.
FAQ
Does Miles support Novita Sandbox as a provider?
Yes. Novita Sandbox is listed as a sandbox provider in Miles, with experimental Harbor and OpenEnv recipes on the main branch. The integration merged in PR #4435. To see the product side, explore Novita Sandbox and review the Sandbox overview before you configure a run.
What does OPENENV_SANDBOX_BACKEND=novita change?
It tells the OpenEnv recipe to create its per-episode sandboxes on Novita instead of its default backend. With the variable set, the recipe also uses the Novita-specific template naming, TTL, and concurrency handling. Without it, the rest of the Miles rollout job is unchanged.
What happens to a sandbox if the training process crashes?
The sandbox has a bounded TTL, 1800 seconds by default through OPENENV_NOVITA_SANDBOX_TTL_S. A keepalive thread extends that lifetime while the creating process is alive. If the process is hard-killed, no keepalive arrives and the sandbox is reclaimed within the TTL, so a crashed trainer does not leave sandboxes running indefinitely.
Do I need Docker installed for Harbor tasks on Novita?
No for the task environment. When --env novita or HARBOR_ENV_TYPE=novita is selected, Harbor builds or reuses a Novita template for the task and creates the sandbox from it. The Harbor CLI still runs on your machine or server; the agent, command execution, and verifier run inside the Novita Sandbox. Local Docker capacity is not part of the execution path.
Can I build the Terminal-Bench-2 templates before training starts?
Yes. Run python tb2_sandbox_novita.py --tasks-dir /path/to/terminal-bench-2 --all from the OpenEnv example directory. Prebuilding removes the image-build wait from the first training episode, which matters when you are paying for GPU time while the rollout waits on a template.
Which Miles revision includes the Novita provider?
The Harbor and OpenEnv recipes are on Miles’ main branch as of the integration PR #4435, merged November 4, 2026. Because the recipes are experimental, pin the commit you validated if you need the same behavior across a longer training campaign.