Agents API
Agents are configurable AI entities that execute tasks within threads. Each agent has a model, system instructions, and optional MCP server configurations.
The Agent Object
{
"id": "agent_qP5Hz2jwHsj5oVoCPIx71",
"userId": "user_abc123",
"name": "Code Assistant",
"agentType": "computer",
"instructions": "You are a helpful coding assistant. Write clean, well-documented code.",
"mcpServers": [
{
"type": "stdio",
"name": "filesystem",
"command": "npx",
"args": ["@modelcontextprotocol/server-filesystem", "/workspace"]
}
],
"execution": {
"debug": false,
"timeout": 600000
},
"createdAt": "2025-01-15T10:30:00.000Z",
"updatedAt": "2025-01-15T14:22:00.000Z"
}Attributes
| Attribute | Type | Description |
|---|---|---|
id | string | Unique identifier (agent_*) |
userId | string | Owner user ID |
name | string | Human-readable agent name |
agentType | string | Agent type: computer |
instructions | string | System prompt / instructions |
mcpServers | array | MCP server configurations |
execution | object | Execution configuration |
handoffs | array | Sub-agents for delegation |
metadata | object | Custom key-value metadata |
createdAt | string | ISO 8601 timestamp |
updatedAt | string | ISO 8601 timestamp |
Agent Capabilities
Computer agents have full access to a development environment:
| Capability | Description |
|---|---|
| Code execution | Run code in any language (Python, Node.js, Go, etc.) |
| File operations | Create, read, edit, and delete files |
| Terminal commands | Run git, npm, pip, docker, and any CLI tool |
| Package management | Install dependencies and configure environments |
| Code analysis | Read and understand existing codebases |
List Agents
GET /v1/agentsQuery Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
appId | string | - | Filter by application |
limit | number | 50 | Max results (1-100) |
offset | number | 0 | Pagination offset |
Example
cURL
curl https://api.computer-agents.com/v1/agents \
-H "Authorization: Bearer $API_KEY"Response
{
"object": "list",
"data": [
{
"id": "agent_qP5Hz2jwHsj5oVoCPIx71",
"name": "Code Assistant",
"agentType": "computer",
"createdAt": "2025-01-15T10:30:00.000Z"
},
{
"id": "agent_rQ6Ia3kxIsj6pWpDQJy82",
"name": "Backend Developer",
"agentType": "computer",
"createdAt": "2025-01-10T08:00:00.000Z"
}
],
"has_more": false,
"total_count": 2
}Create Agent
POST /v1/agentsRequest Body
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Agent name |
instructions | string | No | System prompt / instructions |
mcpServers | array | No | MCP server configurations |
execution | object | No | Execution settings |
handoffs | array | No | Sub-agents for delegation |
metadata | object | No | Custom metadata |
Example
curl -X POST https://api.computer-agents.com/v1/agents \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Code Assistant",
"instructions": "You are an expert developer. Write clean, well-documented code with proper error handling.",
"execution": {
"debug": true,
"timeout": 300000
}
}'Response
{
"agent": {
"id": "agent_sR7Jb4lyJtk7qXqERKz93",
"userId": "user_abc123",
"name": "Code Assistant",
"agentType": "computer",
"instructions": "You are an expert developer...",
"mcpServers": [],
"createdAt": "2025-01-20T12:00:00.000Z"
}
}Get Agent
GET /v1/agents/:agentIdExample
curl https://api.computer-agents.com/v1/agents/agent_xyz789 \
-H "Authorization: Bearer $API_KEY"Response
{
"agent": {
"id": "agent_xyz789",
"userId": "user_abc123",
"name": "Code Assistant",
"agentType": "computer",
"instructions": "You are an expert developer...",
"mcpServers": [],
"createdAt": "2025-01-20T12:00:00.000Z"
}
}Update Agent
PATCH /v1/agents/:agentIdRequest Body
| Parameter | Type | Description |
|---|---|---|
name | string | New agent name |
instructions | string | New instructions |
mcpServers | array | Updated MCP servers |
execution | object | Updated execution settings |
metadata | object | Updated metadata |
Example
curl -X PATCH https://api.computer-agents.com/v1/agents/agent_xyz789 \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"instructions": "You are a senior software architect with 10 years of experience..."
}'Delete Agent
DELETE /v1/agents/:agentIdExisting threads using this agent will continue to work but won’t use the agent’s configuration for new messages.
Example
curl -X DELETE https://api.computer-agents.com/v1/agents/agent_xyz789 \
-H "Authorization: Bearer $API_KEY"Response
{
"success": true
}Execution Configuration
Configure how agents execute tasks:
{
"execution": {
"debug": false,
"timeout": 600000
}
}| Parameter | Type | Default | Description |
|---|---|---|---|
debug | boolean | false | Enable debug logging |
timeout | number | 600000 | Execution timeout in ms (10 min default) |
MCP Server Configuration
Agents can use MCP (Model Context Protocol) servers to extend their capabilities:
Stdio Server
Local process-based MCP server:
{
"mcpServers": [
{
"type": "stdio",
"name": "filesystem",
"command": "npx",
"args": ["@modelcontextprotocol/server-filesystem", "/workspace"],
"env": {},
"allowedTools": ["read_file", "write_file"]
}
]
}| Parameter | Type | Required | Description |
|---|---|---|---|
type | string | Yes | Must be stdio |
name | string | Yes | Unique server name |
command | string | Yes | Command to execute |
args | array | No | Command arguments |
env | object | No | Environment variables |
cwd | string | No | Working directory |
allowedTools | array | No | Filter available tools |
HTTP Server
Remote HTTP-based MCP server:
{
"mcpServers": [
{
"type": "http",
"name": "notion",
"url": "https://notion-mcp.example.com/mcp",
"bearerToken": "your-token",
"headers": {}
}
]
}| Parameter | Type | Required | Description |
|---|---|---|---|
type | string | Yes | Must be http |
name | string | Yes | Unique server name |
url | string | Yes | MCP endpoint URL |
bearerToken | string | No | Bearer token for auth |
headers | object | No | Additional headers |
allowedTools | array | No | Filter available tools |
Multi-Agent Handoffs
Agents can delegate tasks to other agents using handoffs:
curl -X POST https://api.computer-agents.com/v1/agents \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Lead Developer",
"instructions": "Coordinate development tasks. Delegate frontend work to the Frontend agent and backend work to the Backend agent.",
"handoffs": ["agent_frontend_id", "agent_backend_id"]
}'Use handoffs to create multi-agent workflows where agents can delegate specialized tasks to other agents.
Writing Effective Instructions
Write clear, specific instructions:
You are a Python backend developer specializing in FastAPI.
Guidelines:
- Follow PEP 8 style guidelines
- Use type hints for all function parameters and return values
- Include docstrings for all public functions
- Write unit tests for new functionality
- Use async/await for I/O operations
When creating APIs:
- Use Pydantic models for request/response validation
- Implement proper error handling with HTTPException
- Add OpenAPI documentation with examplesGood instructions are specific, actionable, and include examples of expected behavior.
Errors
| Status | Error | Description |
|---|---|---|
| 400 | Bad Request | Invalid configuration |
| 404 | Not Found | Agent not found |
| 422 | Validation Error | Invalid instructions or parameters |
Missing Required Fields
{
"error": "Validation Error",
"message": "Agent name is required"
}Invalid Configuration
{
"error": "Bad Request",
"message": "Invalid MCP server configuration"
}Related
- Threads - Use agents in conversations
- Environments - Configure execution context
- Streaming - Real-time agent responses