Flireo AI
WebsiteLinkedin
WebsiteLinkedin
  1. Guides
  • API Reference
    • Agents
      • List all agents
      • Create a new agent
      • Get an agent
      • Update an agent
      • Delete an agent
    • Tool Templates
      • List all tool templates
      • Create a new tool template
      • Get a tool template
      • Update a tool template
      • Delete a tool template
    • Numbers
      • List all phone numbers
      • Register a phone number
      • Get a phone number
      • Update a phone number
      • Delete a phone number
    • Calls
      • List calls
      • Get call by ID
      • Initiate outbound call
    • Call Control
      • Send control command to active call
    • Usage
      • Get usage logs
    • SIP Trunks
      • List SIP trunks
      • Create a SIP trunk
      • Get a SIP trunk
      • Delete a SIP trunk
    • Voices
      • List available voices
    • BYOK
      • Get BYOK configurations
      • Add BYOK configuration
      • Delete BYOK configuration
      • Get BYOK provider configurations
    • Domains
      • Get your domain
      • Add a domain
      • Delete your domain
      • List available Resend domains
      • Select and sync a Resend domain
      • Verify domain DNS records
      • Refresh domain status
    • Webhooks
      • Dynamic assistant configuration webhook
      • Tool/Function Call
      • Call Status Update
      • End of Call Report
    • Analysis Templates
      • List analysis templates
      • Create analysis template
      • Get analysis template
      • Update analysis template
      • Delete analysis template
    • Organization
      • Get organization information
    • Campaigns
      • List all campaigns
      • Create a campaign
      • Get a campaign
      • Update a campaign
      • Delete a campaign
      • List campaign leads
      • Add a lead
      • Remove a lead
  • Documentation
    • Get started
      • Quickstart
      • Introduction
      • Authentication
    • Core concepts
      • Agents
      • Phone numbers
      • Calls
      • Webhooks
    • Api's
      • Organization
      • Agents
      • Phone numbers
      • Sip trunks
      • Calls
      • Call control
      • Usage
      • Voices
      • BYOK
      • Domains
      • Analysis templates
      • Tool templates
    • Webhooks
      • Overview
      • Assistant request
      • Tool calls
      • Status update
      • End of call report
      • Security
    • Guides
      • BYOK Setup
      • Call analysis
      • Custom Tools
      • Call Transfers
      • xAI Realtime Integration
      • Analysis templates
      • Billing
      • Error codes
      • Rate limits
      • Sip Trunks
      • Tool templates
      • Troubleshooting
WebsiteLinkedin
WebsiteLinkedin
  1. Guides

Custom Tools

Custom tools allow your AI agent to execute functions during calls, like looking up customer information, booking appointments, or checking inventory.

How Tools Work#

1.
You define tools in your agent's llm_config.tools[]
2.
During a call, the LLM decides when to use a tool
3.
Flireo sends a webhook request with the tool call details
4.
Your endpoint returns the result
5.
The LLM uses the result to continue the conversation

Defining a Tool#

Add tools when creating or updating your agent:

Tool Definition Schema#

FieldTypeRequiredDescription
namestringYesUnique tool name (used by LLM)
descriptionstringYesWhat the tool does (helps LLM decide when to use it)
urlstringNoPer-tool webhook URL (overrides agent's webhook_url)
asyncbooleanNoFire-and-forget mode (default: false)
asyncResponsestringNoResponse for async tools
parametersobjectNoJSON Schema for tool inputs

Writing Good Descriptions#

The description is crucial - it tells the LLM when and how to use the tool.
Good descriptions:
{
  "name": "check_inventory",
  "description": "Check product availability and stock levels. Use when customer asks if a product is in stock or available. Returns quantity available and location."
}
{
  "name": "create_support_ticket",
  "description": "Create a support ticket for issues that cannot be resolved during the call. Use only when you cannot help the customer directly. Requires a description of the issue."
}
Bad descriptions:
{
  "name": "lookup",
  "description": "Looks up data"
}

Handling Tool Calls#

When a tool is called, your webhook receives:
{
  "message": {
    "type": "tool-calls",
    "toolCallList": [
      {
        "id": "tool_abc123",
        "type": "function",
        "function": {
          "name": "lookup_customer",
          "arguments": {
            "phone": "+31612345678"
          }
        }
      }
    ]
  }
}
Return the result:
{
  "results": [
    {
      "toolCallId": "tool_abc123",
      "result": {
        "found": true,
        "name": "Jan de Vries",
        "email": "jan@example.com",
        "account_type": "premium",
        "member_since": "2020-03-15"
      }
    }
  ]
}

Per-Tool URLs#

Route different tools to different endpoints:
{
  "tools": [
    {
      "name": "lookup_customer",
      "description": "...",
      "url": "https://crm.example.com/api/lookup"
    },
    {
      "name": "book_appointment",
      "description": "...",
      "url": "https://calendar.example.com/api/book"
    }
  ]
}

Async Tools#

For tools that don't need to return a result (logging, notifications):
{
  "name": "log_interest",
  "description": "Log that the customer expressed interest in a product for follow-up",
  "async": true,
  "asyncResponse": "Interest noted for follow-up.",
  "parameters": {
    "type": "object",
    "properties": {
      "product": { "type": "string" },
      "notes": { "type": "string" }
    }
  }
}
The LLM immediately receives "Interest noted for follow-up." while your webhook processes in the background.

Built-in Tools#

End Call#

Allow the agent to end the call:
{
  "type": "endCall"
}

Transfer Call#

Allow the agent to transfer to specific destinations:
{
  "type": "transferCall",
  "destinations": [
    {
      "type": "number",
      "number": "+31612345678",
      "description": "Sales team - for pricing questions and quotes",
      "message": "Ik verbind u door met sales."
    },
    {
      "type": "number",
      "number": "+31687654321",
      "description": "Technical support - for product issues",
      "message": "Ik verbind u door met technische support."
    }
  ]
}

Complete Example#

Agent configuration with multiple tools:
{
  "name": "Customer Service Agent",
  "webhook_url": "https://api.example.com/webhooks/flireo",
  "webhook_secret": "secret123",
  "webhook_events": ["tool-calls", "end-of-call-report"],
  "llm_config": {
    "provider": "openai",
    "model": "gpt-4o-mini",
    "messages": [
      {
        "role": "system",
        "content": "Je bent een klantenservice medewerker. Gebruik de beschikbare tools om klanten te helpen."
      }
    ],
    "tools": [
      {
        "name": "lookup_customer",
        "description": "Look up customer by phone number",
        "parameters": {
          "type": "object",
          "properties": {
            "phone": { "type": "string" }
          },
          "required": ["phone"]
        }
      },
      {
        "name": "check_order_status",
        "description": "Check the status of a customer order",
        "parameters": {
          "type": "object",
          "properties": {
            "order_id": { "type": "string" }
          },
          "required": ["order_id"]
        }
      },
      { "type": "endCall" },
      {
        "type": "transferCall",
        "destinations": [
          {
            "type": "number",
            "number": "+31612345678",
            "description": "Human support for complex issues"
          }
        ]
      }
    ]
  }
}
See Tool Calls Webhook for webhook details.
Modified at 2025-12-31 12:09:10
Previous
Call analysis
Next
Call Transfers
Built with