Skip to main content
Turn your local files into a published environment that training runs reach by id. Structure the folder, declare its dependencies, and push it to the managed Hub.

Structure the package

A published environment is a small folder. Flash packages it, imports its environment.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.
Publish the folder:
A single .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 your environment.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:
This is the supported worker dependency mechanism. A 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:
If that same reward also queries a database, declare its client library and the exact environment variable name your code reads. Here the database is MongoDB via pymongo, but the same pattern applies to any database:
Do not declare unused packages or secrets. If the active reward only calls the judge model and no longer queries the database, leave out the database client and its secret.

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:
It prints the published id (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.
To edit or inspect the source locally, pull the whole environment into a directory:
Pull one file by adding its path inside the environment. Use -o to choose the destination and -f to overwrite an existing output:

List what you have

Shows local environment sources you can publish, such as ./environment.py or folders under environments/.

Delete a Hub environment

Delete only targets managed Hub ids of the form namespace/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 from os.environ in environment.py:
environment.py
Then declare the environment variable names in your training config:
Set the value in your shell before submitting:
You can also put local development values in .env or .env.local:
Flash sends declared secret values to the worker out-of-band. Secret values are not stored in the TOML config, run spec, status JSON, logs, or environment artifact. Do not put API keys in [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.