跳转到内容
EN

读取会话资源

先调用「创建会话」,用返回的会话 ID 替换示例 ID。 先调用「添加会话资源」,用返回的资源 ID 替换 sesrsc_123。

GET/agent/v1/sessions/{session_id}/resources/{resource_id}◐ 部分支持

请求参数

  • session_idstring必填

    path: 会话 ID(sesn_...),由 sessions.create 或 sessions.list 返回。资源和线程调用的 session_id 查询参数也接受同一 ID,且必须与路径值一致。

  • resource_idstring必填

    path: 附加到会话的资源 ID,由 sessions.resources.add 或 sessions.resources.list 返回。

  • session_idstring必填

    query: 会话 ID(sesn_...),由 sessions.create 或 sessions.list 返回。资源和线程调用的 session_id 查询参数也接受同一 ID,且必须与路径值一致。

返回

200

支持 file 类型资源的持久化、查询和解除关联,单会话最多 500 条。文件须属于当前租户且有效。默认路径为 /mnt/session/uploads/<file_id>,自定义路径归一到该目录,拒绝父目录遍历。不修改文件内容;本批尚不将资源同步到沙箱。

错误按 Anthropic 错误格式返回(type / message / request_id),参见 错误码

请求示例

curl
# 先调用「创建会话」,用返回的会话 ID 替换示例 ID。 先调用「添加会话资源」,用返回的资源 ID 替换 sesrsc_123。
curl https://api.deepraxis.com/agent/v1/sessions/sesn_123/resources/sesrsc_123 \
  -H "Authorization: Bearer $PRAXIS_API_KEY"
Python
# 先调用「创建会话」,用返回的会话 ID 替换示例 ID。 先调用「添加会话资源」,用返回的资源 ID 替换 sesrsc_123。
import requests

opts = dict(
    base_url="https://api.deepraxis.com/agent",
    api_key="$PRAXIS_API_KEY",
)

# /agent 是我们自己的 Managed Agents 形状,直接发 HTTP 请求(Bearer 认证)
resp = requests.get(
    f"{opts['base_url']}/v1/sessions/sesn_123/resources/sesrsc_123",
    headers={"Authorization": f"Bearer {opts['api_key']}"},
)
print(resp.status_code, resp.json())
TypeScript
// 先调用「创建会话」,用返回的会话 ID 替换示例 ID。 先调用「添加会话资源」,用返回的资源 ID 替换 sesrsc_123。
const opts = {
  baseURL: "https://api.deepraxis.com/agent",
  apiKey: "$PRAXIS_API_KEY",
};

// /agent 是我们自己的 Managed Agents 形状,直接发 HTTP 请求(Bearer 认证)
const resp = await fetch(`${opts.baseURL}/v1/sessions/sesn_123/resources/sesrsc_123`, {
  headers: { Authorization: `Bearer ${opts.apiKey}` },
});
console.log(resp.status, await resp.json());

响应示例 200

{
  "id": "sesrsc_2ba1961e-e890-496b-a5e5-b20328a33faf",
  "type": "file",
  "file_id": "file_dp_01M4N8FJR662VM6T0R6CJHKCEH",
  "mount_path": "/mnt/session/uploads/file_dp_01M4N8FJR662VM6T0R6CJHKCEH",
  "created_at": "2026-10-11T10:35:06.513Z",
  "updated_at": "2026-10-11T10:35:06.513Z"
}

响应

HTTP 200

Successful response

application/json

名称 类型 说明
id string Resource id, the resource_id of sessions.resources calls.
created_at string A timestamp in RFC 3339 format
mount_path string | null | string Path inside the machine where the file is mounted; defaults to /mnt/session/uploads/<file_id>, and custom paths are rooted there. / Filesystem path where the store is mounted in the session container, e.g. /mnt/memory/user-preferences. Derived from the store's name. Output-only.
type string Always github_repository. A GitHub repository resource; not supported on this platform. / Always file. A file resource: an uploaded file mounted into the session's machine. / Always memory_store. A memory store resource; not supported on this platform.
updated_at string A timestamp in RFC 3339 format
url string Repository URL.
checkout null | object Branch or commit to check out.
checkout.name string Branch name to check out.
checkout.type string Always branch. Check out the named branch. / Always commit. Check out the commit with the given SHA.
checkout.sha string Full commit SHA to check out.
file_id string Id of the uploaded file; it must exist and belong to your tenant.
memory_store_id string The memory store ID (memstore_...). Must belong to the caller's organization and workspace.
access null | string Access mode for an attached memory store.
description string Description of the memory store, snapshotted at attach time. Rendered into the agent's system prompt. Empty string when the store has no description.
instructions null | string Per-attachment guidance for the agent on how to use this store. Rendered into the memory section of the system prompt. Max 4096 chars.
name null | string Display name of the memory store, snapshotted at attach time. Later edits to the store's name do not propagate to this resource.