Skip to main content

Getting Started with SignalWire's AI Agent

SignalWire AI Gateway or SWAIG enables functions that allow the virtual agent to perform actions by seamlessly integrating the virtual AI agent with backend databases or CRM. The integrations empower virtual agents with real-time access to relevant data, enabling them to handle customer queries more efficiently and deliver high-quality personalized interactions; for example, send SMS messages, access customer information, and resolve a support ticket.

Creating your first AI Agent

To get started with your first SignalWire AI Agent, navigate to your SignalWire Space and click on the tab on your sidebar labeled AI Agents. From here, you can assign your AI Agent a new Agent name. Once you have typed in the AI Agent's name, click the Create button to finish creating your first SignalWire AI Agent.

A screenshot of the New AI Agent page within the AI Agents tab of a SignalWire Space.
The AI Agent creation dialog.

You should now see your newly created AI Agent show up in the AI Agents list.

A screenshot of a successfully created AI Agent page within the AI Agents tab.

Setting up your AI Agent's settings

Next, we are going to go over the settings that set up the AI Agent to behave in a specified way. You will notice three tabs that are part of the AI Agent: Prompts, Language, and Functions. Below, we will go over each of these settings and what role they play for a SignalWire AI Agent.

A screenshot of the Edit page for the new AI Agent.

Prompts

The AI Agent comes with two settings under the Prompts section: Prompt and Post Prompt.

Prompt

The Prompt is the initial set of instructions we provide to configure the AI Agent. These instructions will act as a guide for the AI to stay within the prompts' description.

Additionally, the prompt section includes an Advanced Config section with additional Prompt settings. You can review these additional Prompt settings by clicking on the arrow beside Advanced Config to expand the settings.

Advanced Prompt Settings:

  • Prompt Confidence: Threshold to fire a speech-detect event at the end of the utterance.
  • Prompt Top P: Randomness Setting
  • Temperature: Randomness Setting
A screenshot of the advanced configurations, showing values for Prompt Confidence, Top P, and Temperature.

Post Prompt

The Post Prompt section is responsible for handling what actions are taken after the AI Agent Prompt has come to an end. It includes an Advanced Config section as well as a Post Prompt URL setting.

Similarly to the Prompt section, Post Prompt's Advanced Config comes with additional settings to help expand its capabilities and expected behavior.

  • Post Prompt Top P: Randomness Setting
  • Post Prompt Temperature: Randomness Setting

Post Prompt includes a section called Post Prompt URL. This will be a webhook that the AI Agent will POST to once the Post Prompt is complete. This can include status callbacks and reports.

A screenshot of the Post Prompt panel, including a text box, advanced config section, and Post Prompt Url text box.

AI Agent's Languages

The Language section allows us to specify what languages the AI Agent is allowed to use during the conversation. One of these specified languages can be set as the default language for the AI to use.

To add a language to your AI Agent, go to the Languages section and click on the Add Language button. From here, you will be able to select the language, gender, and voice the AI will use.

A screenshot of the Add Language panel, with drop-down selectors for Language, Gender, and Voice.

AI Agent's Functions

The SignalWire AI Agent also has the ability to call defined functions that can execute during the interaction with the AI.

The Default Webhook URL setting represents the default URL to which to send status callbacks and reports. This URL also becomes the default webhook for all functions created for your AI Agent. The default webhook URL also has an Advanced Configurationsection which exposes the following settings when expanded:

  • Default Webhook Auth User: Default auth username for web_hook_url endpoint. Optional. Default is not set.
  • Default Webhook Auth Password: Default auth password for web_hook_url endpoint. Optional. Default is not set.
A screenshot of the Functions tab, showing text boxes labeled Default Web Hook URL, Default Web Hook Auth User, and Default Web Hook Auth Password.

To get started with creating our first AI Agent Function, click on the Add Function button. This will open a new page that contains the newly created function's settings.

A screenshot of the Edit page for the AI Agent, showing the Add Function button.
Function Settings

When creating an AI Agent, we will need to declare its purpose, arguments, and the webhook URL you wish for this function to use.

  • Purpose: A description of the context and purpose of the function, to explain to the agent when to use it.
  • Arguments: A JSON object defining the input that should be passed to the function.
  • Webhook URL: Function-specific URL to send status callbacks and reports to. Takes precedence over a default setting. If not set, the default webhook URL will become the default webhook URL.
A screenshot of the New Function menu.

Under the webhook URL setting, you will see there is an Advanced Configuration section. Expand this section by clicking on the arrow to reveal the following settings:

  • Default Webhook Auth User: Function-specific auth username for web_hook_url endpoint. Takes precedence over a default setting.
  • Default Webhook Auth Password: Function-specific auth password for web_hook_url endpoint. Takes precedence over a default setting.
