Skip to Content
APIAgents API

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

AttributeTypeDescription
idstringUnique identifier (agent_*)
userIdstringOwner user ID
namestringHuman-readable agent name
agentTypestringAgent type: computer
instructionsstringSystem prompt / instructions
mcpServersarrayMCP server configurations
executionobjectExecution configuration
handoffsarraySub-agents for delegation
metadataobjectCustom key-value metadata
createdAtstringISO 8601 timestamp
updatedAtstringISO 8601 timestamp

Agent Capabilities

Computer agents have full access to a development environment:

CapabilityDescription
Code executionRun code in any language (Python, Node.js, Go, etc.)
File operationsCreate, read, edit, and delete files
Terminal commandsRun git, npm, pip, docker, and any CLI tool
Package managementInstall dependencies and configure environments
Code analysisRead and understand existing codebases

List Agents

GET /v1/agents

Query Parameters

ParameterTypeDefaultDescription
appIdstring-Filter by application
limitnumber50Max results (1-100)
offsetnumber0Pagination offset

Example

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/agents

Request Body

ParameterTypeRequiredDescription
namestringYesAgent name
instructionsstringNoSystem prompt / instructions
mcpServersarrayNoMCP server configurations
executionobjectNoExecution settings
handoffsarrayNoSub-agents for delegation
metadataobjectNoCustom 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/:agentId

Example

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/:agentId

Request Body

ParameterTypeDescription
namestringNew agent name
instructionsstringNew instructions
mcpServersarrayUpdated MCP servers
executionobjectUpdated execution settings
metadataobjectUpdated 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/:agentId

Existing 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 } }
ParameterTypeDefaultDescription
debugbooleanfalseEnable debug logging
timeoutnumber600000Execution 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"] } ] }
ParameterTypeRequiredDescription
typestringYesMust be stdio
namestringYesUnique server name
commandstringYesCommand to execute
argsarrayNoCommand arguments
envobjectNoEnvironment variables
cwdstringNoWorking directory
allowedToolsarrayNoFilter 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": {} } ] }
ParameterTypeRequiredDescription
typestringYesMust be http
namestringYesUnique server name
urlstringYesMCP endpoint URL
bearerTokenstringNoBearer token for auth
headersobjectNoAdditional headers
allowedToolsarrayNoFilter 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 examples

Good instructions are specific, actionable, and include examples of expected behavior.


Errors

StatusErrorDescription
400Bad RequestInvalid configuration
404Not FoundAgent not found
422Validation ErrorInvalid instructions or parameters

Missing Required Fields

{ "error": "Validation Error", "message": "Agent name is required" }

Invalid Configuration

{ "error": "Bad Request", "message": "Invalid MCP server configuration" }

Last updated on