• 消息
  • 托管智能体
  • 管理
Search...
⌘K
第一步
概览快速入门在控制台中构建原型
定义您的智能体
智能体设置工具MCP 连接器权限策略智能体技能
配置智能体环境
云环境设置云沙箱参考
将工作委派给您的智能体
启动会话会话操作会话事件流订阅 Webhook定义结果使用保管库进行身份验证
管理智能体上下文
访问 GitHub附加和下载文件
高级编排
多智能体会话定时部署
参考
托管智能体参考
处理文件
文件 APIPDF 支持图像与视觉
技能
概览最佳实践企业技能
MCP
远程 MCP 服务器
云平台上的 Claude
AWS 上的 Claude Platform
Log in
会话操作
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...

Solutions

  • AI agents
  • Code modernization
  • Coding
  • Customer support
  • Education
  • Financial services
  • Government
  • Life sciences

Partners

  • Amazon Bedrock
  • Google Cloud's Vertex AI

Learn

  • Blog
  • Courses
  • Use cases
  • Connectors
  • Customer stories
  • Engineering at Anthropic
  • Events
  • Powered by Claude
  • Service partners
  • Startups program

Company

  • Anthropic
  • Careers
  • Economic Futures
  • Research
  • News
  • Responsible Scaling Policy
  • Security and compliance
  • Transparency

Learn

  • Blog
  • Courses
  • Use cases
  • Connectors
  • Customer stories
  • Engineering at Anthropic
  • Events
  • Powered by Claude
  • Service partners
  • Startups program

Help and security

  • Availability
  • Status
  • Support
  • Discord

Terms and policies

  • Privacy policy
  • Responsible disclosure policy
  • Terms of service: Commercial
  • Terms of service: Consumer
  • Usage policy
托管智能体/将工作委派给您的智能体

会话操作

检索、列出、更新、归档和删除 Claude 托管智能体会话。

会话创建后,您可以使用这些操作来读取、更新、归档或删除它。有关创建会话并向其发送任务的信息,请参阅启动会话。

所有 Managed Agents API 请求都需要 managed-agents-2026-04-01 beta 标头。SDK 会自动设置该 beta 标头。

会话状态

会话会经历以下状态。有关会话生命周期的信息,请参阅启动会话。

状态描述
idle智能体正在等待输入,包括用户消息或工具确认。会话以 idle 状态启动。
running智能体正在主动执行。
rescheduling发生了暂时性错误,正在自动重试。
terminated会话因不可恢复的错误而结束。

更新智能体配置

您可以在会话进行中更新会话的 agent.tools 和 agent.mcp_servers(包括权限策略),而无需创建新的智能体版本。更新仅限于当前会话,不会传播回底层智能体。

更新的语义是完全替换:提供的数组即为新值。如需保留现有条目,请先通过 GET 获取会话,修改数组后再通过 POST 提交回去。

会话必须处于 idle 状态才能更新智能体。如果您需要在智能体运行时更新它,请先中断会话。

检索会话

列出会话

归档会话

归档会话可以阻止发送新事件,同时保留其历史记录。处于 running 状态的会话无法归档;如果您需要立即归档,请发送中断事件。

删除会话

删除会话将永久移除其记录、事件和关联的沙箱。处于 running 状态的会话无法删除;如果您需要立即删除,请发送中断事件。

文件、内存存储、保管库、技能、环境和智能体是独立的资源,不受会话删除的影响。

Was this page helpful?

  • 会话状态
  • 更新智能体配置
  • 检索会话
  • 列出会话
  • 归档会话
  • 删除会话
ant beta:sessions update --session-id "$SESSION_ID" <<'YAML'
agent:
  tools:
    - type: agent_toolset_20260401
    - type: mcp_toolset
      mcp_server_name: linear
  mcp_servers:
    - type: url
      name: linear
      url: https://mcp.linear.app/sse
YAML
ant beta:sessions retrieve --session-id "$SESSION_ID"
ant beta:sessions list --agent-id "$AGENT_ID"
ant beta:sessions archive \
  --session-id "$SESSION_ID"
ant beta:sessions delete \
  --session-id "$SESSION_ID"