Agent Tools

Agent Tools API

The Agent Tools API allows you to manage tools for your AI agents. Tools enable agents to perform actions like sending emails, creating tickets, scheduling meetings, and more.

Base URL

https://api.aloochat.ai/api/public

Authentication

All requests require an API key in the x-api-key header:

x-api-key: your_api_key_here

Endpoints

Get Agent Tools

Retrieve all tools configured for a specific agent.

Endpoint: GET /agents/{agentId}/tools

Parameters

ParameterTypeRequiredDescription
agentIdstring (UUID)YesThe ID of the agent

Example Requests

curl -X GET "https://api.aloochat.ai/api/public/agents/123e4567-e89b-12d3-a456-426614174000/tools" \
  -H "x-api-key: your_api_key_here" \
  -H "Content-Type: application/json"

Example Response

[
  {
    "id": "456e7890-e89b-12d3-a456-426614174001",
    "agent_id": "123e4567-e89b-12d3-a456-426614174000",
    "company_id": "789e1234-e89b-12d3-a456-426614174002",
    "tool_type": "slack",
    "name": "Team Slack Bot",
    "description": "Send messages to team Slack channels",
    "config": {
      "slack_bot_token": "xoxb-your-token",
      "default_channel": "#general"
    },
    "categories": [
      {
        "id": "cat-123",
        "name": "Communication"
      }
    ],
    "created_at": "2024-01-15T10:30:00Z",
    "updated_at": "2024-01-15T10:30:00Z"
  }
]

Create Agent Tool

Create a new tool for a specific agent.

Endpoint: POST /agents/{agentId}/tools

Parameters

ParameterTypeRequiredDescription
agentIdstring (UUID)YesThe ID of the agent

Request Body

FieldTypeRequiredDescription
agent_idstring (UUID)YesThe ID of the agent (must match URL parameter)
tool_typestringYesType of tool (slack, email, zendesk, hubspot, etc.)
namestringYesName of the tool (1-255 characters)
descriptionstringYesDescription of the tool
configobjectNoTool-specific configuration
categoriesarrayNoList of data category IDs

Example Requests

curl -X POST "https://api.aloochat.ai/api/public/agents/123e4567-e89b-12d3-a456-426614174000/tools" \
  -H "x-api-key: your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "agent_id": "123e4567-e89b-12d3-a456-426614174000",
    "tool_type": "slack",
    "name": "Team Slack Bot",
    "description": "Send messages to team Slack channels",
    "config": {
      "slack_bot_token": "xoxb-your-token",
      "default_channel": "#general"
    },
    "categories": ["cat-123"]
  }'

Example Response

{
  "id": "456e7890-e89b-12d3-a456-426614174001",
  "agent_id": "123e4567-e89b-12d3-a456-426614174000",
  "company_id": "789e1234-e89b-12d3-a456-426614174002",
  "tool_type": "slack",
  "name": "Team Slack Bot",
  "description": "Send messages to team Slack channels",
  "config": {
    "slack_bot_token": "xoxb-your-token",
    "default_channel": "#general"
  },
  "categories": [
    {
      "id": "cat-123",
      "name": "Communication"
    }
  ],
  "created_at": "2024-01-15T10:30:00Z",
  "updated_at": "2024-01-15T10:30:00Z"
}

Update Agent Tool

Update an existing tool for a specific agent.

Endpoint: PUT /agents/{agentId}/tools/{toolId}

Parameters

ParameterTypeRequiredDescription
agentIdstring (UUID)YesThe ID of the agent
toolIdstring (UUID)YesThe ID of the tool to update

Request Body

All fields are optional for updates:

FieldTypeRequiredDescription
tool_typestringNoType of tool
namestringNoName of the tool
descriptionstringNoDescription of the tool
configobjectNoTool-specific configuration
categoriesarrayNoList of data category objects

Example Requests

curl -X PUT "https://api.aloochat.ai/api/public/agents/123e4567-e89b-12d3-a456-426614174000/tools/456e7890-e89b-12d3-a456-426614174001" \
  -H "x-api-key: your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Updated Slack Bot",
    "description": "Updated description for Slack bot",
    "config": {
      "slack_bot_token": "xoxb-new-token",
      "default_channel": "#updates"
    }
  }'

Delete Agent Tool

Delete an existing tool for a specific agent.

Endpoint: DELETE /agents/{agentId}/tools/{toolId}

Parameters

ParameterTypeRequiredDescription
agentIdstring (UUID)YesThe ID of the agent
toolIdstring (UUID)YesThe ID of the tool to delete

Example Requests

curl -X DELETE "https://api.aloochat.ai/api/public/agents/123e4567-e89b-12d3-a456-426614174000/tools/456e7890-e89b-12d3-a456-426614174001" \
  -H "x-api-key: your_api_key_here"

Tool Types

The following tool types are supported:

Slack

Configure Slack integration for sending messages.

Required config fields:

  • slack_bot_token: Your Slack bot token
  • default_channel: Default channel for messages (optional)

Email

Configure email sending capabilities.

Required config fields:

  • provider: “smtp”, “mailgun”, or “gmail”
  • For SMTP: smtp_address, smtp_port, smtp_username, smtp_password
  • For Mailgun: mailgun_api_key, mailgun_domain
  • For Gmail: google_credentials_json, google_token_json

Zendesk

Configure Zendesk ticket management.

Required config fields:

  • zendesk_subdomain: Your Zendesk subdomain
  • zendesk_email: Your Zendesk email
  • zendesk_api_token: Your Zendesk API token

