Skip to main content

PTY

POST 

/workstations/:workstation_id/sandbox/pty

Connect to a Workstation's PTY (Pseudo Terminal). This endpoint returns a WebSocket URL that can be used to establish a PTY connection with the Workstation.

Example Usage

const id = 'HvcqZjmeoPtP';
const url = `https://api.agentstation.ai/v1/workstations/${id}/sandbox/pty`;
const response = await fetch(url, {
method: 'POST',
headers: {
'Authorization': 'Bearer <your_token>'
}
});
const conn = await response.json();
// conn.url example: wss://connect.agentstation.ai/v1/pty/cxBMzXSFUSXf

// Initialize PTY connection
const ws = new WebSocket(conn.url);

// Handle connection events
ws.onopen = () => console.log('Connected to PTY');
ws.onclose = () => console.log('Disconnected from PTY');

Notes

  • The WebSocket connection will be automatically closed after the Workstation is released
  • The URL contains a secure random token that authenticates the connection
  • Default PTY settings:
    • Shell: /bin/bash
    • Environment: None

Request

Responses

Remote connection successful