获取会话资源
get /v1/sessions/{session_id}/resources/{resource_id}
获取会话资源
路径参数
-
session_id: string -
resource_id: string
请求头参数
-
"anthropic-beta": optional array of AnthropicBeta可选的请求头,用于指定要使用的 beta 版本。
-
string -
"message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 22 more-
"message-batches-2024-09-24" -
"prompt-caching-2024-07-31" -
"computer-use-2024-10-22" -
"computer-use-2025-01-24" -
"pdfs-2024-09-25" -
"token-counting-2024-11-01" -
"token-efficient-tools-2025-02-19" -
"output-128k-2025-02-19" -
"files-api-2025-04-14" -
"mcp-client-2025-04-04" -
"mcp-client-2025-11-20" -
"dev-full-thinking-2025-05-14" -
"interleaved-thinking-2025-05-14" -
"code-execution-2025-05-22" -
"extended-cache-ttl-2025-04-11" -
"context-1m-2025-08-07" -
"context-management-2025-06-27" -
"model-context-window-exceeded-2025-08-26" -
"skills-2025-10-02" -
"fast-mode-2026-02-01" -
"output-300k-2026-03-24" -
"user-profiles-2026-03-24" -
"advisor-tool-2026-03-01" -
"managed-agents-2026-04-01" -
"cache-diagnosis-2026-04-07"
-
-
返回值
-
BetaManagedAgentsGitHubRepositoryResource object { id, created_at, mount_path, 4 more }-
id: string -
created_at: stringRFC 3339 格式的时间戳
-
mount_path: string -
type: "github_repository""github_repository"
-
updated_at: stringRFC 3339 格式的时间戳
-
url: string -
checkout: optional BetaManagedAgentsBranchCheckout or BetaManagedAgentsCommitCheckout-
BetaManagedAgentsBranchCheckout object { name, type }-
name: string要检出的分支名称。
-
type: "branch""branch"
-
-
BetaManagedAgentsCommitCheckout object { sha, type }-
sha: string要检出的完整提交 SHA。
-
type: "commit""commit"
-
-
-
-
BetaManagedAgentsFileResource object { id, created_at, file_id, 3 more }-
id: string -
created_at: stringRFC 3339 格式的时间戳
-
file_id: string -
mount_path: string -
type: "file""file"
-
updated_at: stringRFC 3339 格式的时间戳
-
-
BetaManagedAgentsMemoryStoreResource object { memory_store_id, type, access, 4 more }附加到代理会话的内存存储。
-
memory_store_id: string内存存储 ID(memstore_...)。必须属于调用者的组织和工作区。
-
type: "memory_store""memory_store"
-
access: optional "read_write" or "read_only"附加内存存储的访问模式。
-
"read_write" -
"read_only"
-
-
description: optional string内存存储的描述,在附加时快照。渲染到代理的系统提示中。存储没有描述时为空字符串。
-
instructions: optional string每个附加项对代理如何使用此存储的指导。渲染到系统提示的记忆部分。最多 4096 个字符。
-
mount_path: optional string存储在会话容器中挂载的文件系统路径,例如 /mnt/memory/user-preferences。从存储的名称派生。仅输出。
-
name: optional string内存存储的显示名称,在附加时快照。之后对存储名称的编辑不会传播到此资源。
-
示例
curl https://api.anthropic.com/v1/sessions/$SESSION_ID/resources/$RESOURCE_ID \
-H 'anthropic-version: 2023-06-01' \
-H 'anthropic-beta: managed-agents-2026-04-01' \
-H "X-Api-Key: $ANTHROPIC_API_KEY"
响应
{
"id": "sesrsc_011CZkZCKr6eXyl0gWMOdQiu",
"created_at": "2026-03-15T10:00:00Z",
"mount_path": "/workspace/example-repo",
"type": "github_repository",
"updated_at": "2026-03-15T10:00:00Z",
"url": "https://github.com/example-org/example-repo",
"checkout": {
"name": "main",
"type": "branch"
}
}