Sessions
A session is a persistent shell inside a VM: its own working directory, environment, and run queue. Create one to keep state across multiple runs calls, the same way a terminal tab keeps its own state.
The Session object
session_id
String
The session's id. Pass this as
session_id on runs to execute inside this session.session_idx
Int
Zero-based index reflecting creation order within the VM.
state
"idle" | "running"
Whether a run is currently executing in this session.
cwd
String
The session's working directory.
env
Object
Environment variables set on this session, if any.
POST/v1/vms/{id}/sessions
Request
cwd
String
Starting working directory for this session.
env
Object
Environment variables for this session.
Response
Returns a Session object.
Example
bash
curl -X POST localhost:7240/v1/vms/$VM/sessions \
-H "Content-Type: application/json" \
-d '{"cwd":"/app"}'GET/v1/vms/{id}/sessions
Response
sessions
Array
A list of Session objects.
Example
bash
curl localhost:7240/v1/vms/$VM/sessionsDELETE/v1/vms/{id}/sessions/{session_id}
Removes the session. A 404 if it doesn't exist.
Example
bash
curl -X DELETE localhost:7240/v1/vms/$VM/sessions/$SESSION_ID