Skip to Content
APIAPI Reference

Computer Agents API

The REST API for building agentic applications. Claude Code execution power, persistent workspaces, and built-in skills—all through simple HTTP endpoints.

Base URL

https://api.computer-agents.com/v1

All endpoints use the /v1 prefix. The API follows REST conventions with JSON request/response bodies.

Quick Start

Execute a task in 3 lines:

curl -X POST https://api.computer-agents.com/v1/threads \ -H "Authorization: Bearer $API_KEY" \ -H "Content-Type: application/json" \ -d '{ "environmentId": "env_xxx", "messages": [{ "role": "user", "content": "Create a Flask API and run it" }], "stream": true }'

This streams real-time events as the agent writes code, creates files, and executes—all in an isolated cloud container.

Three Primitives

The API is organized around three core primitives:

Agents — The Brain

Configure how your AI thinks and behaves.

curl -X POST https://api.computer-agents.com/v1/agents \ -H "Authorization: Bearer $API_KEY" \ -H "Content-Type: application/json" \ -d '{ "name": "Code Assistant", "model": "claude-sonnet-4-5", "instructions": "You are a senior engineer. Write clean code.", "enabledSkills": ["web_search", "deep_research"] }'

View Agents API →

Environments — The Computer

Isolated containers with persistent file storage.

curl -X POST https://api.computer-agents.com/v1/environments \ -H "Authorization: Bearer $API_KEY" \ -H "Content-Type: application/json" \ -d '{ "name": "my-project", "runtimes": ["python", "nodejs"], "packages": ["flask", "pytest"] }'

View Environments API →

Skills — The Tools

Built-in capabilities and MCP server integration configured on agents and environments.

  • Web Search — Search the web for information
  • Deep Research — Multi-step research with citations
  • Image Generation — Create images on demand
  • MCP Servers — Connect any MCP-compatible tool

API Resources

Threads — The Workflow Engine

Threads are where the magic happens. They combine an agent with an environment to execute tasks:

# Create a thread curl -X POST https://api.computer-agents.com/v1/threads \ -H "Authorization: Bearer $API_KEY" \ -d '{ "environmentId": "env_xxx", "agentId": "agent_xxx" }' # Send a message (streams execution events) curl -X POST https://api.computer-agents.com/v1/threads/thread_xxx/messages \ -H "Authorization: Bearer $API_KEY" \ -d '{ "content": "Create a user authentication system", "stream": true }' # Continue the conversation (files and context persist) curl -X POST https://api.computer-agents.com/v1/threads/thread_xxx/messages \ -H "Authorization: Bearer $API_KEY" \ -d '{ "content": "Add password reset functionality" }'

View Threads API →

Streaming

All execution endpoints support Server-Sent Events for real-time progress:

event: response.started data: {"type": "response.started"} event: response.item.created data: {"type": "response.item.created", "item": {"type": "tool_use", "name": "write_file"}} event: response.item.completed data: {"type": "response.item.completed", "item": {"type": "tool_use", "name": "write_file"}} event: stream.completed data: {"type": "stream.completed", "run": {"tokens": 1234}}

View Streaming Guide →

Authentication

Include your API key in every request:

# Bearer token (recommended) Authorization: Bearer tb_xxxxxxxxxxxx # Or X-API-Key header X-API-Key: tb_xxxxxxxxxxxx

View Authentication Guide →

Response Format

Success

{ "thread": { "id": "thread_xxx", "status": "active", "environmentId": "env_xxx", "agentId": "agent_xxx" } }

Errors

{ "error": "Bad Request", "message": "Missing required field: environmentId" }

View Error Reference →

Rate Limits

LimitValue
Global1,000 requests / 15 minutes
ExecutionSubject to subscription tier

TypeScript SDK

For a better developer experience, use the official SDK:

npm install computer-agents
import { ComputerAgentsClient } from 'computer-agents'; const client = new ComputerAgentsClient({ apiKey: process.env.COMPUTER_AGENTS_API_KEY }); const result = await client.run('Create a Flask API and run it', { environmentId: 'env_xxx', onEvent: (event) => console.log(event.type) });

View SDK Guide →

Last updated on