Structure the package
A published environment is a small folder. Flash packages it, imports itsenvironment.py entrypoint on the worker, and calls
load_environment(**params), which must return a Freesolo SDK environment. The
folder can be named anything as long as it contains environment.py at its
root.
.py upload still works for tiny smoke tests, but push real environments
as folders. The --name value is normalized to a lowercase hyphen slug, and the
published id uses your Freesolo org namespace, for example your-org/math.
Keep all imports either from sibling files in the folder you publish, from the
freesolo SDK, or from third-party packages you declare under
[environment].pip (see below).
Declare third-party dependencies
If yourenvironment.py imports a package that isn’t part of the freesolo SDK,
list it under [environment].pip so the worker installs it before importing your
environment:
pyproject.toml,
requirements.txt, or lockfile beside environment.py can help local
development, but Flash does not use those files to install packages for a managed
training run. Put runtime packages in the training config that references
the published environment.
Only list packages your environment imports. Flash manages the training stack
itself, so do not pin packages such as torch, trl, vllm, peft, or
bitsandbytes here unless your environment directly imports them.
For example, an environment whose reward calls a judge model should declare the
client library and the secret it reads. Here the judge is reached through an
OpenAI-compatible client (such as OpenRouter), but the same pattern applies to
any provider:
pymongo, but the same pattern applies to any database:
Publish it
Training runs on managed infrastructure, so the environment must be reachable by id. Publish your local environment folder to the managed Environments Hub:your-org/math). Put that in your config’s [environment] id.
Use an existing environment
If you already have a published env id (yours or one shared with you), reference it directly. A config[environment] id also accepts a github:owner/repo@ref:path ref or a
GitHub URL, which Flash resolves at run time. flash env pull (below) takes
managed namespace/name slugs only — it no longer accepts github: refs or
GitHub URLs.
-o to choose the
destination and -f to overwrite an existing output:
List what you have
./environment.py or
folders under environments/.
Delete a Hub environment
Delete only targets managed Hub ids of the formnamespace/name; GitHub refs
and local paths are not Hub records and cannot be deleted this way.
Use API keys
If your environment needs an external service, read the key fromos.environ in
environment.py:
environment.py
.env or .env.local:
[environment.params].
If a declared secret is missing when you submit, flash train fails before the
run starts.
Next steps
Single-turn environments
Fill in the environment class you just published.
Training
Reference the published id from a config and train.