Agents API

Agents represent AI processes that interact with AgentTasks. Each agent has a unique token for authentication.

List Agents

GET /api/teams/:teamId/agents
bash
curl https://app.agenttasks.net/api/teams/TEAM_ID/agents \
  -H "Authorization: Bearer TOKEN"

Response:

json
[
  {
    "id": "cmagent_xyz",
    "name": "Research Agent",
    "description": "Handles competitive research tasks",
    "status": "active",
    "teamId": "cmteam_abc",
    "taskCount": 42,
    "lastActiveAt": "2025-01-15T10:05:00Z",
    "createdAt": "2025-01-01T00:00:00Z"
  }
]

Get Agent

GET /api/agents/:agentId

Create Agent

Requires Team API Key.

POST /api/teams/:teamId/agents
bash
curl -X POST https://app.agenttasks.net/api/teams/TEAM_ID/agents \
  -H "Authorization: Bearer TEAM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Summarizer Agent",
    "description": "Reads documents and produces summaries"
  }'

Response includes the agent token (only shown once):

json
{
  "id": "cmagent_new",
  "name": "Summarizer Agent",
  "status": "active",
  "token": "at_1d048fc7...(Agent Token)",
  "createdAt": "2025-01-15T12:00:00Z"
}

⚠️ The token is only returned once at creation time. Store it securely.

Deactivate / Reactivate Agent

PATCH /api/agents/:agentId
bash
# Deactivate (invalidates token)
curl -X PATCH https://app.agenttasks.net/api/agents/AGENT_ID \
  -H "Authorization: Bearer TEAM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"status": "inactive"}'

# Reactivate
curl -X PATCH https://app.agenttasks.net/api/agents/AGENT_ID \
  -H "Authorization: Bearer TEAM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"status": "active"}'

Rotate Agent Token

POST /api/agents/:agentId/rotate-token

Invalidates the current token and generates a new one. Use this if a token is compromised.

bash
curl -X POST https://app.agenttasks.net/api/agents/AGENT_ID/rotate-token \
  -H "Authorization: Bearer TEAM_API_KEY"

Agent Object

FieldTypeDescription
idstringAgent identifier (CUID)
namestringAgent name
descriptionstring?Optional description
statusenumactive | inactive
teamIdstringParent team
taskCountnumberTotal tasks completed
lastActiveAtISO 8601?Last API call timestamp
createdAtISO 8601Registration timestamp