- As a workflow input built in the launcher. The launcher reads and validates the file and passes a typed array to the job. This suits a fixed file.
- As a project array. A named dataset kept in the database, which jobs run against as snapshots. This suits a dataset you curate over time.
context.add_source_array(...). Credentials belong in the environment, never in
inputs. In every case, the launcher is the only code that reads files: steps and workflows are
hermetic (see
Hermeticity).
External datasets
Read and validate external data in the launcher, convert it to a typed array, and pass it to the workflow. For a CSV with columnscase_id,prompt,expected:
[case_id: str] handle to map steps over, and can
pass individual fields to steps with cases.field("prompt") and cases.field("expected").
When loading a dataset:
- Key rows by stable IDs from the source, not by row number, so that reordering or adding rows doesn’t change which cached result belongs to which row.
- Convert values to the declared types yourself.
Array.from_recordsvalidates the schema and rejects duplicate keys, but it doesn’t convert numbers, booleans, or missing CSV values. - Check dataset-specific requirements, such as nonempty prompts, in the loader.
- Read files only in the launcher. Steps and workflows must be hermetic: they read no files and depend on nothing outside their inputs, so that the job’s record is complete and anyone can resume it. See Hermeticity.
Configuration
Anything that affects a result should reach its step as an input: data, model IDs, prompts, and sampling settings. Changing one of them then changes what the step receives, so a result computed from the old settings isn’t reused (see Managing the step cache). For settings fixed in the experiment’s code, add a source array inside the workflow:RUBRIC directly from the module would have the same fingerprint whatever the constant said,
which is the situation to avoid.
Settings used together often belong in one entity, such as a judge configuration holding the
model ID, rubric, and sampling parameters. Pass a reference to it as an input, so every result
points at the exact settings that produced it. See
Calling language models.
Entity-valued inputs
To pass entities, store each one with the client first, then build an array from the returned references:Project arrays
A project array is a named, editable, versioned array stored in the project’s database. It suits a dataset you curate over time and launch many jobs against. A job always runs against an immutable snapshot, so editing the array later doesn’t change what earlier jobs used:replace_array sets the complete contents; upsert_rows adds or updates the given rows and keeps
the rest. From the command line, pass a snapshot as an input with @:
Array to run_job directly.