−25%

su Windows con pagamento annuale, fino al 31/10. Vai ai piani

EQVPS
Inizia

Sandbox

MicroVM Linux isolate per il codice che eseguono i tuoi script e agenti IA. Una sandbox parte in circa un secondo, esegue Python, Node.js o bash ed è addebitata al secondo dallo stesso saldo dei tuoi server.

Cos’è una sandbox

Una piccola macchina Linux che crei via API o MCP, usi per qualche secondo o qualche giorno e poi elimini. Internet in uscita funziona (pip install, npm install, git clone). Niente porte in ingresso né SSH: comandi e file passano dall’API. Dentro: Python 3.12 con pip, Node.js 22 con npm, bash, git e curl.

Due modalità

Effimera (predefinita) — per un compito. Viene eliminata quando chiami delete, dopo il timeout di inattività (5 minuti di default, fino a 1 ora) o allo scadere del TTL (fino a 24 ore). Addebito al secondo, minimo 60 secondi.
Persistente — conserva disco e stato fino a 30 giorni. Addebito per ogni ora iniziata, e un mese di calendario non costa mai più di 730 ore meno il 25%. Se il saldo finisce, viene messa in pausa con uno snapshot (non addebitato) e riprende dopo la ricarica; gli snapshot in pausa restano per 14 giorni.

Tariffe

TariffavCPURAMDiscoReteAll’oraPersistente, max al mese
micro0.25512 MB3 GB50 Mbit/s$0.0165$9.03
small0.51 GB5 GB100 Mbit/s$0.033$18.07
standard12 GB10 GB200 Mbit/s$0.066$36.14
plus24 GB15 GB300 Mbit/s$0.132$72.27
pro48 GB20 GB400 Mbit/s$0.264$144.54
max816 GB40 GB500 Mbit/s$0.528$289.08

Paghi vCPU e RAM della tariffa scelta: $0.040 per vCPU-ora e $0.013 per GiB-ora. Prezzi aggiornati, senza token: GET /sandboxes/tariffs.

Limiti da conoscere

Un comando gira fino a 55 secondi; i lavori più lunghi vanno come attività in background di cui interroghi il risultato. File fino a 5 MB per richiesta, quelli più grandi (fino a 2 GB) tramite link di download e upload monouso. Un account può avere fino a 20 sandbox e 2 comandi in contemporanea.

Variabili d'ambiente

Passa segreti e impostazioni come env. Se impostate alla creazione valgono per ogni comando nella sandbox; se impostate in exec o run valgono solo per quella chiamata e sovrascrivono i valori della sandbox. Fino a 64 variabili, 32 KB per valore e 64 KB in totale. I valori sono salvati cifrati, l'API non li restituisce mai e non finiscono nei log: le risposte mostrano solo i nomi (env_keys).

API=https://api.eqvps.com/api/v1/eqvps
AUTH="Authorization: Bearer $EQVPS_API_KEY"

# env for the whole sandbox (only the names come back, as env_keys)
SB=$(curl -s -X POST $API/sandboxes -H "$AUTH" -H "Content-Type: application/json" \
  -d '{"tariff":"small","env":{"DB_URL":"postgres://user:pass@db/app","MODE":"test"}}' | jq -r .id)

# env for one call, merged over the sandbox env
curl -s -X POST $API/sandboxes/$SB/exec -H "$AUTH" -H "Content-Type: application/json" \
  -d '{"command":"echo $MODE $RUN_ID","env":{"RUN_ID":"42"}}'

Limite di spesa

Per impostazione predefinita le sandbox non hanno limite di spesa. Puoi impostare un tetto giornaliero e mensile nella dashboard o con PUT /sandboxes/budget. Al raggiungimento del tetto, le nuove sandbox ricevono 429 budget_exceeded, quelle effimere attive vengono eliminate e quelle persistenti messe in pausa mantenendo il disco. Ripartono quando alzi il tetto o inizia un nuovo giorno o mese (UTC).

# daily cap $5, monthly cap $50 (null = no cap)
curl -s -X PUT $API/sandboxes/budget -H "$AUTH" -H "Content-Type: application/json" \
  -d '{"daily_usd":5,"monthly_usd":50}'

# spent today / this month and when the caps reset (UTC)
curl -s $API/sandboxes/budget -H "$AUTH"

Avvio rapido: MCP (Claude Code, Cursor e altri client)

Collega il server MCP una volta, poi chiedi all’agente quello che ti serve a parole tue. Strumenti sandbox: create_sandbox, run_code, exec_command, get_task, kill_task, get_upload_url, get_download_url, list_sandboxes, get_sandbox, kill_sandbox, sandbox_pricing.

