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", "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

AttributeTypeDescription
idstringUnique identifier (agent_*)
userIdstringOwner user ID
namestringHuman-readable agent name
modelstringModel identifier
instructionsstringSystem prompt / instructions
mcpServersarrayMCP server configurations
configobjectModel configuration
appIdstringAssociated application ID
metadataobjectCustom key-value metadata
createdAtstringISO 8601 timestamp
updatedAtstringISO 8601 timestamp

Supported Models

ModelDescriptionBest For
gpt-4oGPT-4 OptimizedGeneral tasks, coding
gpt-4o-miniFaster, cheaperQuick tasks
o1OpenAI o1Complex reasoning
o1-miniSmaller reasoningSimpler reasoning
o3-miniLatest miniBalanced performance

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

Request Body

ParameterTypeRequiredDescription
namestringYesAgent name
modelstringYesModel identifier
instructionsstringNoSystem prompt
mcpServersarrayNoMCP server configurations
configobjectNoModel configuration
appIdstringNoApplication ID
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": "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/: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": "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/:agentId

Request Body

ParameterTypeDescription
namestringNew agent name
modelstringNew model
instructionsstringNew instructions
mcpServersarrayUpdated MCP servers
configobjectUpdated config
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 '{ "model": "o1", "config": { "temperature": 0.3 } }'

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 }

Agent Configuration

Temperature

Controls randomness in responses:

ValueBehavior
0.0Most deterministic
0.5Balanced
1.0Most 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 endpoints

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


Errors

StatusErrorDescription
400Bad RequestInvalid model or config
404Not FoundAgent not found
422Validation ErrorInvalid instructions

Model Validation Error

{ "error": "Bad Request", "message": "Invalid model 'gpt-5'. Supported models: gpt-4o, gpt-4o-mini, o1, o1-mini, o3-mini" }

Last updated on