Skip to main content

Agents API

The Agents API provides comprehensive management of AI agents and agent groups. Agents can be configured with specific skills, memories, and behaviors, and organized into groups for coordinated operations. The system supports full CRUD operations, skill assignment, group management, and advanced features like skill sharing and memory management.

Authentication

All agents endpoints require authentication with API key:

Rate Limits

Agent Management

Create Agent

Create a new AI agent with configuration. Endpoint: POST /agents Request Body:
Parameters:
  • name (string, required): Agent name
  • description (string, optional): Agent description
  • model (string, required): LLM model to use
  • config (object, optional): Agent configuration
    • temperature (float): Response randomness
    • max_tokens (integer): Maximum response length
    • system_prompt (string): System prompt
  • skills (array, optional): Assigned skill IDs
  • memory_settings (object, optional): Memory configuration
    • enabled (boolean): Enable memory
    • retention_days (integer): Memory retention period
    • compression_enabled (boolean): Enable compression
  • metadata (object, optional): Additional metadata
Response:
Example:

List Agents

Retrieve all agents with optional filtering. Endpoint: GET /agents Query Parameters:
  • status (string): Filter by status (active, inactive, paused)
  • department (string): Filter by department
  • model (string): Filter by model
  • limit (integer, default: 20, max: 100): Results per page
  • offset (integer, default: 0): Pagination offset
  • sort (string, default: “created_at desc”): Sort field and direction
Response:
Example:

Get Agent

Retrieve a specific agent by ID. Endpoint: GET /agents/{id} Response:

Update Agent

Update an existing agent configuration. Endpoint: PUT /agents/{id} Request Body:

Delete Agent

Permanently delete an agent. Endpoint: DELETE /agents/{id} Response:

Agent Skills Management

Assign Skills to Agent

Assign skills to an agent. Endpoint: POST /agents/{id}/skills Request Body:
Parameters:
  • skill_ids (array, required): Skill IDs to assign
  • replace_existing (boolean, default: false): Replace existing skills or add to them
Response:

Remove Skills from Agent

Remove skills from an agent. Endpoint: DELETE /agents/{id}/skills Request Body:

Get Agent Skills

Retrieve skills assigned to an agent. Endpoint: GET /agents/{id}/skills Response:

Agent Memory Management

Share Memory to Agent

Share a memory with an agent. Endpoint: POST /agents/{id}/memories Request Body:
Parameters:
  • memory_id (string, required): Memory ID to share
  • access_type (string, required): Access type (read, read_write)
  • expires_at (string, optional): Expiration time
Response:

Get Agent Memories

Retrieve memories shared with an agent. Endpoint: GET /agents/{id}/memories Query Parameters:
  • access_type (string): Filter by access type
  • limit (integer, default: 20, max: 100): Results per page
  • offset (integer, default: 0): Pagination offset
Response:

Remove Memory from Agent

Remove shared memory from an agent. Endpoint: DELETE /agents/{id}/memories/{memoryId}

Agent Group Management

Create Agent Group

Create a group of agents for coordinated operations. Endpoint: POST /groups Request Body:
Parameters:
  • name (string, required): Group name
  • description (string, optional): Group description
  • config (object, optional): Group configuration
    • load_balancing (string): Load balancing strategy
    • fallback_enabled (boolean): Enable fallback agents
    • timeout_ms (integer): Request timeout
  • skills (array, optional): Group skills
  • metadata (object, optional): Additional metadata
Response:

List Groups

Retrieve all agent groups. Endpoint: GET /groups Query Parameters:
  • department (string): Filter by department
  • limit (integer, default: 20, max: 100): Results per page
  • offset (integer, default: 0): Pagination offset
Response:

Get Group

Retrieve a specific group by ID. Endpoint: GET /groups/{id} Response:

Update Group

Update an existing group configuration. Endpoint: PUT /groups/{id}

Delete Group

Permanently delete a group. Endpoint: DELETE /groups/{id}

Group Member Management

Add Agent to Group

Add an agent to a group. Endpoint: POST /groups/{id}/members Request Body:
Parameters:
  • agent_id (string, required): Agent ID to add
  • role (string, optional): Member role (primary, secondary, fallback)
Response:

Remove Agent from Group

Remove an agent from a group. Endpoint: DELETE /groups/{id}/members/{agentId} Response:

Get Group Skills

Retrieve skills assigned to a group. Endpoint: GET /groups/{id}/skills

Get Group Memories

Retrieve memories shared with a group. Endpoint: GET /groups/{id}/memories

Agent Analytics

Get Agent Statistics

Retrieve comprehensive statistics for an agent. Endpoint: GET /agents/{id}/stats Response:

Get Group Statistics

Retrieve comprehensive statistics for a group. Endpoint: GET /groups/{id}/stats Response:

Error Handling

Common Error Responses

Error Codes

Best Practices

Agent Configuration

  1. Clear Naming: Use descriptive names for agents
  2. Appropriate Models: Choose the right model for the task
  3. Temperature Control: Adjust temperature for response consistency
  4. System Prompts: Write clear, specific system prompts
  5. Memory Settings: Configure memory retention appropriately

Skill Management

  1. Skill Selection: Assign relevant skills to agents
  2. Skill Testing: Test skills before assignment
  3. Performance Monitoring: Monitor skill performance
  4. Regular Updates: Update skills regularly
  5. Skill Dependencies: Consider skill dependencies

Group Management

  1. Logical Grouping: Group agents by function or purpose
  2. Load Balancing: Configure appropriate load balancing
  3. Fallback Strategy: Implement fallback agents
  4. Member Limits: Set appropriate member limits
  5. Skill Sharing: Share relevant skills across groups

Performance Optimization

  1. Response Time: Monitor and optimize response times
  2. Success Rates: Track and improve success rates
  3. Resource Usage: Monitor token and memory usage
  4. Load Distribution: Ensure even load distribution
  5. Scaling: Plan for scaling as usage grows

Security Considerations

  1. Access Control: Implement proper RBAC for agent management
  2. Memory Security: Secure sensitive memories shared with agents
  3. Skill Validation: Validate skills before assignment
  4. Audit Logging: Enable audit logging for agent operations
  5. Rate Limiting: Implement appropriate rate limiting