# Files (/docs/run/files)



```ts
const uploaded = await client.artifacts.upload(fileBytes, {
  name: "brief.pdf",
  sessionId: session.id,
  contentType: "application/pdf",
});

await session.inputParts(
  [
    { type: "text", text: "Summarise this brief." },
    { type: "file", artifactId: uploaded.id },
  ],
  { idempotencyKey },
);
```

A message has at most 32 parts. Images go to the model as images; text files
go as text.

## API [#api]

| Method                                                      | Role                                  |
| ----------------------------------------------------------- | ------------------------------------- |
| `upload(body, { name, sessionId?, contentType?, labels? })` | Create an artifact.                   |
| `uploadVersion(id, body)`                                   | Add a version.                        |
| `list({ sessionId? })`                                      | List artifacts.                       |
| `get(id)`                                                   | Metadata and versions.                |
| `download(id, { version?, range? })`                        | Bytes through the Runtime.            |
| `link(id, { expiresIn? })`                                  | Credential-free URL, 5 to 15 minutes. |
| `tree(id)` / `file(id, path)`                               | Folder contents.                      |
| `diff(id, { version?, from? })`                             | Versions of a folder.                 |
| `zip(id)`                                                   | Download a folder as a zip.           |
| `delete(id)`                                                | Remove the artifact.                  |

Routes and schemas are on the [Runtime API](/reference/runtime).

## Sandbox outputs [#sandbox-outputs]

An agent with a sandbox gets `save_artifact`. At the end of each turn the
Runtime exports `/workspace/outputs` as the session's `outputs` artifact.

## Next step [#next-step]

<Cards>
  <Card title="Sandboxes" description="Give the session a /workspace." href="/docs/run/sandboxes" />

  <Card title="Sessions" description="Send file parts on a turn." href="/docs/run/sessions" />
</Cards>
