Agents API
Base path: /api/agents
GET /api/agents
List all agents.
Response 200:
[ { "id": "agent_abc", "name": "Ticket Analyst", "description": "Analyzes and summarizes ConnectWise service tickets", "model": "claude-sonnet-4-6", "systemPrompt": "You are a ConnectWise PSA assistant...", "mcpServerIds": ["mcp_builtin"], "status": "active", "createdAt": "2024-01-15T10:00:00.000Z" }]GET /api/agents/:id
Get a single agent.
POST /api/agents
Create an agent.
Request body:
{ "name": "Ticket Analyst", "description": "Analyzes service tickets", "model": "claude-sonnet-4-6", "systemPrompt": "You are a helpful ConnectWise PSA assistant. Use the available tools to look up ticket information and provide clear, concise summaries.", "mcpServerIds": ["mcp_builtin"], "status": "active"}| Field | Type | Required | Default |
|---|---|---|---|
name |
string | Yes | — |
model |
string | No | "claude-sonnet-4-6" |
systemPrompt |
string | No | "" |
mcpServerIds |
string[] | No | [] |
status |
"active" | "disabled" |
No | "active" |
PUT /api/agents/:id
Update an agent.
DELETE /api/agents/:id
Delete an agent.
POST /api/agents/:id/run
Run an agent with a message.
Request body:
{ "message": "How many open tickets does Acme Corp have?"}Response 200:
{ "result": "Acme Corp currently has 3 open service tickets:\n1. #12345 - Server outage (Priority: Critical)\n2. #12346 - VPN connectivity issues (Priority: High)\n3. #12348 - Email slow (Priority: Medium)", "toolCalls": [ { "tool": "connectwise_psa_get_tickets", "input": { "company": "Acme Corp", "status": "open", "limit": 50 }, "result": "[{\"id\":12345,\"summary\":\"Server outage\",...}]" } ], "iterations": 2}| Response field | Description |
|---|---|
result |
Final text response from Claude |
toolCalls |
Array of all tool calls made during the run |
iterations |
Number of Claude→tools→Claude loops completed |
Error cases
Agent disabled:
{ "error": "Agent is disabled" }No Anthropic key:
{ "error": "ANTHROPIC_API_KEY not configured" }Max iterations hit (10): The last Claude response is returned even if tool calls were still being made. This prevents infinite loops.