> ## Documentation Index
> Fetch the complete documentation index at: https://agno-v2.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Twilio

> TwilioTools enables an Agent to send SMS messages, retrieve call details, and list recent messages through the Twilio REST API.

**TwilioTools** enables an Agent to interact with [Twilio](https://www.twilio.com/docs) services, such as sending SMS, retrieving call details, and listing messages.

## Prerequisites

The following examples require the `twilio` library and appropriate Twilio credentials, which can be obtained from [here](https://www.twilio.com/console).

```shell theme={null}
uv pip install twilio openai
```

Set the following environment variables:

```shell theme={null}
export TWILIO_ACCOUNT_SID=***
export TWILIO_AUTH_TOKEN=***
```

## Example

The following agent will send an SMS message using Twilio:

```python theme={null}
from agno.agent import Agent
from agno.tools.twilio import TwilioTools

agent = Agent(
    instructions=[
        "Use your tools to send SMS using Twilio.",
    ],
    tools=[TwilioTools(debug=True)],
    )

agent.print_response(
    "Send an SMS from +15005550006 to +1234567890 saying 'Hello from Agno!'",
    markdown=True,
)
```

## Toolkit Params

| Name | Type | Default | Description |
| - | - | - | - |
| `account_sid` | `Optional[str]` | `None` | Twilio Account SID for authentication. |
| `auth_token` | `Optional[str]` | `None` | Twilio Auth Token for authentication. |
| `api_key` | `Optional[str]` | `None` | Twilio API Key for alternative authentication. |
| `api_secret` | `Optional[str]` | `None` | Twilio API Secret for alternative authentication. |
| `region` | `Optional[str]` | `None` | Optional Twilio region (e.g., `au1`). |
| `edge` | `Optional[str]` | `None` | Optional Twilio edge location (e.g., `sydney`). |
| `debug` | `bool` | `False` | Enable debug logging for troubleshooting. |
| `enable_send_sms` | `bool` | `True` | Enable the send\_sms functionality. |
| `enable_get_call_details` | `bool` | `True` | Enable the get\_call\_details functionality. |
| `enable_list_messages` | `bool` | `True` | Enable the list\_messages functionality. |
| `all` | `bool` | `False` | Enable all functionality. |

## Toolkit Functions

| Function | Description |
| - | - |
| `send_sms` | Sends an SMS to a recipient. Takes recipient phone number, sender number (Twilio), and message body. Returns message SID if successful or error message if failed. |
| `get_call_details` | Retrieves details of a call using its SID. Takes the call SID and returns a dictionary with call details (e.g., status, duration). |
| `list_messages` | Lists recent SMS messages. Takes a limit for the number of messages to return (default 20). Returns a list of message details (e.g., SID, sender, recipient, body, status). |

## Developer Resources

* [Tools](https://github.com/agno-agi/agno/blob/main/libs/agno/agno/tools/twilio.py)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.