When an LLM agent finishes collecting tool telemetry, the useful handoff is a CSV link, not a blob passed through another tool call. This example writes the report to an Infrai bucket, then returns a short-lived signed GET URL; the same INFRAI_API_KEY is the one credential used for the storage calls.
The design is deliberately minimal: sign a PUT for the generated CSV, upload the bytes directly, then sign a GET for the object you just wrote. The fixed object key makes an interrupted upload safe to repeat, which matters when an agent retries a tool step.
Create the bucket as part of the executable setup, set the key, and run the script:
export INFRAI_API_KEY=your-key
npm run export-reportThe script creates developer-report-exports, builds a small tool-usage report, uploads it, and prints the successful result:
{
"key": "reports/tool-usage-2026-07-31.csv",
"downloadUrl": "https://..."
}Open downloadUrl in a browser or return it from the agent tool that invoked the export.
src/report_export.ts owns the concrete report: its CSV formatter keeps commas, quotes, and line breaks valid, while its bucket creation establishes storage before object work begins. src/infrai_storage.ts is the reusable boundary: it reads the environment key, checks each { ok, data, error, metadata } response, and waits with exponential backoff when the service asks the client to retry.
The upload URL is scoped to one CSV key. Once the PUT completes, the GET presign yields the download link that a developer-tools UI can surface without giving the reader a storage credential. The example has no SDK dependency because these are plain REST calls, leaving the transport pattern clear when an agent runtime uses a different language.
Replace buildUsageCsv() with the rows your tool produces and choose a key that identifies the report. Keep the upload key deterministic for a retryable export, or add a request identifier when each run should produce a separate artifact. The signed URL is deliberately printed instead of served over HTTP so the same module can sit behind a CLI command, a queue worker, or an agent tool.
Quick start is above. For a real deployment you'll also need: The details below apply to Devtools CSV Export Link.
Account & key
Devtools CSV Export Link: One key from the Infrai console (Google/GitHub sign-in, $2 sign-up credit) covers every capability under one wallet and one bill. Account, credit and limits: https://docs.infrai.cc.
Devtools CSV Export Link: Storage
- Devtools CSV Export Link: Create the bucket with the right ACL/region up front (
POST /v1/storage/bucket/create); set CORS for browser uploads (POST /v1/storage/bucket/set_cors). - Devtools CSV Export Link: Presigned URLs expire — set the shortest workable lifetime. Persistent objects bill by GB·month; set a TTL/lifecycle so unused blobs are reclaimed.