Files and artifacts
Work with mutable environment files and immutable turn deliverables.
A live file belongs to the Session environment. An Artifact is a stored copy of a deliverable from a completed Turn. Updating the live file later does not change an existing Artifact.
Supply input files
Include base64-encoded inline files when creating the Environment:
const environment = {
type: 'openai_hosted',
files: [{
type: 'inline', path: '/workspace/notes.txt',
data: Buffer.from('Summarize these notes.').toString('base64'),
}],
};
Use the Environment files endpoint to write additional inline files or list live files. File-ID attachments are not currently supported.
| Operation | Endpoint |
|---|---|
| Write inline files | POST /v1/agents/environments/{environment_id}/files |
| List live files | GET /v1/agents/environments/{environment_id}/files |
Files remain within that Session's Sandbox. They are not shared with other Sessions created from the same Agent.
Produce Artifacts
Instruct the Agent to save deliverables under /workspace/outputs. At Turn completion, Rebyte copies those files into private storage and exposes them as Session Artifacts.
const artifacts = await client.beta.agents.sessions.artifacts.list(sessionId);
for (const artifact of artifacts.data) {
const content = await client.beta.agents.sessions.artifacts.content(
artifact.id, { session_id: sessionId },
);
console.log(artifact.path, artifact.size_bytes);
// Use content.arrayBuffer() for binary files.
console.log(await content.text());
}
Wait for the Turn outcome before expecting final deliverables. List results support cursor pagination.
Rebyte scans the current contents of /workspace/outputs on every completed Turn.
A file left there can produce a new Artifact ID in a later Turn even if its bytes
are unchanged. path is therefore not an Artifact identity or a deduplication key.
Use artifact.id for downloads and turn_id to group deliveries. An older Artifact
keeps its original bytes when the live path changes. If your application wants one
latest version per path, make that a display policy rather than overwriting stored
Artifact records.
Environment file operations enter the lazy Sandbox guard. Creating an Environment configuration with inline files alone does not allocate a VM; the first operation that needs the filesystem does. A text-only Turn does not create a Sandbox merely to scan outputs.
Delete and retain
Deleting an Artifact removes its stored copy, not the live file. Deleting a Session removes both its environment and stored Artifacts. Download deliverables before Session deletion if your application needs to retain them.
Artifact reads require organization authorization and the matching Session ID. Current limits are approximately 5 MiB per inline file and 50 MiB per Artifact.