Claude Managed Agents — Claude 管理代理
v1.0.0通过Python辅助CLI管理Claude Managed Agents的整个生命周期,ant CLI等效命令作为次要路径进行文档记录。每当用户想要...
运行时依赖
安装命令
点击复制技能文档
Claude Managed 代理s
Use this 技能 to operate Anthropic Claude Managed 代理s safely and 清理ly from this machine.
This 技能 is SDK-first through the bundled Python 辅助工具, with ant 命令行工具 documented as a secondary operator lane. Raw REST is only for 调试ging or when the SDK is unavAIlable.
What this 技能 handles 代理s 创建 更新 retrieve 列出 列出 versions 归档 删除 环境s 创建 更新 retrieve 列出 归档 删除 会话s 创建 retrieve 列出 归档 删除 会话 事件 发送 user messages interrupt and redirect 列出 历史 流 live SSE 事件 发送 工具 confirmations 发送 custom 工具 结果s files 上传 local files to the Files API 列出, 下载, and 删除 files return file IDs for mounting into 会话s 会话 resources 添加 resources to 运行ning 会话s 列出 mounted resources 删除 mounted resources by resource ID configuration domAIns built-in 工具设置 controls MCP servers 技能s packages networking vault IDs mounted resources diagnostics local preflight via doctor optional live read-only connectivity 检查s via doctor --live Required 环境
设置:
ANTHROPIC_API_KEY
Optional:
ANTHROPIC_API_BASE_URL ANTHROPIC_MANAGED_代理S_BETA ANTHROPIC_TIMEOUT_SECONDS
The managed-代理s beta header is required. The 辅助工具 uses managed-代理s-2026-04-01 by default.
Script
Use:
scripts/managed_代理s.py
运行 it with Python 3:
python3 ~/.OpenClaw/技能s/claude-managed-代理s/scripts/managed_代理s.py --help
运行 a preflight before live work when the lane feels sketchy:
python3 ~/.OpenClaw/技能s/claude-managed-代理s/scripts/managed_代理s.py \ doctor \ --allowed-host API.example.com
Operating 模型
Prefer this order:
Python 辅助工具 命令行工具 documented ant equivalent when the user wants a direct 命令行工具 path raw REST only when troubleshooting edge cases
The 辅助工具 supports:
--backend auto (default) --backend sdk --backend http
Use sdk when the Anthropic Python SDK is 安装ed. Use http if the SDK is missing or behaving oddly.
Safe 工作流 For new 设置ups confirm ANTHROPIC_API_KEY exists 创建 or inspect the tar获取 代理 创建 or inspect the tar获取 环境 创建 the 会话 发送 a user message event 流 or 列出 事件 to 监控 进度 For mid-运行 steering 列出 or 流 会话 事件 if the 代理 is going the wrong direction, 发送: user.interrupt followed by a new user.message if the 会话 is wAIting on 应用roval, 发送 user.工具_confirmation if the 会话 is wAIting on a custom 工具 结果, 发送 user.custom_工具_结果 High-value 防护rAIls Do not guess event IDs, 工具 use IDs, or custom 工具 use IDs. For 应用roval flows, read recent 事件 first and use the exact pending 工具 ID. For custom 工具s, return only the 结果 the 工具 actually produced. Do not fabricate 成功. Prefer limited networking with explicit hosts for production-oriented 环境s. Use bare hostnames like API.example.com, not full URLs. Do not 删除 环境s, 会话s, or 代理s casually. 归档 first unless the user clearly wants hard deletion. Archiving is usually the safer lifecycle move than deletion, but disposable smoke fixtures may need 删除 for full 清理up. Recommended command patterns 创建 an 代理 with the full built-in 工具设置 python3 ~/.OpenClaw/技能s/claude-managed-代理s/scripts/managed_代理s.py \ 代理 创建 \ --name "Coding 助手" \ --模型 claude-sonnet-4-6 \ --系统 "You are a helpful coding 代理." \ --代理-工具设置
运行 doctor before a live 会话 python3 ~/.OpenClaw/技能s/claude-managed-代理s/scripts/managed_代理s.py \ doctor \ --live \ --allowed-host API.example.com
创建 an 环境 with limited networking and pip packages python3 ~/.OpenClaw/技能s/claude-managed-代理s/scripts/managed_代理s.py \ 环境 创建 \ --name "python-dev" \ --network limited \ --allowed-host API.example.com \ --allow-package-管理器s \ --pip pandas==2.2.0 \ --pip numpy==2.1.0
上传 a file and 获取 a file ID python3 ~/.OpenClaw/技能s/claude-managed-代理s/scripts/managed_代理s.py \ file 上传 \ --file-path ./data.csv \ --only-id
创建 a 会话 with an 上传ed file mounted in the contAIner FILE_ID=$(python3 ~/.OpenClaw/技能s/claude-managed-代理s/scripts/managed_代理s.py \ file 上传 \ --file-path ./data.csv \ --only-id)
python3 ~/.OpenClaw/技能s/claude-managed-代理s/scripts/managed_代理s.py \ 会话 创建 \ --代理-id 代理_123 \ --环境-id env_123 \ --title "Repo analysis" \ --resource-json "{\"type\":\"file\",\"file_id\":\"${FILE_ID}\",\"mount_path\":\"/workspace/data.csv\"}"
添加 another file to a 运行ning 会话 python3 ~/.OpenClaw/技能s/claude-managed-代理s/scripts/managed_代理s.py \ 会话 resource 添加 \ --会话-id sess_123 \ --file-id file_abc123 \ --mount-path /workspace/config.json
下载 a 会话-scoped file artifact python3 ~/.OpenClaw/技能s/claude-managed-代理s/scripts/managed_代理s.py \ file 下载 \ --file-id file_abc123 \ --输出 ./arti