Flow XO AI Assistants

What are AI assistants, and why do you need one?

Flow XO AI assistants are the easiest and most powerful way to create an intelligent conversational agent for your business. Although Flow XO has long provided a wide range of powerful and easy to use AI building blocks to create any kind of AI experience you might want, before AI assistants you still had to weave them together yourself using our no code flow builder. With AI assistants you can create entire workflows simply by writing providing them with a goal and some simple instructions using natural language and configuring a few pre-built "tools" that your assistant can use to interact with other Flow XO services such as live agent handoff, accessing your internal knowledge base, integrate with external systems, and much more.

Unlike traditionally built conversational workflows, where you must define every detail and step of the conversational workflow yourself,  AI assistants can manage the flow of conversations automatically according to simple rules you can write in plain language, automatically guiding the flow of the conversation towards the goals that you set using the magic of today's most powerful AI large language models. Additionally, agents automatically come equipped with an excellent, multi-faceted memory of the current conversation so that they will react intelligently to user input even when the user doesn't provide the full context in each message (such as asking "Can you elaborate on that?" in response to a previous answer given by the AI assistant).

AI assistants can be created for nearly any conversational use case you may have, from a simple customer service agent that can answer questions about your business, products or services based on information available in a knowledge base (which you can easily synchronize from your website, upload PDF documents, or our API) to much more complex agents that can gather and qualify leads, guide users through various workflows such as processing a return or registering for a product or service, or nearly anything else you can imagine.

What's more, Assistants can also easily be chained together, so that you can build and test standalone agents that excel at a particular task, such as filing a trouble ticket or recommending a specific product based on a customers specific needs, and then make those purpose-built assistants available as tools to an orchestration assistant whose job it is to determine when and how to hand off control of the conversation to the most appropriate assistant who is an "expert" in the specified task.

Our AI assistants aren't only for working with your customers either - they can be used to build powerful and flexible internal tools to help automate diverse tasks such as employee onboarding, producing AI generated content for social media, etc, with the potential to create significant productivity and efficiency gains within your business.

Anatomy of an AI Assistant

A Flow XO AI assistant is composed of a few simple but powerful components that work together to create lifelike AI agents. Assistants are made up of the following pieces:

  • Goal - you will give each assistant a goal, it's reason for existing, which usually includes the expected outcome of the conversation. For example, one simple goal might be "All of a users questions have been answered and the user has indicated that their question or problem has been resolved, or they have been transferred to a live agent for further support". Or another example goal is "The customer has selected a loan amount and loan term that fits their needs and been provided a customized application link to begin their loan application"
  • instructions - each assistant must be provided a set of specific instructions on how it should interact with the user. This can be as simple as telling the assistant to "Answer all user questions about MyCo from information found in our knowledge base", but can also include much more detailed instructions, such as what tone and personality it should adopt, what rules it should follow ("Never attempt to answer questions about another company or product", "You must always collect the users email before scheduling a demo, as an email address is the primary way in which the sales team will communicate with the user"), etc.
  • Tools - an AI assistant with nothing but a goal and instructions can be useful, but it will be rather limited in how well it can be tailored to your specific business and customer needs. Tools are connections to your own business data and the outside world (or to other assistants) that can be easily configured to give your agents superpowers. We have provided a wide range of built in tools that can query your business data, read webpages in realtime, transfer users to live agents, and much more. But you can also easily create your own tools, either using our no code flow builder or direct HTTP/Rest calls to external services, meaning that your agents can be given nearly unlimited capabilities. You can even include other assistants as tools, so you can compose individual assistants together into an entire "team" of virtual agents that work together to serve your customers or your employees.
  • Output Fields - When you define your assistant, you have the option to configure a set of data fields that the assistant will try to fill in during the course of their conversation with the user. At the end of the conversation, the values of the completed output fields can be used to trigger additional automations using the completed data, such as updating a contact in your CRM, writing the values to a database or a Google Sheet, or anything else you can do with a Flow XO workflow.
  • Scratchpad - Although each assistant will have a memory of the conversation history with each user, for complex interactions and workflows it can be useful for the AI to keep a set of internal notes as it goes along that aren't shared with the user. For example, you may ask the assistant to keep track of how many times it was unable to answer a user's question from the knowledge base, and to ask the user if they want to transfer to a live agent after a certain number of unanswerable questions. In a case like this, you can ask the assistant to keep a counter of the number of unanswerable questions in its scratchpad. Or you may want the AI to generate a multi-step plan that it should then follow to achieve a specific goal, such as determining the best loan terms for a user based on their financial needs, and then to follow that plan to completion. In that case, you can tell the AI assistant to formulate a plan and write it down on its scratchpad, and then update the scratchpad with its progress as it executes the plan in collaboration with the user. This technique can improve your assistants ability to accomplish more complex goals that require multiple steps that are unique to each customer than it otherwise could using just its message history alone. The scratchpad can also be viewed in the logs, so you can get better understanding of its thought processes during each interaction, which can be very helpful when debugging and optimizing your agent over time.
  • Thread - each interaction with an AI assistant adds to the conversation history, or "thread", which acts as long term memory for your assistant and enables them to understand the context of each new message in relation to the conversation as a whole. The AI will receive the entire conversation history each time it processes a message, and you can control how many messages to keep in the history to help control AI costs and performance over the lifespan of a conversation.
  • Logs - assistants track each of their processing steps in a log, so you can understand exactly what happened in each conversation with a user. This tools is very valuable when you are building or modifying an assistant, but also helpful for monitoring your assistants over time to understand how and why they behave the way they do when serving your customers or employees.

