-
Notifications
You must be signed in to change notification settings - Fork 499
docs: add an Environments section to the user guide #1833
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| --- | ||
| title: Environments | ||
| description: How Miles trains on RL environments — datasets with rewards, self-wired environments, and optional external ecosystems. | ||
| --- | ||
|
|
||
| Miles owns the training side of environment RL — batch orchestration, lossless | ||
| token-in/token-out recording, reward hooks, filtering — and is agnostic about | ||
| where the environment itself comes from: | ||
|
|
||
| - **No environment** — single-turn RLVR: a prompt dataset scored by the | ||
| built-in rule-based rewards (math, ifbench, ...) or a custom reward function. | ||
| - **Your own environment** — plug your code into one of the three rollout | ||
| layers described in [Integration shapes](#integration-shapes); most | ||
| environments sit in the agent function, with the session server recording | ||
| tokens (see [Rollout Endpoints](/user-guide/rollout-endpoints)). | ||
| - **An external ecosystem** — adopt a prebuilt connector from the table below; | ||
| connectors occupy the same three layers. | ||
|
|
||
| | Integration | Plugs in at | | ||
| |---|---| | ||
| | [Harbor](/user-guide/harbor) | agent function | | ||
| | [OpenEnv](/user-guide/openenv) | agent function | | ||
| | [Strands Agents](https://github.com/radixark/miles/tree/main/examples/strands_sglang) | generate function | | ||
| | [τ-bench](https://github.com/radixark/miles/tree/main/examples/tau-bench) | generate function | | ||
|
|
||
| Sandbox providers are a different axis: they provision the task containers | ||
| *inside* a connector rather than occupying a rollout layer. | ||
|
|
||
| | Sandbox provider | Used within | | ||
| |---|---| | ||
| | [Daytona](https://www.daytona.io/) | OpenEnv, Harbor | | ||
|
|
||
| All external ecosystem support is experimental. | ||
|
|
||
| ## Integration shapes | ||
|
|
||
| The rollout stack is three nested plug-in layers (see | ||
| [Customization](/user-guide/customization)): each column in the table below | ||
| wraps the one to its left, so replacing an outer layer also takes over | ||
| everything an inner one would. A connector replaces exactly one layer. | ||
|
|
||
| ✓ = the external framework takes it over; ○ = stays in Miles. | ||
|
|
||
| | | Agent function (innermost) | Generate function | Rollout function (outermost) | | ||
| |---|:---:|:---:|:---:| | ||
| | Plug-point flag | `--custom-agent-function-path` | `--custom-generate-function-path` | `--rollout-function-path` | | ||
| | Agent–environment loop | ✓ | ✓ | ✓ | | ||
| | Trajectory & token recording | ○ | ✓¹ | ✓¹ | | ||
| | Reward pathway (RM hooks, group rewards) | ○² | ○² | ✓ | | ||
| | Data source (prompts / taskset) | ○ | ○ | ✓ | | ||
| | Batch orchestration (grouping, filtering) | ○ | ○ | ✓ | | ||
| | Model, engines & weight updates, advantages, optimizer | ○ | ○ | ○ | | ||
|
|
||
| ¹ Typically by speaking SGLang's native `/generate` (token IDs in and out) | ||
| rather than the session-server chat endpoint Miles' own recording uses. | ||
|
|
||
| ² The environment may grade an episode itself (Harbor and τ-bench do); the | ||
| score still enters training through Miles' `Sample.reward` / RM hooks, and | ||
| group-level reward handling stays in Miles. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| --- | ||
| title: Harbor | ||
| description: Train agents on mixed task suites (SWE-bench, Terminal-Bench, custom) through the Harbor framework. | ||
| --- | ||
|
|
||
| [Harbor](https://github.com/harbor-framework/harbor) is an agent-environment | ||
| framework from the Laude Institute: agent orchestration and grading are unified | ||
| in a single `Trial.run()` call, and a task is fully described by four files | ||
| (`instruction.md`, `Dockerfile`, `test.sh`, `task.toml`), so mixed task suites — | ||
| SWE-bench, Terminal-Bench, custom tasks — train through one endpoint. | ||
|
|
||
| Miles integrates Harbor as an | ||
| [agent-function integration](/user-guide/environments): the agent function | ||
| hands each session's OpenAI-compatible URL to a Harbor server, which runs the | ||
| per-task container, installs and runs the agent against that URL, and grades | ||
| the result; the grade becomes the sample's reward through a custom reward | ||
| hook. | ||
|
|
||
| ## Try it | ||
|
|
||
| The maintained recipe lives in | ||
| [`examples/experimental/swe-agent-v2`](https://github.com/radixark/miles/tree/main/examples/experimental/swe-agent-v2), | ||
| with synchronous and fully-async launchers. Follow the | ||
| [recipe README](https://github.com/radixark/miles/blob/main/examples/experimental/swe-agent-v2/README.md) | ||
| for the architecture, Harbor server setup, task format, and launch scripts. | ||
|
Comment on lines
+21
to
+25
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This example is stale and I have a new one introduced in PR 1741. But let's merge your PR first, and I'll update this section in my PR. |
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| --- | ||
| title: OpenEnv | ||
| description: Train on Hugging Face OpenEnv environments through the agent-function extension point. | ||
| --- | ||
|
|
||
| [OpenEnv](https://github.com/huggingface/openenv) is Hugging Face's open | ||
| protocol for RL environments: an environment is an HTTP service exposing | ||
| `reset` / `step` (and optionally `evaluate`), so any environment speaking the | ||
| protocol can serve any trainer. | ||
|
|
||
| Miles integrates OpenEnv as an | ||
| [agent-function integration](/user-guide/environments): a Miles-side agent | ||
| function drives the agentic loop — `reset(task_id)`, repeated `step`s, then | ||
| scoring the episode with the task's own tests — against an unmodified OpenEnv | ||
| server, and the score becomes the sample's reward through a custom reward | ||
| hook. | ||
|
|
||
| ## Try it | ||
|
|
||
| The maintained end-to-end recipe is **Terminal-Bench-2 GRPO** in | ||
| [`examples/experimental/openenv`](https://github.com/radixark/miles/tree/main/examples/experimental/openenv). | ||
| It runs against a shared Docker env server (full per-task image fidelity) or | ||
| per-episode [Daytona](https://www.daytona.io/) cloud sandboxes built from each | ||
| task's official image (no resident infrastructure). Follow the | ||
| [recipe README](https://github.com/radixark/miles/blob/main/examples/experimental/openenv/README.md) | ||
| for prompt-data preparation, env-server modes, launcher flags, and operational | ||
| notes. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would replace this table with text
Having a table here with a single row "Daytona" might give people the false impression that we have a special relationship with them lol.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a placeholder. I'll very soon add more items here like agentENV and modal