跳转到内容
EN

释放电脑连接租约

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

DELETE/agent/v1/computers/{computer_id}/leases/{lease_id}● 支持

请求参数

  • computer_idstring必填

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

  • lease_idstring必填

    path: lease_id from the connect response.

返回

200

Praxis 自有扩展。幂等:未知或已释放的租约同样成功。跨租户或不存在的电脑返回 404。

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

请求示例

curl
# 先调用「创建计算机」,用返回的计算机 ID 替换 cmp_123。
curl -X DELETE https://api.deepraxis.com/agent/v1/computers/cmp_123/leases/lease_123 \
  -H "Authorization: Bearer $PRAXIS_API_KEY"
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.delete(
    f"{opts['base_url']}/v1/computers/cmp_123/leases/lease_123",
    headers={"Authorization": f"Bearer {opts['api_key']}"},
)
print(resp.status_code, resp.json())
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/leases/lease_123`, {
  method: "DELETE",
  headers: { Authorization: `Bearer ${opts.apiKey}`, "Content-Type": "application/json" },
});
console.log(resp.status, await resp.json());

响应示例 200

{
  "id": "lease_99320e29-afa6-42df-965a-aa631e75e570",
  "type": "computer_lease_released"
}

响应

HTTP 200

Computer result

application/json

名称 类型 说明
id string Id of the released lease.
type string Object type tag.

运行示例前

先创建电脑并以 {"need":"heavy"} 连接,用连接返回的 lease_id 替换 lease_123。释放后如需再次使用,重新连接取得新租约。删除测试电脑前须先归档。