Agents API
Create and manage AI agents with persistent memory
POST
/api/v1/agentsCreate a new AI agent with a specific role and personality. Each agent gets its own memory space and can be part of a team.
Authentication
Requires API key in Authorization header:
Authorization: Bearer YOUR_API_KEYRequest Body
{
"name": "Research Assistant",
"role": "researcher",
"personality": "Analytical and detail-oriented",
"projectId": "proj_123", // Optional
"teamId": "team_456" // Optional
}Parameters
| Field | Type | Required | Description |
|---|---|---|---|
| name | string | Yes | Display name for the agent |
| role | string | Yes | Agent's role or type (e.g., researcher, writer) |
| personality | string | No | Personality traits and behavior description |
| projectId | string | No | Project to associate agent with (defaults to "Default") |
| teamId | string | No | Team ID if agent belongs to a team |
Response
{
"agent": {
"id": "agent_abc123",
"project_id": "proj_123",
"owner_clerk_id": "user_xyz789",
"name": "Research Assistant",
"agent_type": "researcher",
"team_id": "team_456",
"config": {
"role": "researcher",
"personality": "Analytical and detail-oriented"
},
"created_at": "2024-11-22T10:30:00Z",
"updated_at": "2024-11-22T10:30:00Z"
}
}Example Request
curl -X POST https://your-domain.com/api/v1/agents \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Research Assistant",
"role": "researcher",
"personality": "Analytical and detail-oriented"
}'GET
/api/v1/agentsList all agents owned by the authenticated user, ordered by creation date (newest first).
Response
{
"agents": [
{
"id": "agent_abc123",
"project_id": "proj_123",
"owner_clerk_id": "user_xyz789",
"name": "Research Assistant",
"agent_type": "researcher",
"team_id": "team_456",
"config": {
"role": "researcher",
"personality": "Analytical and detail-oriented"
},
"created_at": "2024-11-22T10:30:00Z",
"updated_at": "2024-11-22T10:30:00Z"
},
{
"id": "agent_def456",
"project_id": "proj_123",
"owner_clerk_id": "user_xyz789",
"name": "Content Writer",
"agent_type": "writer",
"team_id": null,
"config": {
"role": "writer",
"personality": "Creative and engaging"
},
"created_at": "2024-11-21T15:20:00Z",
"updated_at": "2024-11-21T15:20:00Z"
}
]
}Example Request
curl -X GET https://your-domain.com/api/v1/agents \
-H "Authorization: Bearer YOUR_API_KEY"GET
/api/v1/agents/:idRetrieve a specific agent by ID. Only returns agents owned by the authenticated user.
Path Parameters
| Parameter | Type | Description |
|---|---|---|
| id | string | Agent ID |
Response
{
"agent": {
"id": "agent_abc123",
"project_id": "proj_123",
"owner_clerk_id": "user_xyz789",
"name": "Research Assistant",
"agent_type": "researcher",
"team_id": "team_456",
"config": {
"role": "researcher",
"personality": "Analytical and detail-oriented"
},
"created_at": "2024-11-22T10:30:00Z",
"updated_at": "2024-11-22T10:30:00Z"
}
}Example Request
curl -X GET https://your-domain.com/api/v1/agents/agent_abc123 \
-H "Authorization: Bearer YOUR_API_KEY"DELETE
/api/v1/agents/:idDelete an agent and all associated data. This action cannot be undone.
Path Parameters
| Parameter | Type | Description |
|---|---|---|
| id | string | Agent ID to delete |
Response
{
"success": true
}Example Request
curl -X DELETE https://your-domain.com/api/v1/agents/agent_abc123 \
-H "Authorization: Bearer YOUR_API_KEY"Agent Memory Integration
Each agent has its own isolated memory space. When creating memories for an agent:
- • Include the
agent_idfield when creating memories - • Agent memories are automatically scoped to that agent
- • Use the Memories API with
agent_idfilter to retrieve agent-specific memories - • Agents in teams can share team-level memories via
team_id
See the Memories API documentation for details on memory management.
Error Responses
401 Unauthorized
{
"error": "Unauthorized"
}404 Not Found
{
"error": "Agent not found"
}400 Bad Request
{
"error": "Name and role are required"
}500 Internal Server Error
{
"error": "Internal server error"
}