# benchmax

> A Python SDK for defining reinforcement-learning environments as code — tools, rewards and datasets — and launching training jobs on them

- Category: Training & Fine-Tuning / RLHF & Alignment
- Language: Python
- Licence: Apache-2.0
- Repository: https://github.com/castform-ai/benchmax
- Website: https://www.castform.com
- Canonical page: https://ai-tldr.dev/tools/benchmax/
- Updated: 2026-08-05

## In short

benchmax is a Python SDK for defining and training reinforcement-learning environments: tools, rewards and datasets as code. It sits in the RLHF & Alignment category of the Training & Fine-Tuning tools and is open-source, written in Python and licensed Apache-2.0. To get started: install.

## Overview

benchmax is a Python SDK for defining and training reinforcement-learning environments: tools, rewards and datasets as code. Instead of hand-assembling a post-training pipeline, you describe the environment a model should learn in — what it can call, what counts as success, what data it sees — and hand that object to a trainer.

Two base classes cover the common shapes. Extending BaseEnv gives you a basic model-and-tool loop; HarborEnv is for training against an arbitrary harness and sandbox, so the environment can be a real program the model drives rather than a synthetic task. The companion castform package layers on dataset-generation helpers, environment validation and job launching, and its setup command signs you in and creates a starter environment.

The SDK is the open, Apache-2.0 half of Castform, a commercial platform that runs the reinforcement-learning post-training itself so developers do not manage GPUs. It requires Python 3.12.

## What it does

- Define an RL environment in code: tools, rewards and datasets in one object
- BaseEnv for a straightforward model-and-tool loop
- HarborEnv for training against an arbitrary harness and sandbox
- Dataset-generation helpers and environment validation before you spend a training run
- Launch training jobs on the Castform platform from the CLI
- Apache-2.0 SDK, installable with uv or pip on Python 3.12

## Getting started

Install the castform package (which brings the benchmax SDK), sign in, and start from the generated starter environment.

1. Install

   Either installer works; the CLI is called castform.

```bash
uv tool install -U castform
# or: pip install -U castform
castform --version
```

2. Sign in and scaffold an environment

   setup signs you in and creates a starter environment to edit.

```bash
castform setup
```

3. Write the environment

   Subclass BaseEnv for a model-and-tool loop, or HarborEnv when the model should drive a real harness inside a sandbox. The repository's examples show both shapes.

```text
# extend BaseEnv for a tool loop, or HarborEnv for a harness + sandbox
```

4. Validate, then launch

   The castform package adds dataset-generation helpers, environment validation and training-job launching, so a broken reward is caught before a run starts.

```text
# validate the environment, generate data, then launch the training job
```

## When to use it

- Post-train a small open-weight model on a narrow task instead of paying for a frontier model on every request
- Express a reward as code — what a good trajectory looks like in your own product
- Train an agent against the actual harness and sandbox it will run in, not a stand-in
- Run reinforcement learning without provisioning or babysitting GPUs

## Version history

- 2026-08-05: Castform showed a 4B open-weights model post-trained with reinforcement learning matching GPT-5.6 Sol on Neon's multi-turn search benchmark at roughly one-hundredth of the cost per request.
