/v1/nodejs/execute is aiod's JavaScript execution route: scripts, JSON processing, web tooling, JS-based automation.
It always runs on the daemon's native REPL, a process spawned directly, needing only node on PATH. No external service is required.
The same execution is also reachable by language, not just by route. Pass language: "javascript" (or "node") to POST /v2/code/execute. There is no separate /v2/nodejs.
node on PATH. GET /v1/capabilities confirms it: code_interpreter.kinds contains nodejs, javascript_backend is native, and default_node names the binary that will be spawned — NODE_VERSION or NODE_CODE_EXEC_VERSION choose it where several are installed.
A call without session_id keeps nothing after it returns:
Request body:
The request fields are the same as the code plane's: code (required), session_id, stateful, timeout (1–900 s, default 30), cwd, user. The response has the same shape; this route represents an empty stream as "" rather than null.
console.log becomes a stream output; the cell's last expression becomes an execute_result with a text/plain value, so globalThis.n = 41 answers with 41 even though nothing was printed.
runtime_packages and global_packages are always empty here. What is installed comes from GET /v2/sandbox/packages?lang=nodejs.
Pass session_id to keep globals across calls. Session state lives in memory: it persists within the session but is gone after aiod restarts.
| Route | Purpose | Notes |
|---|---|---|
POST /v1/nodejs/sessions | Open one up front | Optional session_id, cwd, user |
GET /v1/nodejs/sessions | List them | Each entry has cwd, state, max_idle_time |
GET /v1/nodejs/sessions/{id} | Read one | An unknown id is a 404 |
DELETE /v1/nodejs/sessions/{id} | End one | Answers deleted |
DELETE /v1/nodejs/sessions | End all of them | Answers cleaned_sessions |
Sessions share the native code plane's limits: up to 20 at once, idle-closed after 1800 s (AIO_CODE_MAX_SESSIONS / AIO_CODE_SESSION_TIMEOUT_SECS). One more than that is a 429.
Both SDKs cover execution and session management:
Which SDK calls reach this route unchanged is listed in 1.x SDK compatibility.
A throw is an HTTP 200 with success: false and status: "error". The error output carries ename, evalue, and a traceback whose frames name evalmachine.<anonymous>, since the code runs in a VM context rather than as a file.
A run past its timeout answers status: "timeout" and execution timed out after 2000ms; session state was reset in both stderr and the error output. The daemon kills the interpreter five seconds past the deadline; the session stays open with an empty namespace.
/v1/nodejs/execute for JavaScript-specific execution./v2/code/execute (or /v1/code/execute) when your caller picks the language dynamically./v1/bash/exec or /v2/commands for shell commands such as npm install.