Skip to main content

Overview

The prime env init command scaffolds a new environment module with a basic template, including starter code, metadata, and documentation.

Usage

Arguments

string
required
Environment ID (will be normalized to use underscores for the package name).Example: my-env creates environments/my_env/

Options

string
default:"./environments"
Path to environments directory where the new environment will be created.
flag
Overwrite README.md if it already exists.
flag
Create a multi-file package structure with __init__.py instead of a single-file module.
flag
Initialize with the OpenEnv layout for tool-use environments. Creates proj/ directory with OpenEnv project structure.

Created Structure

Standard Environment

By default, creates a single-file module structure:

Multi-File Environment

With --multi-file, creates a package structure:

OpenEnv Environment

With --openenv, creates an OpenEnv-based environment:

Examples

Create a Standard Environment

Output:

Create a Multi-File Environment

Output:

Create an OpenEnv Environment

Output:

Custom Path

Creates the environment in ~/my-envs/my_env/.

Template Contents

Environment Implementation

The generated my_env.py contains a starter template:

pyproject.toml

Defines the package metadata and dependencies:

README.md

Provides a documentation template with sections for:
  • Overview
  • Datasets
  • Task description
  • Quickstart examples
  • Environment arguments
  • Metrics

Next Steps

After creating an environment:
  1. Edit the environment code in my_env.py
  2. Add dependencies to pyproject.toml if needed
  3. Install the environment:
  4. Test with an evaluation:

OpenEnv Workflow

For OpenEnv environments, additional steps are required:
  1. Implement the OpenEnv server in proj/server/app.py
  2. Build the Docker image:
  3. Install and test:
See the Environments documentation for detailed implementation guidance.

Naming Conventions

  • Environment IDs can use hyphens (e.g., my-env) or underscores (e.g., my_env)
  • Package names normalize to underscores (e.g., my_env)
  • Directory names match the package name (e.g., environments/my_env/)
  • Module names match the package name (e.g., my_env.py)

Troubleshooting

Directory Already Exists

If the environment directory already exists, the command will skip creating existing files:
Use --rewrite-readme to force overwrite the README.

Invalid Environment Name

Environment names must be valid Python package names. Avoid special characters and spaces.