> ## Documentation Index
> Fetch the complete documentation index at: https://docs.heysonara.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Tools & Functions

> Give your agent the ability to take actions during conversations.

## What are tools?

Tools allow your agent to perform actions during a conversation  - like ending a call, transferring to a human, or calling an external API. When the agent determines it needs to take an action, it invokes the appropriate tool.

## Built-in tools

Sonara provides several built-in tools that you can enable with one click:

### End Call

Allows the agent to hang up the call when the conversation is complete.

### Transfer Call

Transfers the caller to a specified phone number. Configure the destination number when enabling this tool.

### Transfer Agent

Hands off the conversation to a different Sonara agent. Useful for routing callers to specialized agents (e.g., transfer from a general support agent to a billing specialist).

## Custom functions

For advanced use cases, you can define custom functions that your agent can call during conversations.

### Creating a custom function

<Steps>
  <Step title="Click Add Function">
    In the **Tools** tab, click **Add Function**.
  </Step>

  <Step title="Define the function">
    Provide:

    * **Name**  - A descriptive function name (e.g., `lookup_order`)
    * **Description**  - Explain what this function does and when the agent should use it. The LLM uses this description to decide when to call the function.
    * **Parameters**  - Define the input parameters as a JSON schema.
  </Step>

  <Step title="Set the endpoint">
    Provide the server URL that Sonara should call when this function is invoked. Your endpoint will receive the parameters as a JSON payload and should return a response for the agent to use.
  </Step>
</Steps>

### Example custom function

**Function: `lookup_order`**

```json theme={null}
{
  "name": "lookup_order",
  "description": "Look up an order by its order number. Use this when the customer asks about their order status.",
  "parameters": {
    "type": "object",
    "properties": {
      "order_number": {
        "type": "string",
        "description": "The customer's order number"
      }
    },
    "required": ["order_number"]
  }
}
```

<Tip>
  Write clear, detailed descriptions for your custom functions. The LLM relies on the description to decide when and how to call each function.
</Tip>

<Warning>
  Your custom function endpoint must respond within a reasonable time (under 10 seconds) to avoid noticeable pauses in the conversation.
</Warning>