HubSpot

Configure HubSpot CRM integration.

Required config fields:

  • hubspot_api_key: Your HubSpot private app access token

Meeting Scheduler

Configure Google Calendar integration for scheduling.

Required config fields:

  • google_credentials_json: Google OAuth2 credentials
  • google_token_json: Google OAuth2 token

WhatsApp

Configure WhatsApp Business API integration.

Required config fields:

  • whatsapp_access_token: WhatsApp access token
  • whatsapp_phone_number_id: Phone number ID
  • whatsapp_verify_token: Webhook verify token

Notion

Configure Notion workspace integration.

Required config fields:

  • notion_integration_token: Notion integration token

Error Responses

All endpoints return standard HTTP status codes and error responses:

400 Bad Request

{
  "error": "BadRequest",
  "message": "Invalid request parameters",
  "statusCode": 400,
  "timestamp": "2024-01-15T10:30:00Z",
  "path": "/api/public/agents/123/tools"
}

401 Unauthorized

{
  "error": "Unauthorized",
  "message": "Authentication required",
  "statusCode": 401,
  "timestamp": "2024-01-15T10:30:00Z",
  "path": "/api/public/agents/123/tools"
}

403 Forbidden

{
  "error": "Forbidden",
  "message": "Access denied",
  "statusCode": 403,
  "timestamp": "2024-01-15T10:30:00Z",
  "path": "/api/public/agents/123/tools"
}

404 Not Found

{
  "error": "NotFound",
  "message": "Agent not found or access denied",
  "statusCode": 404,
  "timestamp": "2024-01-15T10:30:00Z",
  "path": "/api/public/agents/123/tools"
}

429 Too Many Requests

{
  "error": "TooManyRequests",
  "message": "Rate limit exceeded",
  "statusCode": 429,
  "timestamp": "2024-01-15T10:30:00Z",
  "path": "/api/public/agents/123/tools"
}

500 Internal Server Error

{
  "error": "InternalServerError",
  "message": "Internal server error",
  "statusCode": 500,
  "timestamp": "2024-01-15T10:30:00Z",
  "path": "/api/public/agents/123/tools"
}

Rate Limiting

The API implements rate limiting to ensure fair usage:

  • Rate Limit: 100 requests per minute per API key
  • Headers: Rate limit information is included in response headers:
    • X-RateLimit-Limit: Maximum requests per window
    • X-RateLimit-Remaining: Remaining requests in current window
    • X-RateLimit-Reset: Time when the rate limit resets

Best Practices

  1. Store API Keys Securely: Never expose API keys in client-side code
  2. Handle Rate Limits: Implement exponential backoff for rate limit responses
  3. Validate UUIDs: Ensure agent and tool IDs are valid UUIDs
  4. Error Handling: Always handle error responses appropriately
  5. Tool Configuration: Validate tool configuration before creating tools
  6. Use HTTPS: Always use HTTPS for API requests in production

SDK Examples

Complete Tool Management Workflow

class AgentToolsAPI {
  constructor(apiKey, baseUrl = 'https://api.aloochat.ai/api/public') {
    this.apiKey = apiKey;
    this.baseUrl = baseUrl;
 
  async request(method, endpoint, data = null) {
    const url = `${this.baseUrl}${endpoint}`;
    const options = {
      method,
      headers: {
        'x-api-key': this.apiKey,
        'Content-Type': 'application/json'
      }
    };
 
    if (data) {
      options.body = JSON.stringify(data);
    }
 
    const response = await fetch(url, options);
    
    if (!response.ok) {
      const error = await response.json();
      throw new Error(`API Error: ${error.message}`);
    }
 
    return method === 'DELETE' ? null : await response.json();
  }
 
  async getAgentTools(agentId) {
    return this.request('GET', `/agents/${agentId}/tools`);
  }
 
  async createAgentTool(agentId, toolData) {
    return this.request('POST', `/agents/${agentId}/tools`, {
      ...toolData,
      agent_id: agentId
    });
  }
 
  async updateAgentTool(agentId, toolId, updateData) {
    return this.request('PUT', `/agents/${agentId}/tools/${toolId}`, updateData);
  }
 
  async deleteAgentTool(agentId, toolId) {
    return this.request('DELETE', `/agents/${agentId}/tools/${toolId}`);
  }
}
 
// Usage example
const api = new AgentToolsAPI('your_api_key_here');
 
async function manageAgentTools() {
  const agentId = '123e4567-e89b-12d3-a456-426614174000';
 
  try {
    // Create a Slack tool
    const slackTool = await api.createAgentTool(agentId, {
      tool_type: 'slack',
      name: 'Team Slack Bot',
      description: 'Send messages to team channels',
      config: {
        slack_bot_token: 'xoxb-your-token',
        default_channel: '#general'
      }
    });
 
    console.log('Created Slack tool:', slackTool);
 
    // Get all tools
    const tools = await api.getAgentTools(agentId);
    console.log('All agent tools:', tools);
 
    // Update the tool
    const updatedTool = await api.updateAgentTool(agentId, slackTool.id, {
      name: 'Updated Slack Bot',
      config: {
        slack_bot_token: 'xoxb-new-token',
        default_channel: '#updates'
      }
    });
 
    console.log('Updated tool:', updatedTool);
 
  } catch (error) {
    console.error('Error managing tools:', error.message);
  }
}
 
manageAgentTools();

Support

For additional support or questions about the Agent Tools API, please contact our support team or refer to the main API documentation.