跳转到内容
EN

读取电脑文件内容

先调用「创建计算机」,用返回的计算机 ID 替换 cmp_123。

GET/agent/v1/computers/{computer_id}/files/content● 支持

请求参数

  • computer_idstring必填

    path: Computer id (cmp_...), as returned by computers.create or computers.list.

  • pathstring必填

    query: 要下载内容的文件绝对路径,取自 computers.files.list 返回的 path 字段。

返回

200

Praxis 超集:MA 只有会话级临时容器与 memory_stores,没有可长期存续、可浏览的整台电脑。归档后文件仍可读,但不能用于新会话。environment_id 是可空配方引用;电脑在首次使用时启动,sandbox_id 为 SDK 可用的公开 ID。分页包含归档电脑。

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

请求示例

curl
# 先调用「创建计算机」,用返回的计算机 ID 替换 cmp_123。
curl "https://api.deepraxis.com/agent/v1/computers/cmp_123/files/content?path=/home/user/workspace/sample.txt" \
  -H "Authorization: Bearer $PRAXIS_API_KEY" --output sample.txt
Python
# 先调用「创建计算机」,用返回的计算机 ID 替换 cmp_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/computers/cmp_123/files/content?path=/home/user/workspace/sample.txt",
    headers={"Authorization": f"Bearer {opts['api_key']}"},
)
print(resp.status_code, resp.text)
TypeScript
// 先调用「创建计算机」,用返回的计算机 ID 替换 cmp_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/computers/cmp_123/files/content?path=/home/user/workspace/sample.txt`, {
  headers: { Authorization: `Bearer ${opts.apiKey}` },
});
console.log(resp.status, await resp.text());

响应示例 200

hello

响应

HTTP 200

Raw file bytes (at most 16 MiB); Content-Type is inferred from the extension. ETag is present only when a digest is available. Larger files require the sandbox connection issued by connect.

application/octet-stream

名称 类型 说明
$ string (binary)

HTTP 206

Single byte range

application/octet-stream

名称 类型 说明
$ string (binary)