claude mcp add --transport http eqvps https://mcp.eqvps.com/mcp \
  --header "Authorization: Bearer $EQVPS_API_KEY"
Crea una sandbox piccola, esegui print(2 + 2) in Python, mostrami l’output ed elimina la sandbox.

Avvio rapido: REST da Python e Node.js

Non servono pacchetti extra. Metti il tuo token nella variabile d’ambiente EQVPS_API_KEY (come ottenerlo: «Collegare il tuo account»).

Python
# first_sandbox.py — Python 3.8+, standard library only
import json, os, urllib.request

API = "https://api.eqvps.com/api/v1/eqvps"
KEY = os.environ["EQVPS_API_KEY"]

def call(method, path, body=None):
    req = urllib.request.Request(API + path, method=method,
        data=json.dumps(body).encode() if body is not None else None,
        headers={"Authorization": "Bearer " + KEY,
                 "Content-Type": "application/json", "Accept": "application/json"})
    with urllib.request.urlopen(req, timeout=90) as r:   # HTTPError on 401/402/…
        return json.loads(r.read() or b"{}")

sb = call("POST", "/sandboxes", {"tariff": "small"})
try:
    r = call("POST", f"/sandboxes/{sb['id']}/run",
             {"language": "python", "code": "print(2 + 2)"})
    print(r["exit_code"], r["stdout"])                    # 0 4
finally:
    call("DELETE", f"/sandboxes/{sb['id']}")
Node.js
// first_sandbox.mjs — Node.js 18+ (built-in fetch), run: node first_sandbox.mjs
const API = "https://api.eqvps.com/api/v1/eqvps";
const KEY = process.env.EQVPS_API_KEY;

async function call(method, path, body) {
  const r = await fetch(API + path, {
    method,
    headers: { Authorization: `Bearer ${KEY}`, "Content-Type": "application/json", Accept: "application/json" },
    body: body ? JSON.stringify(body) : undefined,
  });
  const data = await r.json();
  if (!r.ok) throw new Error(`${r.status} ${data.error ?? ""} ${data.message ?? ""}`);
  return data;
}

const sb = await call("POST", "/sandboxes", { tariff: "small" });
try {
  const r = await call("POST", `/sandboxes/${sb.id}/run`, { language: "node", code: "console.log(2 + 2)" });
  console.log(r.exit_code, r.stdout); // 0 4
} finally {
  await call("DELETE", `/sandboxes/${sb.id}`);
}

SDK per Python e TypeScript

Preferisci una libreria? I pacchetti per Python e TypeScript fanno le stesse chiamate REST, ritentano da soli 429 e 503 ed eliminano sempre la sandbox alla fine del blocco. Installazione ed esempio:

Python · eqvps
# pip install -U eqvps       https://pypi.org/project/eqvps/  (0.2.0+ for env)
# "eqvps sandbox create" = Sandbox.create() here · create_sandbox in MCP · POST /sandboxes in REST (no CLI)
from eqvps import Sandbox

# EQVPS_API_KEY from the environment; env = secrets for your code, stored encrypted
with Sandbox.create(tariff="small", env={"DB_URL": "postgres://user:pass@db/app"}) as sb:
    r = sb.run("print(2 + 2)")
    print(r.stdout, r.exit_code)             # "4\n" 0
    sb.upload("/root/data.csv", "a,b\n1,2\n")
    print(sb.exec("wc -l /root/data.csv").stdout)
    print(sb.exec("echo $RUN_ID", env={"RUN_ID": "42"}).stdout)   # env for one call
# the sandbox is deleted when the block exits, also on errors
TypeScript · @eqvps/sdk
// npm i @eqvps/sdk@latest   https://www.npmjs.com/package/@eqvps/sdk  (0.2.0+ for env)
import { Sandbox } from "@eqvps/sdk";

// EQVPS_API_KEY from the environment; env = secrets for your code, stored encrypted
await Sandbox.with({ tariff: "small", env: { DB_URL: "postgres://user:pass@db/app" } }, async (sb) => {
  const r = await sb.run("print(2 + 2)");
  console.log(r.stdout, r.exit_code);                    // "4\n" 0
  console.log((await sb.exec("echo $RUN_ID", { env: { RUN_ID: "42" } })).stdout); // env for one call
});                                                       // deleted afterwards, also on errors

Collegare il tuo account: token, configurazione, prima sandbox, saldo →

Commenti

Ancora nessun commento. Sii il primo.

Lascia un commento

I commenti sono moderati prima di comparire.