AI Assistants is a Twilio Alpha project that's in Developer Preview. To request access, please join the waitlist.
View the current limitations for details about feature limits during developer preview.
Twilio AI Assistants are an opinionated framework to build and host conversational AI Assistants for your customer-facing use cases.
Twilio AI Assistant core functionality consists of:
AI Assistants are built on top of various Large Language Models (LLMs), including models from OpenAI amongst others.
Read on to learn about the AI Assistant features, or check out the Quickstart to see how to build your first Assistant.
Your AI Assistant's base configuration consists of its name, base model, and personality prompt. You can also optionally provide "memory" through Twilio's CustomerAI.
Below are the base configuration components:
Tools are APIs that your Assistant can use to accomplish tasks and solve problems.
Tools should be standalone APIs (similar to webhooks) that are purpose-built for a task. An Assistant chooses from its available Tools when answering questions.
Tools differ from Knowledge in that Tools accomplish specific tasks (for example, looking up the weather or finding directions to a location), whereas Knowledge entries are unstructured data sources that the AI Assistant can reference to ask additional questions (such as your company's policies or documentation).
A Tool definition consists out of the following attributes:
Name | Description | Example |
---|---|---|
Name | The name for your Tool. This needs to be unique as it will be used by your Assistant internally to reference this tool. You can think about it like a "function name". | Google Maps |
Description | This description will be the primary way your Assistant will determine when to use this tool. If you see your tool not being used as you expected this is the best place to start iterating on it. | Use this to fetch information about a location from Google Maps. |
Input | This field describes what information you want the Assistant to pass to the webhook. The format is similar to TypeScript types to define the various fields you want to have sent. | { name: string; } |
HTTP Method | Specifies whether you want the API request to be an HTTP GET or POST request. | GET |
Webhook URL | The URL of the API webhook you want it to trigger. | https://api.disneyapi.dev/character?pageSize=2 |
Verified Endpoint | Whether you want the AI Assistant to perform a 2FA verification check via SMS. Requires that your Segment profile contains a phone or phone_number trait. | [unchecked] |
Advanced Settings | Under advanced settings you can specify if you want the result of a tool to be used as Final Response. That will result in the Assistant taking the output of the HTTP request and directly responding to the customer. This is useful if your Tool returns a specific message you want to communicate with the customer. However, this means the Tool cannot be used as part of a series of Tools. |
The Webhooks will automatically pass the following information as HTTP headers to the request:
Name | Description | Example |
---|---|---|
X-Session-Id | The session ID of your conversation. You can use this for example to identify if the same tool was called multiple times from the same conversation. | |
X-Identity | The Segment Identity that is used for your Assistant interaction. If you use the Assistant Simulator, this value will be the same as what you put into the User Identity field. | email:demo@example.com |
Right now, the only authentication mode supported for Tools is OAuth 2 with password type grants. If you need a different mode of authentication to interact with an API, it's recommended to create a proxy API endpoint that Assistants can trigger. For example, rather than giving direct access to the Google Maps API, you should create your own endpoint that calls the Google Maps API and give your Assistant access to that endpoint instead.
If you want to restrict actions from certain users interacting with an Assistant, or if you want to understand on whose behalf the Assistant is trying to trigger a tool, check the X-Identity
header.
With Knowledge, you can give your Assistant access to unstructured data such as knowledge bases, policies, and documentation.
The following knowledge types are currently available to use with your Assistant:
After you've defined Knowledge, the Assistant will determine if a Knowledge entry might be helpful to generate an answer to a customer's question. This works similarly to how Tools are used. However, instead of generating structured data to interface with the Tool, the Assistant will generate a question and pull relevant information from the unstructured data that you uploaded.
A Knowledge Entry consists out of the following attributes:
Name | Description | Example |
---|---|---|
Name | The name for your Knowledge. This needs to be unique as it will be used by your Assistant internally to reference this knowledge entry. | FAQ |
Description | This description is the primary way your Assistant determines when to use this entry and how to phrase a question to it. If your Assistant isn't using the entry as you expected, this is the best place to start iterating. | Use this to find answers to frequently asked questions about Twilio. |
Configuration | This configuration will differ depending on the Knowledge type. | |
Advanced Settings | Specify if you want the result from querying this Knowledge to be used as the final response to the customer. If you turn this on, the Assistant won't be able to combine information from multiple knowledge entries. |
Connect your AI Assistant to your preferred channels
Every Assistant comes with a REST API that you can use to trigger a message. Aside from a Body
you can pass in a SessionId
of your choice (which will be used to maintain message history) and an Identity.
_10ASSISTANT_SID=<your-assistant-sid>_10curl -X POST -H 'Content-Type:application/json' \_10 https://assistants.twilio.com/v1/$ASSISTANT_SID/Messages \_10 -d '{"Identity":"user_id:example", "SessionId": "demo", "Body":"Ahoy there"}' \_10 -u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN
The Simulator allows you to interact with your AI Assistant via the Twilio Console for testing, demo, and debugging purposes. You can find the Simulator at the top right of your Assistant Configuration screen in the Console.
You can define an identity and create a new Simulator session to chat with your Assistant. The view will also show you the output of the Tools the Assistant uses. Each new Simulator session starts a new conversation history.
You can use the Simulator to test a wide range of queries, including edge cases, to evaluate the Assistant's responses and adaptability, and to simulate different user personas and scenarios.
While AI Assistants are in developer preview, there are feature limitations and system limits in place.
Assistant configuration limits:
Assistant usage:
If you want to exceed these limitations, please reach out to twilioalpha@twilio.com.