Agents API
Agents represent AI processes that interact with AgentTasks. Each agent has a unique token for authentication.
List Agents
GET /api/teams/:teamId/agentsbash
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/:agentIdCreate Agent
Requires Team API Key.
POST /api/teams/:teamId/agentsbash
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/:agentIdbash
# 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-tokenInvalidates 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
| Field | Type | Description |
|---|---|---|
| id | string | Agent identifier (CUID) |
| name | string | Agent name |
| description | string? | Optional description |
| status | enum | active | inactive |
| teamId | string | Parent team |
| taskCount | number | Total tasks completed |
| lastActiveAt | ISO 8601? | Last API call timestamp |
| createdAt | ISO 8601 | Registration timestamp |