Skip to main content

Workspace Runtime API

The Workspace Runtime API exposes per-workspace agent execution, file operations, OpenSpec workflow state, and real-time streaming capabilities. Today, the Claude Code-related APIs are the most complete, but the overall surface is expanding toward a broader multi-agent runtime model.

Interactive Documentation

note

Each workspace has its own Runtime instance; the port depends on the container configuration. localhost:3002 is the default for local development.

Base URL

http://localhost:3002

Main Endpoints

Health Check

GET /health

File Management

MethodPathDescription
GET/api/v1/filesList directory contents
GET/api/v1/files/{path}Read file contents
PUT/api/v1/files/{path}Write to a file
DELETE/api/v1/files/{path}Delete a file
POST/api/v1/files/uploadUpload a file

Claude Code Settings

These settings APIs primarily serve Claude Code today. Equivalent settings coverage for other agents will be expanded over time.

MethodPathDescription
GET/api/v1/settingsGet Claude Code settings
PUT/api/v1/settingsUpdate Claude Code settings
GET/api/v1/settings/hooksGet hook settings
PUT/api/v1/settings/hooksUpdate hook settings
GET/api/v1/settings/mcpGet MCP settings
PUT/api/v1/settings/mcpUpdate MCP settings

Agent Session

MethodPathDescription
POST/api/v1/agent-sessionsCreate an agent session
GET/api/v1/agent-sessionsList sessions
GET/api/v1/agent-sessions/{id}Get session details
DELETE/api/v1/agent-sessions/{id}Terminate a session

OpenSpec

MethodPathDescription
GET/api/v1/workspaces/{workspace_id}/openspecGet OpenSpec workspace state and available workflow actions

Version Control (Git)

MethodPathDescription
GET/api/v1/workspaces/{id}/version-control/statusGit status
GET/api/v1/workspaces/{id}/version-control/logGit log
POST/api/v1/workspaces/{id}/version-control/commitCommit
POST/api/v1/workspaces/{id}/version-control/pushPush
POST/api/v1/workspaces/{id}/version-control/pullPull
GET/api/v1/workspaces/{id}/version-control/branchesList branches
POST/api/v1/workspaces/{id}/version-control/checkoutSwitch branches

WebSocket

EndpointDescription
WS /api/v1/wsGeneral WebSocket (file changes, system stats)
WS /api/v1/ws/agent-sessions/{id}Agent session streaming output

Agent Session WebSocket Message Format

// Incoming message
interface AgentMessage {
type: 'thinking' | 'tool_use' | 'tool_result' | 'text' | 'done' | 'error';
content?: string;
tool?: string;
input?: Record<string, unknown>;
output?: string;
error?: string;
}

General WebSocket Events

// File change event
interface FileChangedEvent {
type: 'file_changed';
path: string;
event_type: 'created' | 'modified' | 'deleted';
}

// System stats event
interface SystemStatsEvent {
type: 'system_stats';
stats: {
cpu_percent: number;
memory_percent: number;
disk_percent: number;
};
}

Script Management

MethodPathDescription
GET/api/v1/scriptsList available scripts
POST/api/v1/scripts/{name}/runRun a script