Environments
An environment is the multi-turn task an Async GRPO with Environments run trains against. The protocol (EnvironmentBase, halo/environments/environment_base.py):
reset(prompts, contexts)opens one episode per prompt.step(episode_ids, actions, contexts)executes a model turn and returns the next observation.get_trajectories(episode_ids)hands back the messages and the final reward.
An episode ends when the environment reports it done, or at max_turns.
Registry
environment_type resolves through build_environment (halo/environments/registry.py). get_registered_environments() lists the live set; register_environment extends it (Custom Environments).
The last column is the class's own turn budget, which max_turns: null keeps.
The ReAct presets parse the action out of the text. Every other environment uses native tool calls, so the server needs the family's --tool-call-parser (Tool calls).
Actor runtime
Actors run environments on CPU and inherit the ray start daemon's environment, so export what they need before ray start on each node (Ray Cluster).
Configuration
EnvironmentConfig (halo/configs/grpo_environmental.py) has four top-level fields. Everything else goes in environment_kwargs.
YAML
environment_type: react_math
rewards:
- source: environment # the environment's grade in [0, 1], priced weight × grade ^ exponent
max_turns: null # null keeps the class default
environment_kwargs:
carry_reasoning: false
tool_error_penalty: 0.1- Any other constructor parameter of the resolved class that YAML can spell is settable from
environment_kwargs; one taking a Python object, andmcp's customserver_command/server_args/server_env(From Python), is not. A key no constructor binds (a typo, or anotherenvironment_type's option) raisesTypeErrorat construction. - A boolean knob takes YAML
trueorfalse; any other value,noandoffincluded, raises at construction. - The ReAct presets refuse a set
system_prompt,mcpreadsmcp_serverin its factory, andnative_combinedreadssearch_backendin its own. rewardsreaches the constructor asreward_terms(Reward Terms).
Common knobs
Every environment accepts these environment_kwargs, beside the top-level max_turns and rewards (Configuration).
Reward and penalty knobs are magnitudes (≥ 0); a negative value raises. A bare environment_kwargs: header reads as null and raises: comment it out, or list its keys.
Pages
Tool protocols
- ReAct — Thought / Action / Observation in plain text.
- Native Tool-Use — function calling and tool factories; most environments extend it.
- MCP — tools from an MCP server.
Tasks
- Code Contests — competitive programming, hidden-test grading.
- SWE — persistent-workspace agent.
- QA Benchmarks —
qa_searchandexam_qa.
Infrastructure and authoring
- Code Execution Sandboxes — backends, faults, limits.
- Custom Environments — write, register and test your own.
- Evaluation — run a model through an environment.
Source on GitHubUpdated 18 November 2026