While each assistant has access to every one of these components at any time, you don't always need them all. You can build powerful customer service agents with just a goal, some simple instructions, and a single tool, for example. But as your agents evolve and grow in complexity and sophistication, you will find each of these components invaluable when you need them. We'll teach you how to use each one of these components in this article.

Enough talk - time to build!

As an introduction to building AI assistants using Flow XO, we'll create a simple lead capture assistant that is completely self contained, meaning it doesn't require access to any tools. This only takes a couple of minutes, and will give you a taste of how simple and powerful building AI assistants can be. After that, we'll build a more sophisticated Customer Service agent that will use some pre-built tools to answer questions from your knowledge base and transfer the user to a live agent when necessary. 

NOTE: Although we'll just be working with plan text messages in this article, your assistants can send almost any type of message Flow XO can send via a Flow - images, videos, cards and audio! See here for more information.

Getting Started -  A Simple Lead Capture Assistant

For our first assistant, we'll build a lead capture agent you might deploy on your website to gather some basic information about a user in order to schedule a sales call. This example won't use any tools at first, and should take only a couple of minutes from start to finish. To follow along, you'll need to have a Flow XO account on our standard plan or higher. If you aren't already a Flow XO user, you can sign up for a free 14 day trial here.

1. Navigate to the "AI Assistants" tab from within the Flow XO user interface

2. Click "New Assistant"

3. Give your assistant a name, and an optional description. These aren't used by the AI, so just give a descriptive name and any description that will help you manage quickly find and understand your assistants purpose later.

4. Give your assistant a goal. The goal is a short description of what the assistant should achieve to be successful. The AI will get a copy of its goal along with its instructions, and you can refer to the goal in your instructions. For best results, goals should be as clear and specific as possible. A clear, concise goal will not only help your assistant know it's primary purpose, but also help you yourself come to a very clear understanding of what you want your assistant to achieve. Goals should contain only one or two objectives. If you are building assistants with too many objectives, it will be easier for your assistant to get confused. When your AI assistant will have many objectives (i.e. it will be responsible for more than one business purpose, such as both capturing leads AND processing returns) you should build multiple agents each with their own specific goal, and connect them together with an "orchestrator" or "operator" assistant whose single goal is to identify the most appropriate assistant to serve the specific need of a customer at any given time. 

