Creating a New Environment
The recommended approach is to create an environment module, i.e. a self-contained package that can be installed and reused.Initialize from Template
Basic Environment Structure
Every environment module must export aload_environment function:
Adding Dependencies
Specify environment-specific dependencies inpyproject.toml:
Default Evaluation Configuration
You can specify default evaluation parameters in yourpyproject.toml to customize the default behavior when users run vf-eval without explicit arguments:
pyproject.toml and used when:
- Users don’t provide
-n/--num-examplesor-r/--rollouts-per-exampleflags - The package is installed and
pyproject.tomlis included in the package distribution
pyproject.toml is included in your package by adding it to the [tool.hatch.build] section:
-n 10, that value will be used regardless of what’s in pyproject.toml.
Third-party libraries can also access these defaults programmatically:
Development Workflow
1. Install Your Environment
During development, install your environment locally:2. Test Your Environment
Use the CLI to quickly test:AsyncOpenAI + await env.evaluate(...) for fully async workflows; the sync helper is ideal when integrating into existing blocking scripts. Intermediate saving via save_every requires the default interleaved scoring pipeline.
3. Iterate on Design
Common iterations:- Adjust system prompts for better performance
- Refine parser logic for edge cases
- Add new reward functions to the rubric
- Configure dataset filtering or sampling
Using Prime CLI and the Environments Hub
Prime Intellect provides a hosted Environments Hub for discovering, installing, and sharing verifiers packages. Theprime CLI wraps the same templates and packaging helpers exposed here, so you can publish environments once and re-use them from local machines, CI pipelines, or Prime pods.
Install and authenticate
prime config use <team> (or set --team flags in later commands) so pushes end up in the shared namespace.
Bootstrap templates from the CLI
prime env init <name> uses the same generator as vf-init, but it pre-populates the directory inside ./environments/ and prints the follow-up commands for publishing. Use this when you’re starting a project that you plan to ship through the Hub:
vf-init, no migration is required—prime env push operates on any directory that contains a valid pyproject.toml and load_environment implementation.
Publish versions to the Hub
Once your package is ready, build and upload it with:uv build when available), computes a deterministic content hash, and uploads the artifact. Add --auto-bump to increment the patch version before publishing, or pass --team <slug> to publish under a team namespace. Successful pushes print a dashboard link plus a one-line install command.
You can manage published artifacts directly from the CLI:
prime env version list owner/nameshows version history and hashes.prime env version delete owner/name <content_hash>removes a specific build.prime env delete owner/namedeletes the environment entirely.
Discover, install, and inspect environments
The CLI also helps consumers find and install verifiers:prime env install prefers installing from the Hub’s simple index (so upgrades work with uv add/pip install too), and falls back to direct wheel URLs for older releases. After installation the package becomes available to verifiers.load_environment just like any other module:
prime pods create, include these install commands in your startup scripts so the same environment definitions are available remotely.
Working with Rubrics
Rubrics are central to defining what makes a good response in your environment. Here’s how to use them effectively:Basic Reward Functions
A reward function takes the full context and returns a score (typically 0.0 to 1.0):Creating Rubrics
Combine multiple reward functions with weights:Using Parser Format Rewards
Parsers often provide format reward functions:Stateful Reward Functions
Access environment state for complex evaluation:Environment Types
Choose the appropriate base class for your task:SingleTurnEnv
For one-shot tasks with clear input/output:MultiTurnEnv
For interactive tasks requiring multiple steps:ToolEnv
For tasks requiring external tools:state rather than globals. Use StatefulToolEnv if you need to inject extra arguments or secrets into each tool invocation.
StatefulToolEnv
For stateful workflows, extendvf.StatefulToolEnv:
add_tool(..., args_to_skip=[...]) so the model never sees them.
SandboxEnv & PythonEnv
vf.SandboxEnv packages the pattern above for Prime sandboxes: it kicks off container startup in setup_state and injects handles into tool calls once ready. vf.PythonEnv is the canonical example—review it when building similar sandboxes or remote runtimes.
Advanced Patterns
Configurable Environments
Accept parameters to customize behavior:Custom Datasets
Load datasets from various sources:Composition with EnvGroup
Combine multiple environments for training on diverse tasks:- Dataset Concatenation: Combines datasets from all environments with task labels
- Automatic Routing: Routes rollouts to the correct environment based on the
taskcolumn - Unified Scoring: Aggregates scores across all environments
- Training on multiple task types simultaneously
- Evaluating general capabilities across domains
- Creating curriculum learning setups
Installing from Repository
Install environments from the verifiers repository:Best Practices
- Start Simple: Begin with SingleTurnEnv and basic reward functions
- Test Early: Use
vf-evalto test your environment during development - Document Well: Include clear README with examples and expected behavior
- Handle Errors: Ensure parsers and reward functions handle edge cases
- Version Dependencies: Pin specific versions in pyproject.toml
Next Steps
- See Components for advanced rubrics, tools, parsers, and practical examples
- Explore Training to use your environment for model improvement