Skip to main content

Tools & Integrations

Extend your AI agents’ capabilities by connecting them to external services, APIs, and custom functions.

Available Tools

Call Controls

Built-in actions:
  • Transfer calls
  • End calls
  • Hold/Resume
  • Conference

Calendar

Scheduling tools:
  • Check availability
  • Book appointments
  • Send invites
  • Manage events

Custom APIs

External connections:
  • REST APIs
  • Webhooks
  • Database queries
  • Custom functions

Setting Up Tools

1

Tool Configuration

Define your tool:
tool: {
  name: "calendar_check",
  type: "function",
  description: "Check calendar availability",
  parameters: {
    date: "string",
    duration: "number",
    timezone: "string"
  }
}
2

Authentication

Set up access:
auth: {
  type: "oauth2",
  credentials: {
    clientId: "YOUR_CLIENT_ID",
    clientSecret: "YOUR_CLIENT_SECRET",
    scopes: ["calendar.read", "calendar.write"]
  }
}
3

Implementation

Connect the logic:
async function checkAvailability(params) {
  const { date, duration, timezone } = params;
  // Your implementation logic
  return availableSlots;
}

Common Integrations

// Transfer call to department or agent
transfer: {
  action: "transfer_call",
  parameters: {
    target: "sales_department",
    reason: "sales inquiry",
    metadata: {
      customer_id: "12345",
      priority: "high"
    }
  }
}
// Check and book appointments
calendar: {
  checkAvailability: async (date) => {},
  bookAppointment: async (details) => {},
  sendInvite: async (attendees) => {},
  reschedule: async (appointmentId) => {}
}
// Update customer records
crm: {
  updateContact: async (data) => {},
  createTicket: async (issue) => {},
  logInteraction: async (details) => {},
  getHistory: async (customerId) => {}
}

Custom Functions

Tool Types

Built-in Tools

Ready to use:
  • Call controls
  • Basic integrations
  • Common functions
  • Standard protocols

Custom Tools

Build your own:
  • API connections
  • Business logic
  • Data processing
  • Custom actions

Authentication Methods

Simple auth:
auth: {
  type: "api_key",
  header: "x-api-key",
  value: "your-api-key"
}
Secure auth:
auth: {
  type: "oauth2",
  flow: "authorization_code",
  authUrl: "https://api.service.com/oauth/authorize",
  tokenUrl: "https://api.service.com/oauth/token"
}

Error Handling

1

Define Errors

Handle common issues:
errors: {
  API_ERROR: "External API error",
  AUTH_ERROR: "Authentication failed",
  TIMEOUT: "Request timeout",
  VALIDATION: "Invalid parameters"
}
2

Error Responses

Graceful handling:
try {
  // Tool execution
} catch (error) {
  return {
    success: false,
    error: error.code,
    message: "User-friendly message",
    fallback: alternativeAction
  }
}

Testing Tools

Test Mode

Verify integration:
  • Test credentials
  • Mock responses
  • Validate logic
  • Check errors

Monitoring

Track performance:
  • Success rates
  • Response times
  • Error rates
  • Usage patterns

Best Practices

Important guidelines:
  • Secure credentials
  • Handle timeouts
  • Validate inputs
  • Log activities
  • Monitor usage

Example Implementations

// Process payment
const processPayment = {
  name: "process_payment",
  handler: async ({ amount, currency, customerId }) => {
    // Payment logic
    return transactionResult;
  }
}
// Check inventory
const checkInventory = {
  name: "check_inventory",
  handler: async ({ productId, quantity }) => {
    // Inventory check
    return availability;
  }
}