in our example, our goal will be "Collect at least an email address, project budget and optional phone number from the user and send them a customized scheduling link"

This is a simple, clear and specific goal. Keep in mind that your assistant will in no way be limited to performing ONLY the tasks you specify in your goal, as you will see, but it will try to guide the conversation towards the goal, even if you have permitted it (in the instructions or by making tools available) to engage with the user in other ways.

5. Create your assistant's persona
Your assistant's persona tells them who they are, how they should communicate (tone and voice), and what their role is in relationship to your business. It's also a good place to provide a brief description of your business, or at least what your assistant is expected to know about it.

6. Create your assistant's instructions

Your assistants instructions are by far the most important component of your AI assistant. The instructions tell the assistant everything it needs to know to do its job - from who it is, the tone of voice it should use, to exactly how it should behave and what rules it needs to follow. You will write your instructions perfectly the first time - you will evolve your instructions many times both while your initially building your assistant and then later when tuning and troubleshooting your assistant based on reviewing conversation histories and feedback from your users. While the goal is usually fixed and may be updated rarely, the instructions are a living document that you will adjust through trial and error over the lifetime of your assistant. Modern AI, and specifically large language models like Open AI GPT, are nearly magical in their ability to understand and reason using natural language, but they are also not usually perfectly predictable. For that reason, it's usually wise to start with a minimal set of instructions, and add to the instructions as you interact with your assistant and observe how it responds to various messages. If you start with a big set of complicated instructions, then it will be much harder to know what specific elements in your instructions are causing the exact behavior you experience in your assistant, which will make it harder to get the exact behavior you are looking for. However, if you start simpler with basic instructions and then add to them, observe the changes the new instructions make, and make adjustments accordingly, it will be much easier to understand which aspects of your instructions are having which specific effects on your assistant.

This advice is especially important if you are new to writing Ai prompts for large language models. As you gain more experience, you will be able to more effectively predict how to write your instructions in a way that will achieve the results you want, but even then you don't want to overdo too early.

Here are the instructions we'll start with:

When you have collected the required information, send the user a hyperlink in markdown format to schedule a sales call at a time that is convenient for them. The link should have the following format:

https://myschedulingapp.com/sales-demo?name={name}&email={email}&phone={phone)&budget={budget}

7. The User Description
Finally, we can fill in an optional User Description. The user description is a place where you can introduce the user to your assistant. It's a good place to describe how the user got there, and if you want to share information about them such as their name, you can do that (using variables, which you can read about here). For this example, we'll just set the language to the users language if we know it.

All we have done so far in our instructions is to tell the assistant who it is, it's role and some very basic instructions on how to accomplish its goal of sending the user a scheduling link.

We should test the assistant now to see how it behaves.

But first, let's choose a language model to use. There are two choices:

GPT-3.5 Turbo and
GPT-4- Turbo (Preview)

GPT 3.5 is an older, smaller, but faster and much less expensive model. It is 1/10 of the cost of GPT 4 Turbo, and much faster. However, GPT 4 Turbo tends to perform quite a bit better in non-trivial scenarios. It is much better at following your instructions, and constructing accurate responses from its inputs. It can also handle much larger inputs, meaning you can safely use a larger history size. Our recommendation is to start with GPT 3.5 Turbo, and see if it produces a satisfactory result for your use case, as the improved response times and reduced cost will make your bot more cost effective and its improved speed will provide a better user experience, as long as it is able to accurately follow your instructions and respond appropriately to user inputs. If you find that your assistant is starting to ignore some of the rules you have set for it, hallucinates answers in appropriately, or fails to adopt the persona you create for it certain scenarios, you can always switch to GPT 4 Turbo and as long as you are comfortable with the cost and increased response times it will usually solve those issues. You can also use different models for different aspects of your assistant. For example, if you have complex instructions and rules, you may want to use GPT 4 Turbo for your assistant, but choose GPT 3.5 Turbo to handle your knowledge base requests. As usual when developing solutions with AI, direct testing with your exact use case will be required to determine the best model to use in which scenarios.

