To start sessions, you need the Developer or Admin role in the organization. See Organizations and roles. Every session runs in an environment’s sandbox. See Environments.
Ask for a deliverable
Name the file and its format in the task, and say what it must contain. This session asks for a CSV and a short summary.- Console
- cURL
- In the sidebar, click Sessions, then click Launch session.
- Choose the Agent and Environment.
- In Opening message, describe the task and name the deliverables.
- Click Launch session.
202 Accepted:
write_artifact call answers with the path and “it is captured as a session output when this turn ends”. A call that includes metadata answers that the file was stored as a session output instead. When the session finishes, download the deliverables.
Prompt patterns that work
Prompt patterns that work
Label deliverables with metadata
An agent can attach key/valuemetadata when it calls write_artifact, for example {"kind": "report", "ticket": "OPS-12"}. The metadata is stored on the deliverable’s file, returned as metadata beside path when you list or get the file, and shown under Metadata in the file preview. Ask for it in the task: “Save summary.md with metadata kind set to summary and quarter set to Q3.”
Later sessions of the same agent can find deliverables by their metadata when the agent has File history on. See Agent file history.
Metadata rules
Metadata rules
- A write that includes
metadatais kept at once rather than at the end of the turn, so it doesn’t count toward the per-turn limits. - A write that includes
metadatareplaces the deliverable’s earlier metadata, and{}clears it. A write that leaves it out keeps it. - The metadata stays when the file is changed later by another tool or command.
- The rules are the same as for uploaded files: at most 32 keys, each up to 64 characters of letters, digits,
_,., and-, and at most 64 KiB of JSON in total. Thepathkey is reserved.
Show images inline
Ask the agent to share a chart or screenshot: “Plot weekly signups and share the chart.” The agent saves the image under/workspace and calls share_file.
- Console
- cURL
- In the sidebar, click Sessions, then open the session.
- Find the
share_filerow in the transcript and click the thumbnail.
artifact event carries the caption and the image.
What an image event looks like
What an image event looks like
url is omitted when none can be issued for that read. The image is always available through the authenticated session image endpoint, GET /managed-agents/v1/sessions/{sessionId}/images, with the image block’s uri as the uri query parameter.Download deliverables
Every kept deliverable is a file in your organization’s library withsource: "session_output", listed under the root session, including deliverables that subagents and teammates saved.
Open the session and choose the Files tab in the side panel. Outputs shows each deliverable with its path under the deliverables folder. Click it to preview it, and download it from the preview. Through the API, list a session’s deliverables with listFiles and scope_session_id, then download each with getFileContent. See Download session deliverables.
Each output keeps its path under the deliverables folder, such as reports/q3.md. Saving to the same path again replaces the earlier version at the end of the turn, or at once when the write_artifact call includes metadata.
Other ways to use results
Other ways to use results
Where work happens
Files outside the deliverables folder stay in the session workspace for later turns when it reopens, but aren’t saved separately as deliverables or shown in the Files tab. Deleting the session removes access to its workspace.
Tools you'll see in transcripts
Tools you'll see in transcripts
Agents use these tools on their own. You can also name them in prompts.
write_artifact takes text. For a binary deliverable, such as a PDF or a spreadsheet, the agent creates the file with a command and saves it anywhere under /workspace/.managed-agents/outputs. Files placed there by any tool are kept the same way.What gets kept
At the end of each turn, once the agent stops and nothing is queued, the deliverables folder is checked and every new or changed file is kept. A file that can’t be kept is reported as a warning; the session keeps running.How files are kept
How files are kept
- Changes. A file saved again under the same path replaces the earlier version. A file that hasn’t changed isn’t kept twice.
- Children. Subagents and teammates share the root’s sandbox, so their deliverables count as the root session’s deliverables.
- Problems are reported, not fatal. A file that can’t be kept adds a
session_statusevent withevent_statuswarning, the codesession_output_degraded, and a message naming the file. The session keeps running. A file refused once is not reported again until it changes. - Earlier versions survive a bad rewrite. If a kept file is later emptied, grows past the size limit, or becomes unreadable, the earlier kept version stays.
Limits
One deliverable can be at most 1 GiB on managed computes or 64 MiB on self-hosted workers. Each turn keeps at most 200 files and normally 512 MiB. A single file over the turn byte budget can still be kept as the first file of that turn. Files that wait for a later turn are kept only if the session has one.Every deliverable limit
Every deliverable limit
A session also has an overall image budget, shared by every tool that returns images, of 500 images and 100 MiB. See Limits.
What can go wrong
The most common problems:- A deliverable is missing from the Files tab. It was saved outside the deliverables folder. Ask for it by name as a deliverable, or save it under
/workspace/.managed-agents/outputs. session_output_degradedwarning about the per-file limit. A deliverable exceeds the limit for its compute provider. Split or compress the file.share_filefails with “supports PNG, JPEG, and WebP images”. The file is another format, such as SVG or PDF. Ask the agent to render a PNG first.
Every deliverable error
Every deliverable error
Next steps
Files
Attach input files and download session outputs.
Referenced sessions
Read an earlier session’s deliverables from a new one.
Teams
Have several agents produce parts of one deliverable.
Research team tutorial
A team session that ends in a report.