docs/user_guide/en/attachments.md
Audience: operators integrating directly with backend REST/WS endpoints. The Web UI already handles most scenarios.
Attachments are files that can be uploaded, downloaded, or registered during a session. Artifacts are events emitted when attachments change so clients can listen in real time. This guide summarizes the REST endpoints, WebSocket mirrors, and storage policies.
POST /api/uploads/{session_id}
Content-Type: multipart/form-datafile{
"attachment_id": "att_bxabcd",
"name": "spec.md",
"mime": "text/markdown",
"size": 12345
}
WareHouse/<session>/code_workspace/attachments/ and are recorded in attachments_manifest.json.GET /api/uploads/{session_id}
POST /api/workflow/execute or WebSocket human_input payloads can include attachments: ["att_xxx"]. You still must supply task_prompt, even when you only want file uploads.GET /api/sessions/{session_id}/artifact-events
after, wait_seconds, include_mime, include_ext, max_size, limit.events[], next_cursor, has_more, timed_out.{
"artifact_id": "art_123",
"attachment_id": "att_456",
"node_id": "python_runner",
"path": "code_workspace/result.json",
"size": 2048,
"mime": "application/json",
"hash": "sha256:...",
"timestamp": 1732699900
}
artifact_created, so dashboard clients can subscribe live.GET /api/sessions/{session_id}/artifacts/{artifact_id}
mode=meta|stream, download=true|false.meta → metadata only; stream → file content. Add download=true to include Content-Disposition.data_uri when the server enables it.GET /api/sessions/{session_id}/download
WareHouse/<session>/ into a zip for batch download.code_workspace/attachments/, and the manifest records source, workspace_path, storage, etc.AttachmentStore.register_file() to turn workspace files into attachments; WorkspaceArtifactHook syncs events.MAC_AUTO_CLEAN_ATTACHMENTS=1 to delete the attachments/ directory after the session completes.client_max_body_size, max_request_body_size) or customize AttachmentService.save_upload_file.MessageBlockType (image/audio/video/file); filter via include_mime as needed.| Issue | Mitigation |
|---|---|
| Upload 413 Payload Too Large | Raise proxy limits or FastAPI client_max_size; confirm disk quota. |
| Download link 404 | Check session_id spelling (allowed chars: letters/digits/_-) and confirm the session hasn’t been purged. |
| Missing artifact events | Ensure WebSocket is connected or use artifact-events REST polling with the after cursor. |
| Attachment not visible in Python node | Verify code_workspace/attachments/ hasn’t been cleaned and _context[python_workspace_root] is correct. |
/download for the zip; if you need just a subset, combine artifact-events with include_ext filters.