- Uploads. Files you add, such as a data set or a spec. Attach an upload to any number of sessions, read-only.
- Session outputs. Deliverables an agent saves in a session. They’re kept with the session, and you can preview and download them.
Listing and downloading files needs read permission. Uploading needs create, and attaching to or detaching from a session needs update. Organization developers and admins have all of them. See Organizations and roles. Attaching files needs an environment with a sandbox, which every environment has by default.
Upload a file
- Console
- cURL
Open Files in the sidebar and click Upload file, or upload from Launch session, the session’s Files tab, or Attach from Files in the message box. Each upload is added to your organization’s files and selected for you. The console accepts a file up to 1 GiB.
201 with the file, including its file_id. Use that id to attach the file to a session or name it in a message.
To remove a file you no longer need, select it on the sidebar Files page and choose Delete. This works for uploads and session outputs. Deleting its catalog row removes it from Files and prevents future attachments; a copy already mounted in a running sandbox remains there. Session outputs that you keep are removed when their session is purged.
Upload fields
Upload fields
uploadFile takes a multipart/form-data body. The file part’s filename and Content-Type become the file’s name and media type, and the part can hold at most 30 MiB. expires_in_seconds is optional, from 3600 (an hour) to 7776000 (ninety days); omit it for a file that doesn’t expire. metadata is an optional JSON object sent as a string.Attach files when a session starts
Name files inresources when you start the session. They’re in the sandbox before the agent’s first step. An attached file is copied into the sandbox under /workspace/.managed-agents/files, read-only. The agent knows it’s there and can read it with read_file or from a shell.
- Console
- cURL
- In the sidebar, click Sessions, then click Launch session.
- Choose the agent and environment, and write the opening message.
- Under Files, click Add, choose each file or upload one, and optionally set the path it should have in the sandbox.
- Click Launch session.
file_id refuses the whole request with 404, and no session is created.
Paths and file content
Paths and file content
relative_path places the file under the files directory; it defaults to the file’s own name. It must be unique in the session and can’t contain . or .. segments. Each attachment takes the file’s content as it is when you attach it.Attach and detach files while a session runs
- Open the session and choose the Files tab in the side panel. Inputs lists the files attached to the session.
- Click Attach files…, choose or upload the files, and click Attach.
- To detach one, click the × on its row in Inputs.
Attach and detach rules
Attach and detach rules
- Attach is all-or-nothing. The console refuses the batch if a file is unavailable or a path collides with or nests inside another attachment.
- Attach to the root session of a multi-agent tree. The console refuses a subagent or teammate session; everyone in the tree shares the root’s sandbox.
- You can attach to a finished root session. Its next message resumes it with the file already in place.
- Detach stops listing the file. A copy already in the sandbox stays, because the agent may be reading it.
Show a file to the agent in a message
To have the agent look at an image or read a short document as part of a message, name the file in the message instead of attaching it. The file is read when the message is accepted.- Console
- cURL
In the session’s message box, click Attach from Files, choose an image or a text document, or upload one, then send the message.
"type": "image" for a PNG, JPEG, or WebP image the model sees, and "type": "document" for a text file, which is placed in the message as text. To send an image that isn’t in your library, see Send an image.
Download session deliverables
Every deliverable an agent saves in/workspace/.managed-agents/outputs is kept as a session output after each turn. See Deliverables and artifacts for what’s kept and when.
- Console
- cURL
Open the session and choose the Files tab in the side panel. Outputs lists each deliverable with its path, size, and when it was captured. Click one to preview it, and download it from the preview.
getFileContent returns the bytes as application/octet-stream with a Content-Disposition naming the file. The recorded media type is in the file’s metadata.
List and find files
listFiles returns your organization’s files, newest first, with a next_page_token while more follow. Filter by source to see only uploads or only session outputs.
getFile returns one file’s metadata: filename, media_type, byte_size, sha256, source, expires_at, and, for a session output, scope_session_id and the agent it belongs to.
List parameters and expired files
List parameters and expired files
An expired file stays listed, with
expires_at in the past, until it’s removed after a grace period, but it can no longer be attached or downloaded.How files reach a session
Uploads reach a session by attachment or by name in a message. Deliverables the agent saves return to your organization’s files after each turn.What can go wrong
The most common problems:404 not_foundwhen a session request names afile_id. The file doesn’t exist in your organization or has expired. Use a live file id fromlistFiles.- The agent can’t find an attached file. It was attached mid-turn. It’s in place on the next tool call and visible from the next turn. Check
mount_pathon the resource. - A deliverable isn’t in the outputs. The agent saved it somewhere else, or it broke a capture rule. See Deliverables and artifacts.
Every files error
Every files error
For every error code, see Errors.
Next steps
Deliverables and artifacts
Ask for named deliverables and see how they’re kept.
Sessions
Start sessions, send messages, and attach images.
Automations
Mount the same files into every automated run.