Applies to:
- Plan -
- Deployment -
Summary
Issue: Downloading JSON exports for large experiments from the Braintrust UI fails with amalloc of size 1073741824 failed error or times out during the download process.
Cause: The UI attempts to load the entire dataset into memory at once, causing memory allocation failures for experiments with thousands of records.
Resolution: Use the Braintrust API or SDK to paginate and export large experiment data programmatically.
Resolution Steps
Pick the option that matches what you have on hand. If you copied an experiment ID out of the app URL, use Option 1 or 2. If you know the project and experiment names instead, Option 3 requires less setup.Option 1: Export by experiment ID (Python)
Step 1: Install the API client
The REST client ships separately from the tracing SDK:Step 2: Create the export script
Each fetch response returns acursor. Pass it to the next request to walk through the experiment a page at a time.
limit caps the number of full traces per page, not the number of rows. A page containing multi-span traces will return more rows than limit.Step 3: Run the script
Execute the script to generateexperiment_data.json in your current directory.
Option 2: Export by experiment ID (TypeScript/JavaScript)
Step 1: Install the API client
Step 2: Create the export script
Step 3: Run the script
Execute the script to generateexperiment_data.json in your current directory.
Option 3: Export by experiment name (Python tracing SDK)
If you already depend on thebraintrust package, open the experiment in read-only mode with open=True and iterate it. fetch() paginates internally, so there is no cursor to manage.
open=True requires the experiment name, not its ID, and raises ValueError if the experiment does not already exist. Use Option 1 if all you have is an ID.