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": "llm",
"model": "gpt-5.1",
"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: llm or computer |
model | string | Model identifier (for LLM agents) |
workspace | string | Workspace path (for computer agents) |
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 Types
| Type | Description | Use Case |
|---|---|---|
llm | LLM-based agent using OpenAI API | Reasoning, planning, reviewing, chat |
computer | Computer-use agent via Codex SDK | Code changes, file operations, terminal commands |
Agent type is auto-inferred: providing model infers llm, providing workspace infers computer.
Supported Models
| Model | Description | Best For |
|---|---|---|
gpt-5.2 | Most advanced model (recommended) | Complex reasoning, advanced coding |
gpt-5.1 | High-performance model | General tasks, coding, analysis |
gpt-5.1-codex | Latest Codex model | Code generation, code editing |
gpt-5-codex | Optimized for computer use | Code generation, file operations |
gpt-5 | Balanced general-purpose | Conversations, content generation |
gpt-5-mini | Fast and cost-effective | Quick tasks, simple queries |
gpt-5-nano | Ultra-efficient | Basic tasks, rapid responses |
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": "llm",
"model": "gpt-5.1",
"createdAt": "2025-01-15T10:30:00.000Z"
},
{
"id": "agent_rQ6Ia3kxIsj6pWpDQJy82",
"name": "Code Executor",
"agentType": "computer",
"workspace": "/projects/my-app",
"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 |
agentType | string | No | llm or computer (auto-inferred) |
model | string | No* | Model identifier (required for LLM agents) |
workspace | string | No* | Workspace path (required for computer agents) |
instructions | string | No | System prompt |
mcpServers | array | No | MCP server configurations |
execution | object | No | Execution settings |
handoffs | array | No | Sub-agents for delegation |
metadata | object | No | Custom metadata |
Either model or workspace must be provided. The agent type is inferred from which one you specify.
Example: LLM Agent
curl -X POST https://api.computer-agents.com/v1/agents \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Code Planner",
"model": "gpt-5.1",
"instructions": "You are an expert software architect. Create detailed implementation plans with file structures, function signatures, and testing considerations."
}'Example: Computer Agent
curl -X POST https://api.computer-agents.com/v1/agents \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Code Executor",
"workspace": "/projects/my-app",
"instructions": "You are a developer. Execute code changes as requested. Write clean, well-documented code.",
"execution": {
"debug": true,
"timeout": 300000
}
}'Response
{
"agent": {
"id": "agent_sR7Jb4lyJtk7qXqERKz93",
"userId": "user_abc123",
"name": "Code Planner",
"agentType": "llm",
"model": "gpt-5.1",
"instructions": "You are an expert software architect...",
"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 Planner",
"agentType": "llm",
"model": "gpt-5.1",
"instructions": "You are an expert software architect...",
"mcpServers": [],
"createdAt": "2025-01-20T12:00:00.000Z"
}
}Update Agent
PATCH /v1/agents/:agentIdRequest Body
| Parameter | Type | Description |
|---|---|---|
name | string | New agent name |
model | string | New model (LLM agents only) |
workspace | string | New workspace (computer agents only) |
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": "Planner",
"model": "gpt-5.1",
"instructions": "Create implementation plans. Delegate execution to the Executor agent.",
"handoffs": ["agent_executor_id"]
}'Use handoffs to create multi-agent workflows where a planner agent creates plans and an executor agent implements them.
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 model or configuration |
| 404 | Not Found | Agent not found |
| 422 | Validation Error | Invalid instructions or parameters |
Model Validation Error
{
"error": "Bad Request",
"message": "Invalid model 'invalid-model'. Supported models: gpt-5.2, gpt-5.1, gpt-5.1-codex, gpt-5-codex, gpt-5, gpt-5-mini, gpt-5-nano"
}Missing Required Fields
{
"error": "Validation Error",
"message": "Either 'model' or 'workspace' must be provided"
}Related
- Threads - Use agents in conversations
- Environments - Configure execution context
- Streaming - Real-time agent responses