OpenEnvEnv integration allows you to run OpenEnv environments (supporting both gym-style and MCP contracts) inside Prime Sandboxes using prebuilt container images.
OpenEnv environments use seed-based episode generation and can support both step-based (gym) and tool-based (MCP) interaction protocols.
Features
- Gym and MCP contracts - Support for both step-based and tool-based environments
- Prime Sandboxes integration - Runs in isolated containers
- Seed-based episodes - Deterministic episode generation via seeds
- Automatic image building - Build and register Docker images with
vf-build - Custom prompt rendering - Convert observations to chat messages
Installation
Install with OpenEnv support:openenv-core- OpenEnv client libraryprime-sandboxes- Prime Sandboxes SDK
Quick Start
1
Create OpenEnv project
Create an OpenEnv environment project with a Dockerfile:
2
Build and register image
Build the Docker image and register it with Prime:This creates
.build.json with image metadata:3
Create Verifiers wrapper
Wrap your OpenEnv environment:
4
Evaluate
Run an evaluation:
Gym Contract
For gym-style environments withreset() and step(action) methods:
Server Implementation
Dockerfile
Build Manifest
Prompt Renderer for Gym
MCP Contract
For tool-based environments using the Model Context Protocol:Server Implementation
Build Manifest for MCP
Prompt Renderer for MCP
MCP environments automatically inject tool definitions, so prompt renderer just needs to format observations:OpenEnvEnv Configuration
Custom Rubrics
By default,OpenEnvEnv uses OpenEnvEpisodicSumRubric which sums per-step rewards. Create custom rubrics for different scoring:
Examples
See example OpenEnv integrations in the Verifiers repository:- openenv-textarena - TextArena Wordle game via OpenEnv
- openenv-echo - Simple echo server example
Building Images
Thevf-build command:
- Builds the Docker image from
proj/Dockerfile - Tags it with your environment name
- Pushes to Prime registry
- Creates
.build.jsonwith metadata
Best Practices
The
prompt_renderer is required and must return non-empty chat messages. OpenEnv makes no assumptions about how observations should be presented to the model.- Health checks - Implement
/healthendpoint that returns 200 when ready - Schema validation - Return proper JSON schema from
/schema - Error handling - Return errors in
observationfield, not as HTTP errors - Deterministic resets - Use the
seedparameter for reproducible episodes - Action validation - Validate actions match your schema before processing
Troubleshooting
Sandbox Not Starting
Check logs:- Missing
/healthendpoint - Server not binding to
0.0.0.0 - Port mismatch in
.build.json
Contract Mismatch
If you see “contract mismatch” errors:- Verify
.build.jsonhas correctcontractfield - For gym: action schema should not have
tool_namefield - For MCP: action schema should have
tool_nameandargumentsfields
Prompt Renderer Errors
Prompt renderer must:- Accept
observationas first argument - Return list of message dicts with
roleandcontent - Return non-empty list
- Handle both
resetandstepcontexts