Skip to main content
The 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:
This installs:
  • openenv-core - OpenEnv client library
  • prime-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 with reset() 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:

Building Images

The vf-build command:
  1. Builds the Docker image from proj/Dockerfile
  2. Tags it with your environment name
  3. Pushes to Prime registry
  4. Creates .build.json with 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 /health endpoint that returns 200 when ready
  • Schema validation - Return proper JSON schema from /schema
  • Error handling - Return errors in observation field, not as HTTP errors
  • Deterministic resets - Use the seed parameter for reproducible episodes
  • Action validation - Validate actions match your schema before processing

Troubleshooting

Sandbox Not Starting

Check logs:
Common issues:
  • Missing /health endpoint
  • Server not binding to 0.0.0.0
  • Port mismatch in .build.json

Contract Mismatch

If you see “contract mismatch” errors:
  • Verify .build.json has correct contract field
  • For gym: action schema should not have tool_name field
  • For MCP: action schema should have tool_name and arguments fields

Prompt Renderer Errors

Prompt renderer must:
  • Accept observation as first argument
  • Return list of message dicts with role and content
  • Return non-empty list
  • Handle both reset and step contexts