• 訊息
  • 託管代理
  • 管理
Search...
⌘K
第一步
概覽快速入門在 Console 中建立原型
定義您的代理
代理設定工具MCP 連接器權限政策代理技能
設定代理環境
雲端環境設定雲端沙箱參考
將工作委派給您的代理
啟動工作階段工作階段操作工作階段事件串流訂閱 Webhook定義結果使用保管庫進行驗證
管理代理上下文
存取 GitHub附加與下載檔案
進階協調
多代理工作階段排程部署
參考
託管代理參考
處理檔案
Files 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 工作階段。

工作階段建立後,您可以使用這些操作來讀取、更新、封存或刪除它。請參閱啟動工作階段以了解如何建立工作階段並向其傳送工作。

所有 Managed Agents API 請求都需要 managed-agents-2026-04-01 beta 標頭。SDK 會自動設定此 beta 標頭。

工作階段狀態

工作階段會經歷以下狀態。請參閱啟動工作階段以了解工作階段的生命週期。

狀態說明
idle代理程式正在等待輸入,包括使用者訊息或工具確認。工作階段以 idle 狀態開始。
running代理程式正在主動執行中。
rescheduling發生暫時性錯誤,正在自動重試。
terminated工作階段因無法復原的錯誤而結束。

更新代理程式設定

您可以在工作階段進行中更新其 agent.tools 和 agent.mcp_servers(包括權限政策),而無需建立新的代理程式版本。更新僅限於該工作階段,不會傳播回底層的代理程式。

更新的語意為完整取代:提供的陣列即為新值。若要保留現有項目,請先 GET 該工作階段,修改陣列後再 POST 回去。

工作階段必須處於 idle 狀態才能更新代理程式。如果您需要在代理程式執行時更新它,請先中斷該工作階段。

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"

封存工作階段

封存工作階段可防止傳送新事件,同時保留其歷史記錄。處於 running 狀態的工作階段無法被封存;如果您需要立即封存,請傳送中斷事件。

ant beta:sessions archive \
  --session-id "$SESSION_ID"

刪除工作階段

刪除工作階段會永久移除其記錄、事件及相關聯的沙箱。處於 running 狀態的工作階段無法被刪除;如果您需要立即刪除,請傳送中斷事件。

檔案、記憶體儲存區、保管庫、技能、環境和代理程式是獨立的資源,不會受到工作階段刪除的影響。

ant beta:sessions delete \
  --session-id "$SESSION_ID"

Was this page helpful?

  • 工作階段狀態
  • 更新代理程式設定
  • 擷取工作階段
  • 列出工作階段
  • 封存工作階段
  • 刪除工作階段