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",
"model": "gpt-4o",
"instructions": "You are a helpful coding assistant. Write clean, well-documented code.",
"mcpServers": [
{
"type": "stdio",
"name": "filesystem",
"command": "npx",
"args": ["@modelcontextprotocol/server-filesystem", "/workspace"]
}
],
"config": {
"temperature": 0.7,
"maxTokens": 4096
},
"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 |
model | string | Model identifier |
instructions | string | System prompt / instructions |
mcpServers | array | MCP server configurations |
config | object | Model configuration |
appId | string | Associated application ID |
metadata | object | Custom key-value metadata |
createdAt | string | ISO 8601 timestamp |
updatedAt | string | ISO 8601 timestamp |
Supported Models
| Model | Description | Best For |
|---|---|---|
gpt-4o | GPT-4 Optimized | General tasks, coding |
gpt-4o-mini | Faster, cheaper | Quick tasks |
o1 | OpenAI o1 | Complex reasoning |
o1-mini | Smaller reasoning | Simpler reasoning |
o3-mini | Latest mini | Balanced performance |
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",
"model": "gpt-4o",
"createdAt": "2025-01-15T10:30:00.000Z"
},
{
"id": "agent_rQ6Ia3kxIsj6pWpDQJy82",
"name": "Code Reviewer",
"model": "gpt-4o-mini",
"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 |
model | string | Yes | Model identifier |
instructions | string | No | System prompt |
mcpServers | array | No | MCP server configurations |
config | object | No | Model configuration |
appId | string | No | Application ID |
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": "API Builder",
"model": "gpt-4o",
"instructions": "You are an expert API developer. Create RESTful APIs following best practices. Use clear naming conventions and include proper error handling.",
"config": {
"temperature": 0.5,
"maxTokens": 8192
}
}'Response
{
"agent": {
"id": "agent_sR7Jb4lyJtk7qXqERKz93",
"userId": "user_abc123",
"name": "API Builder",
"model": "gpt-4o",
"instructions": "You are an expert API developer...",
"mcpServers": [],
"config": {
"temperature": 0.5,
"maxTokens": 8192
},
"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": "API Builder",
"model": "gpt-4o",
"instructions": "You are an expert API developer...",
"mcpServers": [],
"config": {
"temperature": 0.5,
"maxTokens": 8192
},
"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 |
instructions | string | New instructions |
mcpServers | array | Updated MCP servers |
config | object | Updated config |
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 '{
"model": "o1",
"config": {
"temperature": 0.3
}
}'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
}Agent Configuration
Temperature
Controls randomness in responses:
| Value | Behavior |
|---|---|
0.0 | Most deterministic |
0.5 | Balanced |
1.0 | Most creative |
Max Tokens
Limits response length:
{
"config": {
"maxTokens": 4096
}
}Full Config Example
{
"config": {
"temperature": 0.7,
"maxTokens": 4096,
"topP": 0.9,
"frequencyPenalty": 0.0,
"presencePenalty": 0.0
}
}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"]
}
]
}HTTP Server
Remote HTTP-based MCP server:
{
"mcpServers": [
{
"type": "http",
"name": "notion",
"url": "https://notion-mcp.example.com/mcp",
"bearerToken": "your-token"
}
]
}Example with MCP Servers
curl -X POST https://api.computer-agents.com/v1/agents \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Full-Stack Assistant",
"model": "gpt-4o",
"instructions": "You are a full-stack developer with access to filesystem tools.",
"mcpServers": [
{
"type": "stdio",
"name": "filesystem",
"command": "npx",
"args": ["@modelcontextprotocol/server-filesystem", "/workspace"]
}
]
}'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
- Include rate limiting for public endpointsGood instructions are specific, actionable, and include examples of expected behavior.
Errors
| Status | Error | Description |
|---|---|---|
| 400 | Bad Request | Invalid model or config |
| 404 | Not Found | Agent not found |
| 422 | Validation Error | Invalid instructions |
Model Validation Error
{
"error": "Bad Request",
"message": "Invalid model 'gpt-5'. Supported models: gpt-4o, gpt-4o-mini, o1, o1-mini, o3-mini"
}Related
- Threads - Use agents in conversations
- Environments - Configure execution context
- Streaming - Real-time agent responses
Last updated on