Computer Agents API
The Computer Agents API is a REST API for building, deploying, and managing AI-powered agents that can write code, execute commands, and manage files in isolated cloud environments.
Base URL
https://api.computer-agents.com/v1All endpoints use the /v1 prefix. The API follows REST conventions with JSON request/response bodies.
Quick Start
Create a thread and execute a task in a single request:
curl -X POST https://api.computer-agents.com/v1/threads \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"messages": [{ "role": "user", "content": "Create a hello.py file" }],
"stream": true
}'This returns a Server-Sent Events stream with real-time progress and results.
API Resources
Conversation contexts with multi-turn agent interactions
ThreadsLLM configurations with custom instructions and models
AgentsExecution contexts with variables, secrets, and MCP servers
EnvironmentsFile upload, download, and management operations
FilesOne-time and recurring task automation
SchedulesBudget management, cost tracking, and usage analytics
BillingCore Concepts
User-Scoped Architecture
All resources belong to the authenticated user. No project IDs in URLs - your API key determines resource ownership.
GET /v1/threads # Your threads
GET /v1/agents # Your agents
GET /v1/environments # Your environmentsThreads (Unified API)
Threads are the primary interface for agent interactions. The API intelligently determines behavior based on what you provide:
| Request | Behavior |
|---|---|
| Messages only | Execute immediately (SSE stream) |
| Messages + schedule | Create scheduled task |
| No messages | Create empty thread |
Environments
Environments define how agents execute. Configure once, use across all threads:
- Environment variables and secrets
- MCP servers for external tools
- Setup scripts
- Network access controls
Files
Each environment has an isolated workspace for files:
- Upload, download, and delete files
- Create directories
- Bulk upload support
- Backed by Google Cloud Storage
Agents
Agents define LLM behavior. Customize model, instructions, and capabilities:
- Model selection (GPT-4, etc.)
- System instructions
- Reasoning effort level
- Enabled skills
Response Format
List Endpoints
All list endpoints return a standardized format:
{
"object": "list",
"data": [...],
"has_more": false,
"total_count": 42
}Single Resources
Single resource responses wrap the resource:
{
"thread": {
"id": "thread_xxx",
"status": "active",
...
}
}Errors
Error responses include type and message:
{
"error": "Bad Request",
"message": "Missing required field: content"
}Authentication
Include your API key in every request:
# Bearer token (recommended)
Authorization: Bearer tb_xxxxxxxxxxxx
# Or X-API-Key header
X-API-Key: tb_xxxxxxxxxxxxRate Limits
| Limit | Value |
|---|---|
| Global | 1,000 requests / 15 minutes |
| Execution | Subject to budget balance |
Budget System
Each user has a budget with:
- Starting balance: $10.00
- Daily/monthly limits: Configurable
Budget is checked before execution. HTTP 402 returned when exhausted.
SDKs
TypeScript/JavaScript
npm install computer-agentsimport { ComputerAgentsClient } from 'computer-agents';
const client = new ComputerAgentsClient({
apiKey: process.env.COMPUTER_AGENTS_API_KEY
});
const result = await client.run('Create a REST API', {
environmentId: 'env_xxx',
onEvent: (event) => console.log(event.type)
});
console.log(result.content);