Skip to main content
An environment is the task: the data your model sees and the reward, a numeric score your code assigns to each model output. Flash loads environments through the Freesolo environment SDK. Author one locally, publish it to Freesolo’s managed Environments Hub, and reference it in config by its Freesolo environment id.

Scaffold one

This scaffolds a starter project in the current directory: environment.py, a tiny dataset/train.jsonl, three configs (configs/sft.toml for SFT, configs/rl.toml for GRPO, and configs/opd.toml for OPD), and a TRAINING.md playbook for the coding agent you point at the project. The starter load_environment() returns a Freesolo EnvironmentSingleTurn with a sample dataset and reward. On an interactive terminal, flash env setup first runs a short survey: whether the model handles your task in a single turn or a bounded multi-turn episode, and whether to train with reasoning. Answer up front with --single-turn / --multi-turn and --reasoning / --no-reasoning, or pass -y to take the defaults (single-turn, no reasoning); non-interactive runs (no TTY or CI) always take the defaults. --multi-turn scaffolds a runnable EnvironmentMultiTurn starter with the episode hooks wired end-to-end instead of the single-turn class, and --reasoning sets thinking = true in the generated configs.
environment.py
Replace the dataset and reward with your task:
  • Dataset: the prompts (and any gold answers) your model trains and is evaluated on.
  • Reward: score_response returns a RewardResult. GRPO optimizes that score; SFT trains directly on your dataset answers instead; OPD distills a teacher’s token-level grading of the model’s own completions. See how Flash works.
For multi-turn tasks (conversations, tool use, agents), use EnvironmentMultiTurn and implement the episode hooks. See Multi-turn environments below.

Use the SDK

Your environment code imports from the freesolo package. The managed flow needs no local install. Training workers already have the SDK when they import your published environment. Install it locally only to run or test environment.py yourself. Local flash train --cost uses the configured SFT max_examples and does not import the environment:

Next steps

Package & publish

Structure the folder and push it to the Hub.

Single-turn environments

Write the dataset, prompts, and reward.