Documentation
API Reference
Documentation
API Reference
Book a meeting
Linkedin
Github
  1. Guides
  • Introduction
  • Get started
    • Quickstart
    • Authentication
  • Core concepts
    • Agents
    • Phone numbers
    • Calls
    • Webhooks
  • Webhooks
    • Overview
    • Assistant request
    • Tool calls
    • Status update
    • End of call report
    • Security
  • Guides
    • Campaigns
    • xAI Realtime Integration
    • Voice selection psychology
    • Analysis templates
    • BYOK Setup
    • Call analysis
    • Call Transfers
    • Custom Tools
    • Sip Trunks
    • Tool templates
    • Voicemail detection
    • Autonomous silence detection
    • Billing
    • Error codes
    • Rate limits
    • Troubleshooting
  • Api's
    • Campaigns
    • Agents
    • Voices
    • BYOK
    • Analysis templates
    • Tool templates
    • Organization
    • Phone numbers
    • Sip trunks
    • Calls
    • Call control
    • Usage
    • Domains
Documentation
API Reference
Documentation
API Reference
Book a meeting
Linkedin
Github
  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)
async_responsestringNoResponse 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",
    "tool_call_list": [
      {
        "id": "tool_abc123",
        "type": "function",
        "function": {
          "name": "lookup_customer",
          "arguments": {
            "phone": "+31612345678"
          }
        }
      }
    ]
  }
}
Return the result:
{
  "results": [
    {
      "tool_call_id": "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,
  "async_response": "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": "end_call"
}

Transfer Call#

Allow the agent to transfer to specific destinations:
{
  "type": "transfer_call",
  "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": "end_call" },
      {
        "type": "transfer_call",
        "destinations": [
          {
            "type": "number",
            "number": "+31612345678",
            "description": "Human support for complex issues"
          }
        ]
      }
    ]
  }
}
See Tool Calls Webhook for webhook details.
Modified at 2026-01-30 12:25:29
Previous
Call Transfers
Next
Sip Trunks
Built with