You will also need to choose the number of history messages to keep in the assistants memory. When using GPT 3.5, which has a lower limit for the amount of input text it can process, you'll want to keep this number lower. For GPT 4 Turbo, which can handle roughly 15x the amount of input text, you can retain a higher number of messages without running into any limits. However, keep in mind that the more history messages you retain, the higher your AI processing costs will be (if you are using your own Open AI API key), because the entire conversation history is processed with each message. We recommend you start with a 10 message history, and increase it only when you are finding your assistant is forgetting information that is impacting the user experience. Often, 10 messages will be enough to retain the context needed for many use cases. In this example, we'll set the history size at 10.


Now scroll to the bottom of the assistant editor and click "Save". On the next page, which shows you a summary of your assistant, click "Test Assistant"

A test console should open, with your new assistant loaded and ready to test. After a few moments, your assistant should introduce itself and is ready to start testing.

As you can see, the bot introduces itself and asks for the user to provide some input. Ultimately, since our assistants goal is to schedule a sales demo, this may be too open ended of an introduction and we may wish the assistant to be a little more specific about what it is looking for from the user. There are a few ways to solve that, but let's just accept it for now and start typing some messages.

For now, we'll give the assistant what it's expecting, just to see how it works in the ideal case:

That seems pretty reasonable. There are some potential issues though - asking for all the information at once might be a little overwhelming, it's probably better to ask each question one at a time, or at least split them up into contact info and budget. But already we can see advantages over a traditionally build bot. The assistant asked for a phone number, but didn't push for, because it knew that piece of data was optional. It also allowed the user to type out "10 thousand dollars" - usually with a manually built bot, you'd require the user to type in a number for the budget, but allowing the user to specify their answers however they want and still interpret them correctly is a big plus.

Also, the assistant did achieve it's goal - it send a link to schedule the sales call, which was correctly formatted. You can't see it in the screenshot, but the link it generated was this: " https://myschedulingapp.com/sales-demo?name=Nathan&email=nathan@nathan.com&phone=&budget=10000" which is correct.

Before we start making changes to the assistant's instructions to improve the experience, let's see how it handles a less than ideal conversation flow. At any time, you can click the 'Test' button to restart the assistant

Now let's not be so easy on our assistant.

The assistant still did an OK job, and without any real rules specified for it, it probably did the best it could. Just for a point of comparison, let's change the AI model to GPT 4 Turbo, and see if it behaves the same way:

