Agent

Add Session Resource

Attach an extra resource to a session for its execution to use.

Upload a file first, then replace the example file ID with its returned ID. Call Create session first and replace the example session ID with its returned ID.

POST /agent/v1/sessions/{session_id}/resources◐ Partial

Request parameters

  • session_idstring必填

    path: Session id (sesn_...), as returned by sessions.create or sessions.list. The same id is also accepted as the session_id query parameter on resource and thread calls, where it must equal the path value.

  • typestring必填

    query: Resource type selector for the body; only file resources are supported. Normally you send type inside the JSON body and omit this parameter.

    取值 file
  • file_idstring必填

    ID of a previously uploaded file.

  • mount_pathstring可选

    Mount path in the container. Defaults to `/mnt/session/uploads/<file_id>`.

Returns

200

Supports persistence, retrieval and removal of file resource references, up to 500 per session. Files must be live and owned by the current tenant. Paths default to /mnt/session/uploads/<file_id>; custom paths are rooted there and parent traversal is rejected. File content is immutable through this API. Sandbox synchronization is not implemented in this batch.

Errors follow the Anthropic error format (type / message / request_id) — see error codes

Response

HTTP 200

Successful response

application/json

NameTypeDescription
idstringResource id, the resource_id of sessions.resources calls.
created_atstringA timestamp in RFC 3339 format
file_idstringId of the uploaded file; it must exist and belong to your tenant.
mount_pathstringPath inside the machine where the file is mounted; defaults to /mnt/session/uploads/<file_id>, and custom paths are rooted there.
typestringAlways `file`. A file resource: an uploaded file mounted into the session's machine.
updated_atstringA timestamp in RFC 3339 format