SAfactory Workflows
This skill helps agents operate the SAfactory repository for three user intents:
- Add a benchmark or custom environment to SAfactory.
- Run Docker-mode evaluation for an environment.
- Start GRPO/RL training for an environment.
Keep the root README and docs/ as the source of truth. Use this skill to choose the right workflow, files, and checks; do not duplicate or rewrite full documentation.
First Steps
From the repository root:
- Inspect the current layout before assuming paths:
rg --files README* docs env rl gateway. - Identify the user intent:
- Benchmark/environment onboarding: read references/environment-integration.md.
- Docker evaluation: read references/docker-evaluation.md.
- GRPO/RL training: read references/grpo-training.md.
- Load only the matching reference file and the linked SAfactory docs needed for the task.
- Prefer existing patterns in
env/geo3k/, current docs, and root README commands.
Repository Sources
Use these documents as canonical sources:
- Root quick start:
README.mdorREADME_CN.md. - Custom environment guide:
docs/guides/custom-environment.mdordocs/guides/custom-environment_CN.md. - Evaluation guide:
docs/guides/evaluation.mdordocs/guides/evaluation_CN.md. - RL guide:
docs/guides/rl-training.mdordocs/guides/rl-training_CN.md. - Gateway reference:
docs/reference/gateway.mdordocs/reference/gateway_CN.md. - Environment reference:
docs/reference/environments.mdordocs/reference/environments_CN.md. - CLI/config reference:
docs/reference/configuration.mdordocs/reference/configuration_CN.md.
Use Chinese docs when the user writes Chinese; otherwise use English docs.
Operational Rules
- Treat
env/geo3k/as the standard reference implementation, not as a hardcoded target. - Use generic placeholders such as
my_envor the user's requested environment name for new workflows. - Do not write private model endpoints, API keys, or internal route names into committed docs or shared configs.
- Do not overwrite
gateway/config.local.yamlwithout checking its existing contents and preserving user edits. - Ensure
--llm-modelandRL_MODELmatch a Gatewayllm_routeskey. - Keep Launcher, Gateway, and Buffer Server storage pointing at the same backend or SQLite URI.
- For new environments, run a minimal Docker evaluation before recommending RL training.
- Read
docs/internal/only when the user explicitly asks about RJob, Sandbox, or internal deployment modes.
When Information Is Missing
Ask the smallest set of concrete questions required to proceed. Common blockers:
- New benchmark source path, dataset path, or native run command is unknown.
- Desired SAfactory environment name is unknown.
- Model route key or Gateway endpoint is unknown for an actual run.
- Docker image, runtime dependencies, or scoring contract is unknown.
If the user asks only for commands and prerequisites are missing, provide a fill-in command with placeholders and state exactly what must be replaced.
Verification Expectations
- For file edits: check created paths with
rg --filesand inspect changed files. - For evaluation: run the smallest feasible
launcher.py --mode docker --enable-evaluationsmoke test when credentials, image, and data are available. - For RL: first verify or ask for evidence that Docker evaluation passes; then prepare
env.sh; start long-running training processes only when the user requested execution. - If a command cannot be run because credentials, Docker, data, or dependencies are unavailable, report the blocker precisely and leave the exact next command.