跳转到内容
EN

续租电脑连接

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

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

请求参数

  • 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 自有扩展。租约不再有效(已释放、已过期、电脑已换机器)返回 409 LEASE_STALE,此时重新调用 connect 取得新的连接与租约。跨租户或不存在的电脑返回 404。

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

请求示例

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

响应示例 200

{
  "lease_id": "lease_f8d128d1-d8cc-4b22-bf44-dd77e5826f13",
  "lease_expires_at": "2026-10-22T15:24:29.212Z"
}

响应

HTTP 200

Computer result

application/json

名称 类型 说明
lease_id string Id of the lease that keeps this connection's machine in service; renew it while the connection is open and release it on close. Null when no lease exists.
lease_expires_at string Time the lease lapses unless renewed, as an ISO 8601 timestamp; renew at about a third of the time remaining.

运行示例前

先创建电脑,再调用连接电脑,传入 {"need":"heavy"}。用返回的 lease_id 替换 lease_123。测试结束后释放租约,先归档电脑再删除。