Structure the package
A published environment is a small folder. Flash packages it, imports itsenvironment.py entrypoint at run time, 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.
Import from sibling files in the folder you publish, from the freesolo SDK,
from the Python standard library, or from any third-party package you declare
under [environment] pip (see
Dependencies are managed).
Dependencies are managed
The GPU worker installs one managed requirement set - thefreesolo SDK and the
training stack - for every environment. Anything your scorer needs on top of that
is declared with [environment] pip, which is appended to the managed set
rather than replacing it; see
Scorer dependencies.
Without that key, your environment.py and its sibling modules can import only
from:
- the
freesoloSDK, - the Python standard library,
- other files in the folder you publish.
pyproject.toml, requirements.txt, or lockfile beside environment.py can
describe your local development setup, but Flash does not read those files to
install packages for a managed run.
If your reward logic needs an external service - a judge model, a database -
declare its client under [environment] pip, or call the service over HTTP with
the standard library if you would rather not add a dependency. Either way,
declare the credential it reads under [environment] secrets (see
Use API keys):
environment.py
Publish it
Training runs on managed infrastructure, so the environment must be reachable by id. Push the folder to the managed Environments Hub. Every environment belongs to a project, the same grouping the dashboard organizes runs and traces by, and you name it on every push. Get a project UUID fromflash projects list, or create one:
--name value is normalized to a lowercase hyphen slug, and the command
prints the published id (your-org/your-project/math) to put in
[environment] id. A malformed UUID is rejected before anything uploads, and a
project outside your organization fails the push. See
flash env push.
Environment names are unique per project, not per organization. The owning
project is part of the id, so two projects in your organization can each
publish their own
math and they stay separate environments. Renaming a
project does not change any id it already published.Use an existing environment
If you already have a published env id (yours or one shared with you), reference it directly. On Freesolo’s managed service,[environment] id accepts only a
managed namespace/project/name slug; github: refs and GitHub URLs are
rejected. Publish yours with flash env push, use the returned id, and note that
flash env pull also accepts managed slugs only.
Standalone planes use reachable GitHub sources instead; see Self-hosted
environments.
-o to choose the
destination and -f to overwrite an existing output:
List what you have
./environment.py or
folders under environments/, and your organization’s already-published
environments with the ids you paste into [environment] id.
Delete a Hub environment
Delete only targets managed Hub ids of the formnamespace/project/name; GitHub refs
and local paths are not Hub records and cannot be deleted this way.
--project is required and must be the UUID of the project the environment was
published to. flash projects list shows the projects you can reach, and the
environment’s dashboard page shows the one it belongs to.
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.