Implementation guide

How to batch the Decisions API over CSV rows

The reliable pattern is not one giant request. It is a resumable queue of small, independently identifiable decisions.

Try a 20-row CSV preview →

Prefer a preset? Classify text, label sentiment, or apply a scoring rubric. No API key required; full-file plans start at $15.

A safe batch pipeline

  1. Parse the CSV locally and keep the original row index.
  2. Validate the selected column and skip empty cells explicitly.
  3. Build one stable question configuration for the entire job.
  4. Process a small number of rows concurrently.
  5. Write each answer to durable local progress as it succeeds.
  6. Retry 429, timeout, and 5xx responses with bounded backoff.
  7. Export original rows plus normalized decision columns.

Why not send the whole CSV in one prompt?

A single prompt makes row-to-result mapping fragile, raises context usage, and forces the entire job to fail or retry together. Per-row calls preserve structured output, isolate failures, and make pause/resume straightforward.

Run a reproducible Python example

Download the Python script, 40 fictional feedback rows, and versioned five-category question into one folder. Python 3.10 or later is sufficient; no packages are required.

python3 decisions-csv-batch.py customer-feedback.csv
# Writes progress.json and results.csv without network calls.
# Every non-empty row is explicitly marked mock, not a model prediction.

# To process with your own OpenAI project, set OPENAI_API_KEY
# in your local environment, then explicitly enable paid API requests:
python3 decisions-csv-batch.py customer-feedback.csv --live \
  --checkpoint live-progress.json --output live-results.csv

The script sends one request at a time (concurrency limit 1), makes at most three attempts per row with a 30-second request timeout, and retries only connection failures, timeouts, HTTP 429 and 5xx errors. It honors numeric Retry-After delays up to 60 seconds. Other HTTP errors stop the run. Re-run the same command to resume; successful answers, refusals and blank rows are preserved. Failed transient rows are attempted again on a later run.

Each zero-based row ID is bound to a fingerprint of the exact input file, column, question, model and offline/live mode. A different configuration requires a new checkpoint. Atomic checkpoint replacement protects completed local records; it does not guarantee exactly-once API billing if a request succeeds just before a crash. Run only one process per checkpoint.

Inspect and join the output

The output keeps all original columns and adds decidecsv_row_id, decidecsv_status, and decidecsv_answer_json. A successful live answer retains its selected choice, confidence and probability distribution; refusals and skipped empty cells remain explicit. For example, the offline fixture for row 0 is:

decidecsv_row_id: 0
decidecsv_status: mock
decidecsv_answer_json: {"status":"mock","answer":{"type":"choice","choice":"other","confidence":null,"probabilities":[],"note":"Offline fixture, not model output"}}

Compare the exported row ID and original feedback_id before routing anything. Offline fixtures verify parsing, export and resume; they provide no accuracy evidence. The checkpoint and export contain your data and answers, so store them locally with appropriate access. The script requires your API key; the DecideCSV browser tool below includes model usage and requires no key.

Errors that should not be retried blindly

ErrorAction
Authentication or endpoint access deniedStop the batch and verify the server-side project configuration.
Invalid question configurationFix the shared configuration before resuming.
Rate limit or timeoutBack off, then retry the affected row with the same local row record.
Server errorRetry a limited number of times and keep all completed rows.

Use a script or a browser tool?

Write a script when the job is repeatable, belongs in a production pipeline, or needs custom storage. Use a browser runner when the file is small, the rule is one-off, and the value is avoiding setup, retry, and export code.

Sources and verification

Product facts on this page were checked against the following primary sources on October 20, 2026.

Use your data

Run the same batch without writing the queue

DecideCSV processes five rows at a time, preserves progress locally, and exports the joined result.

Preview a CSV batch