Skip to content
中文

Connect computer

Call Create computer first and replace cmp_123 with its returned ID.

POST/agent/v1/computers/{computer_id}/connect● Supported

Request parameters

  • computer_idstringrequired

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

  • needstringoptional
    default "light"

    Defaults to light. light uses the lightweight shell, or the heavy instance while it is running. heavy requests a full Linux computer for interactive programs; heavy running time counts toward the daily budget in seconds.

    values lightheavy

Returns

200

Own-face extension: Managed Agents has no persistent Computer connection. Returns the public SDK sandbox_id, envd_access_token and template_id, plus tier (kept for compatibility: a Computer is one machine, so tier does not name a machine you can choose) and the lease that keeps the machine in service (lease_id, lease_expires_at; lease_id is null when no lease exists). Keep the lease while the connection stays open: renew it about every 20 seconds (POST .../leases/{lease_id}/renew) and release it on close (DELETE .../leases/{lease_id}). An unrenewed lease simply expires, and the machine is reclaimed only after that. Archived computers remain accessible; foreign or absent computers return 404. Never cache credentials.

Errors follow the Anthropic error format (type / message / request_id) — see error codes

Request

curl
# Call Create computer first and replace cmp_123 with its returned ID.
curl -X POST https://api.deepraxis.com/agent/v1/computers/cmp_123/connect \
  -H "Authorization: Bearer $PRAXIS_API_KEY"
Python
# Call Create computer first and replace cmp_123 with its returned ID.
import requests

opts = dict(
    base_url="https://api.deepraxis.com/agent",
    api_key="$PRAXIS_API_KEY",
)

from e2b import Sandbox

resp = requests.post(f"{opts['base_url']}/v1/computers/cmp_123/connect", headers={"Authorization": f"Bearer {opts['api_key']}"})
resp.raise_for_status()
connection = resp.json()
sandbox = Sandbox.connect(connection["sandbox_id"], api_key=opts["api_key"], api_url=opts["base_url"].removesuffix("/agent") + "/e2b", domain="sandbox.praxisusercontent.com")
result = sandbox.commands.run("echo hello")
print(result.stdout)
TypeScript
// Call Create computer first and replace cmp_123 with its returned ID.
const opts = {
  baseURL: "https://api.deepraxis.com/agent",
  apiKey: "$PRAXIS_API_KEY",
};

import { Sandbox } from "e2b";

const resp = await fetch(`${opts.baseURL}/v1/computers/cmp_123/connect`, { method: "POST", headers: { Authorization: `Bearer ${opts.apiKey}` } });
if (!resp.ok) throw new Error(`HTTP ${resp.status}`);
const connection = await resp.json();
const sandbox = await Sandbox.connect(connection.sandbox_id, { apiKey: opts.apiKey, apiUrl: opts.baseURL.replace(/\/agent$/, "/e2b"), domain: "sandbox.praxisusercontent.com" });
const result = await sandbox.commands.run("echo hello");
console.log(result.stdout);

Response 200

{
  "sandbox_id": "sbi0ea40aa2b7c9e79800fdb6bd",
  "envd_access_token": "<redacted>",
  "template_id": "light",
  "tier": "light",
  "lease_id": "lease_eb115096-bc9b-4cde-9a09-2daf6a47f26e",
  "lease_expires_at": "2026-10-23T21:20:47.090Z"
}

Response

HTTP 200

Computer result

application/json

Name Type Description
sandbox_id string Public id of the sandbox that backs the computer, usable with the sandbox API; null while none has been created.
envd_access_token string Access token for the sandbox's environment daemon, returned by the connect call; treat it as a secret.
template_id string Sandbox template the computer's sandbox was created from.
tier string Machine the connection reached: light (the always-present file machine) or heavy (the full machine started on demand and kept while leases are held).
lease_id string | null 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 | null Time the lease lapses unless renewed, as an ISO 8601 timestamp; renew at about a third of the time remaining.