A very similar result. If you read carefully, you'll notice GPT 4 Turbo made some obvious improvements. First, and maybe most important, it was stayed focused on the goal the entire conversation. Even in the introduction, instead of asking an open ended question, it got right to the job at hand - scheduling a call. When asked a question about pricing, it didn't make up information about having various pricing plans (which may or may not be true, but how would the AI know? It doesn't have any info about our pricing yet) it drew the obvious and very likely correct conclusion that our pricing is based on the outcome of the sales call. It also didn't ask for so many pieces of information all at once, but asked the questions one at a time, which is less overwhelming.

Also, when I refused to give it any information, it explained the possible downsides of not providing any contact information, but like GPT 3.5, allowed the conversation to progress anyway. 

While the GPT 4 Turbo conversation was clearly superior in a few ways, it's too early to give up on GPT 3.5 yet. We can fix a lot of these issues with better instructions, so switch your assistant back to 3.5 turbo (if you changed it to follow along with the example) and we'll see what we can do to improve the assistant with better instructions.

One thing to note is that there was a pretty big missing piece in our instructions - what to do if the assistant could not collect the contact information. Given that we didn't specify, both GPT 3.5 Turbo and GPT 4 Turbo made the probably accurate assumption that the user should be given a scheduling link anyway - probably the scheduling system will require whatever contact information is necessary. 

However, for the sake of this example, let's assume that this is NOT what we want. We don't want he user to proceed without at least providing an email address and a budget. Maybe we don't want non-serious buyers to waste our sales teams time, so we'd rather not allow people unwilling to engage with our assistant to schedule valuable demo slots.

We have a few other issues to address too to make GPT 3.5 behave more like GPT 4, keeping in mind that if the cost and response time of GPT 4 Turbo aren't issues for our business case, developing your assistant using this more advanced model will require LESS specific instructions and rules, which makes developing the assistant easier and more maintainable over time as well.

Ok, what do we want to change? Here is our list:

  • We need a better greeting. We don't want to ask the user "how can I help you?" - we want to guide them into setting up a demo.
  • We don't want the assistant to ask all of it's questions at once, it should for the contact information, and THEN for the budget
  • If the user asks an off topic question, like are you real, once the assistant answers, it should return the users focus to the task at hand
  • Finally, we want the bot to require at least an email address and a budget to offer the scheduling link. If they refuse, we should end the conversation politely and invite them to return at any time when they are ready to provide the required information.

Click "Edit" to edit the instructions, and change them to the following:

You are a very friendly and very intelligent receptionist for Flow XO, a software application that allows users to quickly build and deploy powerful AI assistants across various messaging channels. Your name is "Flow".

When you have collected the required information, send the user a hyperlink in markdown format to schedule a sales call at a time that is convenient for them. The link should have the following format:

https://myschedulingapp.com/sales-demo?name={name}&email={email}&phone={phone)&budget={budget}

You MUST follow each of the following rules. If you fail to follow any of these rules, then the goal can NOT be achieved.

#YOUR RULES:

- When beginning the conversation, always introduce yourself by name, thank the user for their interest in Flow XO's AI solutions, and let them know you are here to assist them in scheduling a sales demo so we can ensure we deliver an ideal solution tailored to their business and budget. Then ask them what they would like to be called.
- Ask the user only a single question at a time
- Always remain focused on achieving the goal. If the user asks an off topic question, you may answer the question, but attempt to redirect the conversation back to the goal at the same time.
- You may NOT provide a scheduling link without an email address and a project budget. If the user refuses to provide this information, inform them that we really need that information in order to ensure we can connect them with the right team member. If they still refuse, thank them for their interest, but inform them we can't proceed without an email and a budget, but that you are always available to pick up where you left off if they change their minds.

Click "Test" again to start over

Well that went MUCH better. It's still not perfect - 50 cents is not really a reasonable project budget. But then again, we didn't set any parameters around the budget. What would GPT 4 Turbo do in this situation?

Once again, GPT 4 Turbo demonstrated its superior intelligence, and noticed that 50 cents is not a reasonable number. But the outcome was effectively the same between the two models - without any specific instructions, the assistant plays it safe and allows the conversation to proceed. Let's make one more instruction tweak before we move on to another part of the assistant, and put some parameters around the budget. We'll also add in an element of lead qualification. For project budgets < $5000, we don't want to involve a salesperson. In that case, we'll direct the user to a pre-recorded demo video. Also, we've found that people specifying unrealistic budgets, we arbitrarily chose $100k, are not serious buyers. So we'll also bypass the sales team in this case. Here's the resulting instructions:

Finally we've gotten to a place where GPT 3.5 Turbo just isn't up to the task. Although some of the conversations went as expected, many of the tests went like this:

That's not ideal. We don't want the customer to feel inferior or put down for having a smaller project. So to try and fix this, we added another rule:

Still, when using GPT 3.5, this rule was often ignored. It may still be possible to create a rule worded in such a way that GPT 3.5 can more reliably follow it, but probably not always. if you reach a place in your assistant development using GPT 3.5 Turbo where the assistant simply fails to follow it's instructions, it's time to move to GPT 4 Turbo, which, as mentioned, does a much better job at following more complicated instructions and rules. Here is the typical response we would get from GPT 4, which is what we were asking for.

Does this mean you should always use GPT 4 Turbo, because GPT 3.5 is unreliable? Not at all. Many assistants have relatively simply sets of rules, and GPT 3.5 does a perfectly adequate job, at a lower cost, and with faster response times. The main thing is to thoroughly test your assistant, with your specific goals and end users in mind, and use the AI model that matches your budget, performance and accuracy requirements. You can connect use different models for different parts of your assistant, depending on the complexity of each specific part, meaning you can, for example, use GPT 3.5 to provide the user with answers to pricing questions, and GPT 4 for your more demanding use cases where GPT 3.5 gives poor responses. We'll show examples of this later.

We spent a lot of time on the instructions component because it's the aspect of assistant development that you will spend the most time on, and has the greatest impact on how your bot actually behaves. But developing a powerful AI assistant isn't ONLY about writing good instructions. Next, we'll cover how to use Output Fields to capture data into a structured format that you can easily send to a CRM, a spreadsheet, or use in a Flow to process the data however you need to.

Output Fields

In the example above, we collected a few important pieces of information from the user as part of a lead qualification process. In that example, we used that collected information to construct a scheduling link that the user could follow to sign up for a sales call - but usually, we'll want to do something more with the data the assistant collects, such as writing the data to a spreadsheet, add a contact to a CRM, or send a follow up email to the user, or to a team member. With our initial assistant designed in the sections above this would be difficult, because the collected data is only available as text within a chat history. This is where the Output Fields component come into play. For each assistant, you can define as set of named output fields that represent the data you want to use later on. Once these fields are defined, every time the assistant collects or deduces the content of one of these fields from the context of a conversation, it will store the value in a special "data" property which the assistant can output at the end of a conversation. Let's set up some Output Fields for our lead qualification bot.

To add output fields, click "Add output field". In the resulting dialog, choose a name for your field, a data type, and an optional description. If the field should only accept certain pre-defined values, you can add those options as a comma separated list. All of these fields will be sent to the assistant during processing, so each one will have an impact on the outcome. Often, a name and a data type are enough for the AI to understand how the field should be used. However, you can use the description to provide more detail or special instructions on how the field should be used if you need to.

Click save, and continue add the rest of the output fields you want to collect

Save your assistant and run through one more time, answering all of its questions.

You won't notice a difference in the user experience. However, if close the test console and click on "Run History". You will see a list of recent assistant runs.

The run history provides a variety of useful information regarding each run of your assistant. Since you added output fields, you can see the values of the fields that were successfully collected here. Later in this article, I'll show you how you can make use of those fields inside of a Flow XO flow to take further action.

Empowering your assistants with tools - Building a Simple Customer Service Agent

So far we've covered building a pretty interesting AI assistant that can collect some information about a user, recover from bad inputs, and direct the flow of the conversation according to how the user answers certain questions. The assistant could also automatically extract key data fields for later processing. Just those capabilities can be useful, but even so, the assistant was limited to the information it had available in its instructions. It can't look up additional information about the business, nor can it interact with the outside world in any way, such as to send an e-mail or text message, call external services like CRMs, etc. 

This is where an assistants "Tools" come in. "Tools" are what connect an assistant directly to your business, and to the outside world. The great thing about tools is that they can do nearly anything you need them to, because in addition to the set of tools we provide out of the box, you can very easily create your own tools using the full power of the Flow XO Flow builder, which can integrate with many services, fetch data from spreadsheets, databases or CRMs, and easily call external services using an HTTP interface. 

NOTE: Want to create your own tools? It's super easy.

Combining tools with the power of AI to understand instructions and works towards a specific goal means that you can create powerful automations with drastically less effort, and usually a better customer experience, than you can by tediously building conversational flows step by step in manual flow builder.

In this section, we're going to create a simple customer service bot that will use two tools: 

  • A knowledge base tool to be able to answer customer questions about our business, produce and services
  • A "livechat" tool to allow the assistant to transfer a customer to a customer service rep when needed

Before we get started building the assistant, here's a list of the currently available pre-built tools in Flow XO. More will be added in the future.

  • Knowledge Base - query one or more knowledge bases to answer a users question
  • Live Chat - transfer the user to a live agent
  • Query Image - is an AI Vision model to answer questions or perform analysis on images
  • Query File - read PDFs, spreadsheets, or other text files (usually uploaded by the user) and answer questions about them
  • Query Webpage  - answer a users question based on the contents of a specific webpage 
  • Read Webpage - read the contents of a webpage into the conversation history and use it to answer a user question
  • Text to Speech - create an audio clip of an assistant message to send to the user
  • Generate an Image - generate an image using Dall-e to send to the user
  • Flow - trigger a pre-defined Flow XO flow. This tool can be used either to query data (such as reading a user profile from a CRM), write data (such as updating a Google Sheet), or can even be given control of the conversation, for instance if you have a pre-built conversational workflow you want the assistant to be able to hand the conversation off to.
  • Assistant - run another assistant. This powerful tool can treat assistants as advisors or consultants, who guide the user through some particular process and then return the results to the original assistant, who will then process the results and proceed with its goal, or this tool can transfer control entirely to another assistant to handle the remainder of a conversation with the user at which point the original assistant completes its run.
  • Send Menu - send a pre-defined menu to the user
  • HTTP - Access an HTTP or REST service. This can be used to get data from an external service, or update an external service, with or without authentication.

For our assistant, we'll be using the first two tools, the Knowledge Base and the Live Chat tools.

First, let's create our Customer Service assistant and give it a goal and some instructions:

Goal: Answer all user questions and resolve all user issues until the user has indicated they do not need further assistance or the conversation has been escalated to a live agent
Instructions: 

You are "Flo", a friendly and very knowledgeable customer service agent that works for Flow XO, a company that provides an AI powered conversational platform. 

Your job is to answer any and all user questions and assist in troubleshooting issues. Your job is only complete when the user has indicated they have no more questions or their problems is solved, or the user has actively indicated that they wish to be transferred to a live agent

Here are your rules. ALWAYS follow ALL of your rules. Failing to follow all rules for every response will result in a poor customer service experience and you will have failed to achieve your goal.

# YOUR RULES
- You must always answer questions about Flow XO using the knowledge base. You may never add your own knowledge to a response, and are only permitted to include information found in the knowledge base in your answers.
- You should always include a markdown formatted link of source material for further reading in your responses when answering questions from the knowledge base
- You may engage in smalltalk and answer general knowledge questions or perform small tasks not related to Flow XO. However, you should always try to guide the conversation back to your original goal of assisting the user with topics related to Flow XO
- You must NEVER answer questions about another company, product or service other than Flow XO. For instance, if a user asks about a competitor, or about information for a company other than Flow XO, you must inform the user that you have only been trained on Flow XO, and they should reach out directly to the other company for further assistance or information.
- If a customer repeatedly fails to receive answers to their questions, or becomes frustrated, or asks to speak with a live agent or a human, transfer them to a live agent
- NEVER transfer a user who is openly hostile, vulgar or abusive to a live agent. Instead politely end the conversation.

These are basic instructions for a Customer Service assistant, but they should be good enough to get us going. 

Now, we need to attach a knowledge base and live chat to our assistant using tools. Edit your assistant and click "New Tool" in the "Tools" section:

In the Tool editor, select "Knowledge Base". as the tool type, and fill in the fields as follows:

The Knowledge Base tool is very configurable - we'll have an entire article on how to use it fully for you soon. In the meantime, you should know that there are two basic modes:

1. Search - this is the simplest way to incorporate your knowledge base. When in "search" mode the tool simply searches your knowledge base(s) and returns snippets from matching documents that the assistant can then analyze to produce an answer. This mode requires very little configuration and is the fastest to get started with, but cannot use a different language model than your assistant and has less configuration options. 

2. Answer Question - In this mode, instead of conducting a search and returning the results, the tool will send the question to a dedicated Question Answering AI (the same one the Knowledge Base flow tasks use), and only send back the answer. This mode is less prone to hallucination because of specialized prompts that the QA AI uses that are not present in your assistant. We recommend this mode for most assistants. You also have the option of using a different language model than the main assistant for answering questions using this mode, which means that if you get good enough results using GPT 3.5 Turbo for your knowledge base answers, but you are using GPT 4 Turbo for your main assistant, you can benefit from lower cost and faster responses for knowledge base answers.

Even though we usually recommend the "Answer Question" mode, for this example we'll stick with "Search" because it's so simple to use and this article isn't about tuning the knowledge base tool but simply introducing it.

Now that you've added a knowledge base tool, let's add a Live Chat tool as well. Again click "Add Tool" and configure the tool like this:

Click "Update Tool", save your assistant, which should now look like this:

Click "Test Assistant" to start a test console, and let's take it for a spin:

Pretty easy huh? You now have a fairly robust customer support assistant that remembers previous messages in the conversation, can answer any questions your knowledge base can answer, and can transfer users to live chat, with just a few simple settings.

There is a LOT more that tools can do, and in our article on tools we'll explore them in much more depth, but this should be enough to get you familiar with the concept and building some tool empowered assistants.

Now it's time to deploy your assistant so that it can actually serve your customers or employees.

Deploying your Assistant

There are two main ways you can deploy your assistant. The first, and simplest method, is just to associate a Bot (which is the same as a connection to a particular channel, such as a website or a WhatsApp number) with your assistant. Once the association is made, that bot will always delegate new messages to your assistant instead. of triggering catch-all flows. Configuring this is quite easy, just go to "Bots", create. or edit a new bot like you normally would, and select the assistant you want to associate with that bot:

Let's create a new web bot for our assistant:

Now we just need to associate our assistant with this bot:

Click "Next" to go to the install screen, and from here you can either copy the URL to the hosted version of your bot, or paste the install snippet into your website.

One thing to note is that when you deploy your bot this way, the first message the user is sent is the "Welcome Message" you configured on the previous screen. Your assistant won't actually be launched until the user types in a message in response. If you omit the welcome message and leave it blank, your assistant will be started as soon as a user connects to your bot and will greet the user itself, similar to how. it works in the test console. This is often not what you want, as it costs an AI request and takes extra time just to greet your user, so make sure you configure a welcome message.

Deploying your assistant using a Flow

The other way you can deploy your assistant is using a normal Flow XO Flow. This method is more rare, but can be useful when you already have an existing bot built out using triggers and flows,and you just want to trigger your agent in certain circumstances. To launch your assistant this way, you can use the "Run Assistant" task in the AI tools. 

Reacting to Assistant Events

If you recall from earlier, we used the Output Fields setting on our lead qualification assistant to collect certain data points that we want to do something with when an assistant conversation completes. To take advantage of these fields, we need to run a flow when the assistant completes. To enable this, we have added a "Assistant Event" trigger. To use it, create a blank flow:

Next, add an "Assistant Event" trigger

There are three different events you can choose from: Assistant Run Started, Assistant Run Completed, and Assistant Run Failed. Each is useful in certain situations, but Assistant Run Completed is the event you want to capture and make use of output from a completed conversation. Then choose the assistant whose data you want to use.

And that's really it. From that point forward, you can use the data to anything a Flow can do - send a record to a CRM, write to Google Sheets, send an e-mail, etc. For this simple example, we'll just send a message with the collected data:

Save and activate your flow, then run your lead qualification assistant through to the end.

It worked! After the assistant completed, the collected data was correctly sent as a message. Of course, in a real assistant you wouldn't do this, you would instead use the data and do something more interesting with it, but this should get you started.

That's it for an introduction to this powerful framework. We believe that soon most conversational experiences will be driven primarily by teams of AI assistants working together, rather than complicated manually built flows with lots of brittle branching logic, filters etc. We can't wait to see what you build!

As always please reach out to support@flowxo.com with any questions, feedback or issues.

Happy flowing!

Still need help? Contact Us Contact Us