Skip to main content
A single-turn environment resolves each example in one model response - prompt in, completion out, reward computed. You implement a prompt builder and a reward on an EnvironmentSingleTurn subclass. Import these public names in environment code:
For a single-turn task, subclass EnvironmentSingleTurn:
environment.py
The dataset file uses the input/output row shape (Task records). load_task_examples(...) exposes each record’s input/output as example.input/example.output, with the raw row available as example.record. For SFT, the SDK builds the training conversation from the environment’s start_episode(example, prompt_text) plus sft_completion(example). The default sft_completion converts example.output into completion messages. See Datasets for the scalar and message-shaped output forms. Override sft_completion only when the gold completion must be synthesized from other fields. Single-turn environments usually implement build_prompt_messages. The SDK’s default start_episode calls it and prepends the run’s prompt text as a system message when your messages lack one, so local eval, SFT, and GRPO see the same policy prompt. Multi-turn environments own start_episode; put any task-specific initial system message there. On managed runs, Flash applies the same guarantee to every episode’s opening messages, single- and multi-turn: if start_episode returns no system message (or an empty one), the run’s prompt text becomes the system message. When a run uses thinking = true, score_response receives answer text by default. response_text stays string-compatible and also exposes response_text.completion, response_text.thinking, and response_text.raw for rewards that inspect the reasoning trace.

Pass parameters

If your load_environment(**kwargs) accepts arguments, set them under [environment.params]:

Next steps

Multi-turn environments

Handle conversations, tools, and agents.

Datasets

Row shapes and SFT target formats.