Files are documents the agent can read during a run, such as instructions, reference data or examples, and the files a run makes, such as a chart or a report. Your organization keeps them, and you choose, for each run or workflow, which ones to mount and where.
Uploading files
Upload files in the dashboard under Files, with POST /v1/files, or with ephemeral files upload. Each file gets an ID such as file_9c41… and a name. The name is a relative path like guides/refunds.md, up to 240 characters.
Uploading again with a name that already exists adds a new file with a new ID. A reference by name resolves to the newest file with that name. Older uploads stay available by ID until you delete them or they expire.
Files a run saves
A run can save files of its own. Name them in outputs, in the run request or in a saved workflow: up to 20 paths, each relative to the agent's working directory or absolute under /tmp/. When the run ends, each file is saved as a file of your organization named runs/<run id>/<path>. The finished run lists them in its files field, with their IDs.
{
"prompt": "Chart the rows in the input and write a one-page report.",
"input": { "rows": [{ "label": "Jan", "value": 120 }, { "label": "Feb", "value": 145 }] },
"outputs": ["chart.png", "report.docx"]
}- A file is at most 10 MiB, and a run saves at most 25 MiB in all.
- A path the agent never wrote is recorded as an
output_missingevent. The run does not fail. - A run without a shell, where
shellisfalse, writes its output files with thesave_outputtool, which the agent is given. - Each saved file is recorded as an
output_fileevent.
Read them with GET /v1/files/{id}, in the dashboard under Files, or over MCP with read_file, which returns text as text and images as images. See outputs in the runs guide.
Finding files
GET /v1/files lists every file, newest first. Each one has a source, upload or output (saved by a run), and an output file also carries its run_id and run_path. Filter with run_id, source and prefix (such as runs/run_abc/); limit is at most 1,000. To read every file, page with cursor: empty for the first page, then each page's next_cursor. The MCP tool list_files takes the same filters and pages the same way.
Retention
Files are kept until you delete them, unless a retention setting says otherwise. Three settings decide, from the most specific:
- The file's own expiry:
expires_in_days(1 to 3,650) when you upload it, or later withPATCH /v1/files/{id}. keep: the file is never deleted by the organization's policy.- The organization's retention policy:
output_file_daysfor files runs save andupload_file_daysfor uploaded files, each 1 to 3,650 days or no limit. Owners and admins set it withPUT /v1/storage/policy, and it applies to files already stored. Older files are deleted within minutes.
use_policy drops a file's own setting, so the policy decides again. The file list shows when each file will be deleted as expires_at, or null when it is kept.
From an agent
Over MCP, an agent can upload_file (at most 1 MiB, as text or base64), read_file, update_file (rename it, or change its expiry, keep or use_policy) and delete_file.
Storage costs
On the hosted service, stored files cost $0.04 per GB-month, measured hourly and charged from your credits. GET /v1/storage shows your usage and charges. See budgets and billing. Self-hosted installations are not charged. Run state is stored and billed the same way.
Giving files to a run
List the files in the run's files array. Each entry mounts one file at a path of your choice. There are three ways to name the content:
| Entry | Mounts |
|---|---|
{"file": "file_ | That exact upload. |
{"file": "guides/ | The latest upload with that name, at the time the run is created. |
{"path": "notes. | Inline text sent with the request. Nothing is uploaded. |
For uploaded files, path defaults to the file's name. Inline files must set it. Paths must be relative and unique within the run.
"files": [
{ "file": "guides/refunds.md", "path": "instructions/refunds.md" },
{ "file": "file_9c41d2a07be35f1e8a6c0d4b9e2f7a13" },
{ "path": "context.md", "content": "The customer is on the annual plan." }
]Inside the microVM
The worker receives the files as a read-only directory and is told the path of each one. It cannot change them. Its working directory is a separate scratch area. Anything it writes there disappears when the microVM is destroyed, so files are never shared between runs. The run's result is its text output, plus any files named in outputs.
A run reads file contents when it leaves the queue. If you delete a file while a run that uses it is still queued, that run fails.
Limits
| Limit | Value |
|---|---|
| File size | 1 MiB per file, uploaded or inline |
| Files per run | 32 |
| Total per run | 4 MiB |
| Files a run saves | 20 per run, 10 MiB each, 25 MiB in all |
See the Files API for upload, list, download, change and delete.