A screenshot of the Advanced Configuration section.

Introducing a practical SignalWire AI Agent — Ethan

Now that we have a general understanding of how to use the SignalWire, let's introduce Ethan. Ethan is a practical, working example of how you can leverage the SignalWire AI Agent to create a personal assistant. He has the ability to take messages, and forward them as an SMS to the individual he is assisting. He also has the ability to fetch the weather of any city upon request. Finally, the last functionality that Ethan is capable of is trivia! Ethan will use a trivia API to pull random trivia questions into the call for the user to answer.

To give a better over-site of Etan and how he functions, let's review his settings.

Ethan's Prompts

Your name is Ethan West, but you use your first name on the phone. You are the personal assistant to Brian West. You refer to him as Brian.

Languages

You can speak German, Italian, Portuguese, Spanish, French, Hindi, Telugu, and English

Ethans' Personality and Job Duties

Brian is the Director of Support Engineering and Head of Developer Experience at SignalWire If the call is an appointment reminder, please confirm the details and include it in the summary of the conversation, no need to transfer to Brian. Your email address is ethan@signalwire.com, your phone number is +1 (405) 829-8831 Your Fax number is +1 (405) 829-8832, and you can use this to receive faxes for Brian You can give out your fax number or email address to anyone that needs to send information to Brian. Brian knows everything about FreeSWITCH. If someone asks specific FreeSWITCH questions, just transfer them to Brian. If the user asks about anyone other than Brian, you don't know who they are, and you can't transfer them. You can't look up support tickets or give out any information about support tickets. If asked to do a physical task you can't perform, offer to find a service to perform the task. You are whimsical, and you like to tell stories, and you like to talk about your dog.

SignalWire Specific Information

To get help with number porting requests, you can email porting@signalwire.com, or transfer them to carrier. To get help with a support ticket can email support@signalwire.com, or transfer them to support. To inquire about products or pricing, and can email sales@signalwire.com or transfer them to sales. All the documentation is located at 'developer.signalwire.com' You can't answer pricing questions. To set up an account visit signalwire.com and click Sign Up and follow the instructions.

Users list

Anthony Minessale or Tony or Anthony Mike Jerris or Mike Stacy Willams or Stacy Greg Dunn or Greg Melanie Clark or Melanie Bobby Tables Jason Atkins or Jason Garrett

Greeting Rules

You must say you're brian's personal assistant, You must say your name is Ethan You must say good morning, good afternoon, or good evening You must ask how you can help them

How to handle users

Step 1

Greet the user in a whimsical manner, and ask them how you can help them. Being sure to prefix the greeting with good morning, good afternoon, or good evening.

Step 2

Ask the users full name, If the user is on the 'Users list' just transfer the call to brian immediately.

Step 3

Collect the users phone number, company name, and reason for calling.

Step 4

If the user is a telemarketer, bill collector or recruiter, then keep them busy and waste all the time you like with anything you like.

Step 5

Thank the user and say goodbye. Hangup the phone.

Prompt Advanced Configuration

  • Prompt Confidence: 0.5
  • Prompt TOP P: 0.64
  • Prompt Temperature: 0.89

Ethan's Post Prompt

Summarize the call

  • What was the call about?
  • What was the outcome?
  • What is the next step?
  • Include all relevant details

Post Prompt Advanced Configuration

Ethan's Languages

  • Name: English (US)
  • Code: en-US
  • Voice: gcloud.en-US-Neural2-A
  • Gender: Male

Ethan's Functions

Default Webhook URL

Functions

get_joke
  • Purpose: get a joke to tell the user
  • Arguments
    • Name: type - Description: Must either be 'jokes' or 'dadjokes'
  • Web Hook URL: https://example.com/joke
  • WebHook Auth USer: admin

get_trivia

  • Purpose: get a trivia question
  • Arguments
    • Name: Category - Description: Valid options are art, literature, language, science, nature, general, food, drink, people, places, geography, history, holidays, entertainment, toys, games, music, mathematics, religion, mythology, sports, leisure. Pick a category at random if not asked for a specific category.
  • Web Hook URL: https://example.com/trivia
  • Web Hook Auth User: admin

get_weather

  • Purpose: Get latest weather information for any city
  • Arguments
    • Name: city - Description: City name
    • Name: state - Description: US state for United States cities only, Optional
  • Web Hook URL: https://example.com/weather
  • Web Hook Auth User: admin

Build your own Ethan

Now with the understanding of the AI Agent and the logic that helps Ethan function, you can replicate Ethan into your own SignalWire Space to test out. Just follow the steps above to create an AI Agent, and then replicate Ethan's settings. Once all set, assign the AI Agent to a SignalWire number, and then call it to give it a test!