Reference
sessions
Device acquisition: a session holds one device until it is released or expires. Index · shared schemas · errors.
| Procedure | Summary | REST | MCP tool | Stability |
|---|---|---|---|---|
sessions.create | Acquire a device matching a spec. It returns at once: ready for a warm local device, otherwise starting or queued. Requested installs run inside starting, outside test timeouts. install additionally requires apps:install. | POST | sessions_create | stable |
sessions.get | Read one session | GET | sessions_get | stable |
sessions.list | List the caller's visible sessions | GET | sessions_list | stable |
sessions.wait | Wait until ready (or terminal) or until timeoutMs. until: 'stream' is done once the session's stream can be opened (streamReadyAt set), at ready or before it, or once it is terminal. A timeout is a normal result, never an error. | GET | sessions_wait | stable |
sessions.heartbeat | Extend liveness. Required for test-worker; a keepalive for other holders. | POST | sessions_heartbeat | stable |
sessions.release | End a session: canceled before ready, ended(released) after. The device returns warm, or is recycled when healthy is false. Releasing an ended session returns it unchanged. | POST | sessions_release | stable |
sessions.events | A session's events: status, app state, crashes, input state and stream readiness | GET | — | stable |
sessions.create
Acquire a device matching a spec. It returns at once: ready for a warm local device, otherwise starting or queued. Requested installs run inside starting, outside test timeouts. install additionally requires apps:install.
| REST | POST /v1/sessions/create (input as a JSON body) |
| RPC | /rpc/v2/sessions/create |
| MCP | tool sessions_create; hints: none |
| Auth | devices:acquire |
| Tenancy | project |
| Troupe Cloud | answered by the control plane |
| Stability | stable, since 1.0 |
Input:
{
spec: DeviceSpec
holder?: SessionCreateHolder
key?: string // 1–128 chars
install?: AppSource[] // ≤ 5 items
idleTimeoutMs?: DurationMs
maxDurationMs?: DurationMs
fresh?: boolean
}Output:
SessionErrors: U, E, CAPACITY_UNAVAILABLE, QUOTA_EXCEEDED, DEVICE_SPEC_INVALID, CAPABILITY_UNSUPPORTED, CONFLICT, ORG_SUSPENDED, PROJECT_SUSPENDED, SERVICE_SUSPENDED, PROJECT_REQUIRED.
Named types: AppSource, DeviceSpec, DurationMs, Session, SessionCreateHolder.
sessions.get
Read one session
| REST | GET /v1/sessions/get (input as query parameters) |
| RPC | /rpc/v2/sessions/get |
| MCP | tool sessions_get; hints: read-only, idempotent |
| Auth | devices:read |
| Tenancy | project |
| Troupe Cloud | answered by the control plane |
| Stability | stable, since 1.0 |
Input:
{ sessionId: SessionId }Output:
SessionNamed types: Session, SessionId.
sessions.list
List the caller's visible sessions
| REST | GET /v1/sessions/list (input as query parameters) |
| RPC | /rpc/v2/sessions/list |
| MCP | tool sessions_list; hints: read-only, idempotent |
| Auth | devices:read |
| Tenancy | project |
| Troupe Cloud | answered by the control plane |
| Stability | stable, since 1.0 |
Input:
{
status?: 'live' | 'terminal' | 'all' // default 'live'
holderKind?: HolderKind
limit?: integer // default 50; 1–100
cursor?: Cursor
}Output:
{ sessions: Session[]; nextCursor?: string }Errors: U.
Named types: Cursor, HolderKind, Session.
sessions.wait
Wait until ready (or terminal) or until timeoutMs. until: 'stream' is done once the session's stream can be opened (streamReadyAt set), at ready or before it, or once it is terminal. A timeout is a normal result, never an error.
| REST | GET /v1/sessions/wait (input as query parameters) |
| RPC | /rpc/v2/sessions/wait |
| MCP | tool sessions_wait; hints: read-only, idempotent |
| Auth | devices:read |
| Tenancy | project |
| Troupe Cloud | answered by the control plane |
| Stability | stable, since 1.0 |
Input:
{
sessionId: SessionId
until?: 'ready' | 'stream' | 'terminal' // default 'ready'
timeoutMs?: TimeoutMs // default 30000
}Output:
{ done: boolean; session: Session }Named types: Session, SessionId, TimeoutMs.
sessions.heartbeat
Extend liveness. Required for test-worker; a keepalive for other holders.
| REST | POST /v1/sessions/heartbeat (input as a JSON body) |
| RPC | /rpc/v2/sessions/heartbeat |
| MCP | tool sessions_heartbeat; hints: idempotent |
| Auth | devices:acquire |
| Tenancy | project |
| Troupe Cloud | answered by the control plane |
| Stability | stable, since 1.0 |
Input:
{ sessionId: SessionId }Output:
{ expiresAt: string; maxEndsAt?: string }Errors: U, NOT_FOUND, SESSION_ENDED, SESSION_BUSY.
Named types: SessionId.
sessions.release
End a session: canceled before ready, ended(released) after. The device returns warm, or is recycled when healthy is false. Releasing an ended session returns it unchanged.
| REST | POST /v1/sessions/release (input as a JSON body) |
| RPC | /rpc/v2/sessions/release |
| MCP | tool sessions_release; hints: idempotent |
| Auth | devices:acquire |
| Tenancy | project |
| Troupe Cloud | answered by the control plane |
| Stability | stable, since 1.0 |
Input:
{
sessionId: SessionId
healthy?: boolean // default true
reason?: Label
}Output:
SessionErrors: U, NOT_FOUND, SESSION_BUSY.
Named types: Label, Session, SessionId.
sessions.events
A session's events: status, app state, crashes, input state and stream readiness
| REST | GET /v1/sessions/events (input as query parameters) |
| RPC | /rpc/v2/sessions/events |
| MCP | not a tool (an event iterator; MCP tools return one result); hints: read-only, idempotent |
| Auth | devices:read |
| Tenancy | project |
| Troupe Cloud | answered by the control plane |
| Stability | stable, since 1.0 |
Input:
{ sessionId?: SessionId; since?: Seq }Output: an event iterator (text/event-stream on REST), each event:
SessionEventNamed types: Seq, SessionEvent, SessionId.