Datasets

Check a local CSV or JSONL file, upload it as a dataset, list your datasets and pull one back to a file

fagi datasets moves rows between local CSV or JSONL files and the datasets in your workspace, the same ones you see in the dashboard (Datasets explains what a dataset holds, and Create a dataset covers the dashboard steps).

Prerequisites

Validate a file locally

fagi datasets validate evals/cases.jsonl --json
fagi datasets validate evals/cases.csv --batch-size 100

validate checks the file exactly as push would, offline and without an API key, so you can run it in CI. --batch-size (1-100, default 100) only changes the batch count in the report.

The report gives the format, the row count, the batch count and each column with its inferred type. It never prints cell values:

Valid locally.
Format      jsonl
Rows        1
Batches     1
Local only  true
NAME      DATA_TYPE
expected  text
input     text
Local validity does not validate target existence, append compatibility, server
availability or model/evaluator semantics.

validate exits 0 when the file is valid, 2 for bad flags, a missing or unreadable file, malformed records, mixed types or a local limit exceeded, and 1 when it can’t write its report or is canceled. Nothing is uploaded either way.

To also check the target dataset, your access and append compatibility, run push --dry-run.

What a file can hold

  • JSONL: one JSON object per line. Column order is the sorted union of keys, and a missing key is null. Types are inferred across the whole file: strings become text, booleans boolean, whole numbers integer, numbers with fractions float, objects json and arrays array. A column that mixes whole numbers and fractions, such as 1 and 1.5, becomes float instead of failing. A column that is null everywhere is text
  • CSV: a unique header row and a fixed number of fields per row. Header order is kept and every column is text, so 00123 and false stay strings
  • Limits: one local file of at most 64 MiB, 10,000 rows and 100 columns; at most 1 MiB per row and 256 KiB per cell. No stdin, URLs, compressed files or folders

Push a file

fagi datasets push ./questions.jsonl --name qa --dry-run
fagi datasets push ./questions.jsonl --name qa
fagi datasets push ./questions.jsonl --name qa --no-input --json

Use the last form in scripts and agents. push validates the file, creates the dataset (or appends to or skips an existing one, see --if-exists), uploads the rows and checks that the stored rows match the file. Before writing, it prints the target it will write to on stderr (see What goes to stderr).

FlagWhat it does
--name NAMEExact, case-sensitive dataset name, with leading and trailing spaces trimmed (required)
--if-exists MODEWhat to do when a dataset with that name exists: error (default), skip or append; see below
--batch-size NRows per write, from 1 to 100 (default 100), fewer when a batch would pass 1 MiB
--dry-runMake the same reads and checks as a real push, print the plan and write nothing
--yesHas no effect; push never prompts. It does not skip validation or allow replacing a dataset
--timeout DDeadline for the whole command (default 10m); each request is also capped at 30 seconds
--create-versionNot supported yet; using it exits 2 before anything is sent

The summary reports the dataset ID and the action (created, skipped or appended). With --json:

{"dataset_id":"11111111-1111-4111-8111-111111111111","name":"qa","action":"created","rows_input":120,"rows_added":120,"total_rows":120,"columns":2,"version_id":null,"previous_dataset_id":null,"content_sha256":"SHA256_HEX"}

version_id and previous_dataset_id are always null. content_sha256 is the hash of the file’s content.

Plan a push with --dry-run

fagi datasets push ./new-questions.jsonl --name qa --if-exists append --dry-run --json

The plan’s action is would_create, would_append or would_skip. The JSON plan also has dry_run, dataset_id and existing_rows (for an existing dataset), rows_input, rows_to_add, columns, batches, create_version and content_sha256; check dataset_id and existing_rows before an append. The dry run needs credentials and network access, because it makes the same checks as a real push. A later push checks again, since the target can change in between.

When the name already exists

--if-existsWhat happens
errorExit 1 before any write, with details.code dataset_name_exists. Pick another name or skip
skipLeave the existing dataset as it is and report skipped. It checks only that the name exists, not that the rows match
appendAdd the file’s rows to the existing dataset, which must have the same columns and types. Running it again adds the rows again

Replacing a dataset is not supported; --if-exists replace exits 2. Use a new name instead.

When a push fails

A push never retries a write and never deletes anything. In JSON modes the error’s details says how far it got, and details.stage says where it stopped:

