flash env setup scaffolds a starter project into the current directory. A
run is fully described by what lands on disk: an environment (your task and
how it’s scored) and a config (how to train on it). Every file is plain text
you can read, diff, and version-control. Rerunning is safe: existing files stay untouched.
environment.py
What it is: your environment, the single source of truth for what the model practices on and how it’s graded. It definesload_environment(), which returns a Freesolo EnvironmentSingleTurn (or
EnvironmentMultiTurn) carrying a dataset and a score_response reward. This
is the file you edit first.
When Flash reads it: flash env push packages and uploads it, and every
training worker imports it and calls load_environment(**params). Local
flash train --cost parses the config without executing environment code. The
scaffolded starter loads its rows from dataset/train.jsonl.
See the full scaffolded file — StarterEnv with build_prompt_messages
and score_response — in Environments.
dataset/train.jsonl
What it is: a tiny starter dataset ofinput/output rows that the
scaffolded environment.py loads. Replace it with your training rows before a real run. See Datasets.
When Flash reads it: your environment.py reads it on the worker at run
time. Local flash train --cost parses the configured max_examples without
reading the dataset. Authenticated server-side --dry-run runs submit-time
preflights without a GPU worker, so it does not execute the environment;
flash env push uploads the dataset/ folder.
dataset/train.jsonl
configs/sft.toml
What it is: an SFT training config for supervised fine-tuning on theinput/output pairs in your environment’s
dataset. You set model, the [environment] id, and the [train] knobs
(epochs, lora_rank); the
training infrastructure and artifact storage are managed for you. Copy
it per experiment.
When Flash reads it: every flash train, --dry-run, and --cost parses
this file. Dry-run sends the spec to the authenticated server for submit-time
preflights; --cost stays local.
configs/sft.toml
configs/rl.toml
What it is: the same config shape withalgorithm = "grpo", for GRPO
(RL) training that optimizes against your environment’s score_response
reward. Keep the configs you need and pick one at train time.
When Flash reads it: same as sft.toml; pass it to flash train to run
GRPO instead of SFT.
configs/opd.toml
What it is: the same config shape withalgorithm = "opd", for
on-policy distillation — a managed
teacher model grades your model’s own completions and training pulls the model
toward it. It uses epochs over the retained prompt pool, and Flash derives the
optimizer-step count internally. Warm-start from a finished SFT run with
init_from_adapter for best results.
When Flash reads it: same as sft.toml; pass it to flash train to run OPD.
TRAINING.md
What it is: a playbook for the AI coding agent you point at this project, including the OPD teacher preflight, rollout reasoning budgets, reward design, run interpretation, and common Flash issue mitigations. When it travels: if you publish the whole scaffolded folder,flash env push includes .md sidecars, so
TRAINING.md can travel with the environment source in the Hub for humans and
coding agents.
Packaging an environment as a folder
The scaffoldedenvironment.py is enough to publish on its own. Once your task
grows data files or helper modules, move it into a folder with
environment.py at the root and publish the whole folder.
helpers.py
What it is: any sibling Python modules yourenvironment.py imports. Import only from installed packages or from files in the folder you publish.
When Flash reads it: uploaded with the folder by flash env push and
importable on the worker.
dataset/
What it is: sidecar data files (.jsonl, .json, .csv, and more)
that your environment loads. See
Datasets for the full list.
When Flash reads it: your environment code reads it (for example via
load_task_examples(...)); flash env push includes the dataset/ folder
in the uploaded artifact.
dataset/train.jsonl
Next steps
Single-turn environments
Fill in the environment class the scaffold starts you with.
Training
Point a config at your environment and submit a run.