details.codeMeaning
dataset_push_failedThe push stopped before any write; rerun_safe is true. One cause: more than one dataset you can see has exactly that --name, so rename one in the app
dataset_push_partialA write may have been sent. acknowledged_rows and uncertain_batch say how far it got
dataset_name_exists--if-exists error met an existing dataset with that name

On dataset_push_partial, pull the dataset and check it before you push again; rerunning --if-exists append would add the rows that did land a second time. push, list and pull otherwise use the shared exit codes.

List datasets

fagi datasets list
fagi datasets list --all --page-size 100 --max-pages 20 --json
fagi datasets list --all --search support -o jsonl

Without --all, list reads only the first page and says when more remain. With --all it reads every page and prints nothing until the whole list checks out.

FlagWhat it does
--allRead every page; a list that cannot be completed is an error
--page-size NDatasets per request, from 1 to 100 (default 100)
--max-pages NPage cap with --all, from 1 to 1000 (default 20)
--search TEXTServer-side search filter; not an exact-name match

The table shows ID, NAME and NUMBER_OF_DATAPOINTS. JSON adds pages_read, total_count, traversal_complete and snapshot (always false); JSONL prints only the datasets, one per line.

In scripts, use --all --json and check the exit code. A list that cannot be completed exits 1 with details.code dataset_list_incomplete and a reason such as page_limit or row_limit, and prints no list. Raise --max-pages or narrow --search.

Pull a dataset

fagi datasets pull DATASET_ID -o jsonl
fagi datasets pull DATASET_ID --file ./qa.jsonl --yes --no-input --json
fagi datasets pull DATASET_ID --file ./qa.csv --json

DATASET_ID is the UUID in the ID column of fagi datasets list (or dataset_id in the push summary); anything else exits 2. Without --file, pull prints the rows in the -o format. Without -o it prints a table; use -o jsonl or -o json for machine-readable rows. With --file, it writes the rows to that file and prints a summary with the path, row count and column count; the file’s suffix, .jsonl or .csv, sets its format, and -o sets only the summary’s format.

FlagWhat it does
--file PATHWrite to a .jsonl or .csv file instead of stdout; there is no short form
--page-size NRows per request, from 1 to 100 (default 100). Lower it when large cells hit the response limit
--yesOverwrite an existing file without asking (see Global flags for scripts)
--timeout DDeadline for the whole command (default 10m); each request is also capped at 30 seconds

Nothing is printed or written until every page has been read and checked, and the file is written in one step, so a failed pull leaves an existing file as it was. JSONL keeps the column types; CSV keeps every value as text and loses the difference between null and empty. Treat exported CSV as untrusted spreadsheet input; formulas are not escaped. A pull exports values only, not row IDs, annotations, evaluation configs or version history.

Turn failing traces into an eval set

Export the traces you want to keep as JSONL rows, check and push them as a dataset, then pull the dataset and grade it with eval suite:

fagi trace export "$TRACE_ID_1" "$TRACE_ID_2" \
  --project-id "$PROJECT_ID" --file evals/regressions.jsonl
fagi datasets validate evals/regressions.jsonl
fagi datasets push evals/regressions.jsonl --name regressions --if-exists append --json
# note dataset_id in the summary
fagi datasets pull "$DATASET_ID" --file evals/regressions.jsonl --yes --no-input
fagi eval suite --template eval.json --cases evals/regressions.jsonl \
  --model "$MODEL" --output-type pass-fail --dry-run

trace export writes one row per trace with the input and output of one span; see Tracing. Each column of the pulled file is available to the eval template by name; see Evals for the template, --expect and --min-match-rate. Drop --dry-run to run the eval; each judge call is a model call and can be charged.

Columns, rows and cells

fagi datasets works with whole files. To change a single column, row or cell, or to attach evaluations, use fagi api datasets (see Call any endpoint):

CommandWhat it does
fagi api datasets columns create / renameAdd a static column, or rename one
fagi api datasets rows addAppend rows from a JSON body
fagi api datasets cells updateChange the value of one cell
fagi api datasets evaluations configure / list / runAttach evaluations to a dataset and run them
fagi api datasets deleteSoft-delete up to 50 datasets (with their rows, columns and evaluations)
fagi api datasets columns create --dataset-id DATASET_ID --new-column-name notes --column-type text

A delete is all-or-nothing: one unknown ID rejects the whole request. It asks for confirmation; see Write. Run fagi api datasets <command> --help for each command’s flags.

Dive deeper

Was this page helpful?

Questions & Discussion