Use ConversationRelay with the Open Source Agent Builder Flowise: A Multi-Agent Example with Voice

September 22, 2025
Written by
Reviewed by
Paul Kamp
Twilion

Here at Twilio, we’ve seen customers looking for approaches for multi-agent solutions. Whether they’re looking to enable their customer support flow or their marketing lead qualification, they want to have specialized agents who can work together to answer questions or resolve customer issues.

In this post, we’ll show you how to set up and orchestrate a multi-agent solution to handle scheduling and provide information over the voice channel using Twilio Voice and ConversationRelay. We used Flowise, a visual agent builder, to put together this tutorial, and we are also open sourcing the package used in this approach so that you can replicate this in your environment for your own customer flows.

Let’s get started with the build!

Architecture of a multi-agent experience built with Flowise

Flowise makes it straightforward to build a multi-agent workflow. Here’s a sequence diagram of what we’ll be building.

sequenceDiagram
    participant U as User
    participant C AS ConversationRelay
    participant S AS Server
    participant F AS Flowise


    U->>C: Calls in
    activate U
    C->>S: HTTP /twiml
    activate C
    S->>C: Respond <Connect>...</Connect>
    deactivate C
    C->>S: WS Connection
    S->>F: HTTP Streaming
    F-->>S: Streaming back
    S-->>C: Stream back 
    S-->>U: Read back messages
    deactivate U

In this demo, a Condition Agent using a mini model is used to quickly determine user intent. The 3 scenarios in our example are:

  • Scheduling: Customer wants to book, schedule, or reserve a class, training session, appointment or pricing, plans, joining, cancelling, or upgrading their membership
  • Fitness Guidance: Customer needs workout advice, exercise recommendations, or training guidance
  • General Info: Customer asks about gym hours, location, amenities, or general services

Each scenario is then connected to an Agent, which is a ReAct wrapper that can execute a RAG pipeline with its own tools and knowledge.

Here is a quick video that shows you the end to end experience we will be enabling through this approach.

Prerequisites

Before you can build our sample app, you’ll need to sign up for accounts and have a few things ready.

Once those are set up or installed, you’re ready for the build!

Want to skip the full tutorial? You can find our sample code and a brief writeup in our repository.

Build a multi-agent experience with Flowise

Now, let’s walk through building customer experience flows with Flowise. First, we’ll build some fitness agents on Flowise. We’ll then set up a local server to host our logic and interface with Twilio Voice using ConversationRelay. Then, finally, you’ll be able to call and interact with the agents!

Build agents on Flowise

In this step, we’ll walk through working in Flowise. We’ll create our agents in the Flowise dashboard, then grab our API Key to work with ConversationRelay.

Flowchart showing the Voice Agent's decision path with components like Start, Condition Agent, and three other agents.

Getting started

  1. Clone the repo https://github.com/twilio-samples/cr-flowiseai and run npm install.
  2. cd sample-tools, then run npm install
  3. Copy the sample .env file: cp .env.example .env
  4. Visit https://flowiseai.com/, and either sign up for an account (if you haven’t yet!), or log in
  5. Go to the Credentials tab and create a new credential for the LLM model of choice, pasting in your API key.
  6. Visit the API Keys tab and copy the API key. Paste it in the appropriate place in your .env

Great! Now, let’s create the Tools we’ll need to perform some of the other actions we’d like our agents to do.

Deploy Twilio Functions and create Tools

  1. Go into the sample-tools directory from the repo you cloned
  2. Set up Twilio CLI alongside the Serverless plugin if you haven’t already - instructions are available in the Readme in the sample-tools directory
  3. Run npm run deploy to deploy the tools to your Twilio Functions
  4. Copy the Twilio Functions URL into the .env
  5. Now run ./tools/ deploy.js to deploy the Flowise Tools

Set up your agents

1. Switch back to the Flowise Website.

2. Visit Variables and create a static variable called customerPhoneNumber – set any value you want. This will be overwritten at runtime.

3. Go to Agentflows and create a new Flow – call it VoiceAgent.

4. Create the Flow from the screenshot above.

5. For the Conditional Agent configuration, set:

  • Instructions
You are Alex, a routing agent for NightOwl Fitness. Your only job is to understand what the caller wants and route them to the right specialist agent.

## Listen for these intent categories:

1) Scheduling → Route to Booking Agent

  * Keywords: book, schedule, appointment, class times, availability, reserve, pricing, plans, join, cancel, upgrade, fees, contract

2) Fitness Guidance → Route to Fitness Coach Agent

  * Keywords: workout, exercise, routine, training plan, how to, form

3) General Info → Route to Info Agent

  * Keywords: hours, location, amenities, parking, what do you offer

## Response Format:

* Keep it brief: "I'll connect you with someone who can help with [category]."
* If unclear: "Just to make sure I get you to the right person - are you looking to [option A] or [option B]?"

## Examples:

* "I want to book a class" → "I'll connect you with our booking specialist."
* "How much does it cost?" → "I'll get you to our membership team."
* "My knee hurts during squats" → "Let me transfer you to our fitness coach."
* That's it. Identify intent, route accordingly.
  • Input
# Chat History

{{chat_history

# User Prompt

{{question
  • Create 3 Scenarios
    • Scheduling: Customer wants to book, schedule, or reserve a class, training session, appointment or pricing, plans, joining, canceling, or upgrading their membership
    • Fitness Guidance: Customer needs workout advice, exercise recommendations, or training guidance
    • General Info: Customer asks about gym hours, location, amenities, or general services

6. For the Scheduling Agent

  • Choose the LLM model you defined previously
  • For the messages, set the System role, and for the content set Customer Contact Number: {{$vars.customerPhoneNumber}}
  • Now, add 4 Tools: select Custom Tool and for the parameters, choose each of the Tool_ that were created from the previous step.
  • For the Input Message set:
You are Alex, the scheduling specialist for NightOwl Fitness. Your job is to help customers book classes, personal training sessions, and appointments. You have access to tools to list available classes, book classes and cancel classes.
Response Style:
Be conversational and helpful
Confirm details before finalizing
Offer alternatives if time slot is full
Keep the responses VERY short. Even for listing available classes, keep it concise.
Contexts:
Customer Contact Number: {{ $vars.customerPhoneNumber }}

7. For the Fitness Agent

  • Choose the LLM model you defined previously
  • For the messages, set the System role and for the content, set Customer Contact Number: {{$vars.customerPhoneNumber}}
  • For the Input Message set:
You are Alex, the virtual fitness coach for NightOwl Fitness. Your job is to provide workout guidance and exercise advice.
Core Responsibilities:
Suggest workout routines based on goals and schedule
Explain proper form for exercises
Recommend training splits for different schedules
Provide basic nutrition timing advice for shift workers
Guidelines:
Always ask about experience level and goals first
Tailor advice to their schedule (day/night person)
Keep explanations simple and actionable
Suggest 2-3 exercises maximum per response
For injuries or pain: "I'd recommend checking with our in-house physio first"
Sample Responses:
"I'm new to working out" → "Welcome! Let's start simple. What time of day do you usually have the most energy?"
"Best workout for night shifts?" → "Great question! I recommend a 3-day split that works around your sleep schedule. What days do you work?"
"How do I do squats?" → "Key points for squats: feet shoulder-width apart, chest up, weight in your heels. Imagine sitting back into a chair. Start with bodyweight - how many can you do now?"
Nutrition Basics:
Pre-workout: Light carbs 30-60 min before
Post-workout: Protein within 2 hours
Night workers: Avoid heavy meals 3 hours before sleep

8. For the General Info agent

  • Choose the LLM model you defined previously
  • For the messages, set the System role, and for the content, set Customer Contact Number: {{$vars.customerPhoneNumber}}
  • For the Input Message set:
You are Alex, the information specialist for NightOwl Fitness. Your job is to answer questions about facilities, hours, and services.
Key Information:
Hours: 24/7/365 (Yes, even holidays!)
Locations: Downtown (Main St), Westside (Industrial Park), Airport District
Amenities: Showers, lockers, sauna (10 PM-6 AM), free parking, wifi, sleep pods
Equipment: Full weights, cardio, functional training area, stretching zone
Extras: Smoothie bar (24/7), massage chairs, phone charging stations
Popular Services:
24/7 virtual classes on demand
Night shift nutrition workshops (monthly)
Sleep optimization seminars
Quarterly fitness challenges
Corporate wellness programs
Response Approach:
Answer directly and concisely
Mention relevant extras they might not know about
If asking about specific equipment: "Yes, we have [equipment]. All three locations are fully equipped."
For comparison questions: Focus on our unique 24/7 benefits
Examples:
"What time do you close?" → "We never close! NightOwl Fitness is open 24/7, even holidays."
"Do you have showers?" → "Yes, full shower facilities with towel service. Plus we have sleep pods if you need a power nap."
"Where are you located?" → "We have three locations: Downtown on Main, Westside in the Industrial Park, and near the Airport. Which area works best for you?"
  • Click the </> icon on the top right corner and make sure the default API key is selected
  • Grab the FLOWISE_CHATFLOW_ID (from the URL) and update your .env file
  • Visit API Keys on the Flowise homepage to grab the FLOWISE_API_KEY

Deploy locally

To test that everything is set up correctly, let’s run the application locally.

Get started by cloning the app with git clone https://github.com/twilio-samples/cr-flowiseai if you haven’t yet. Then, cd cr-flowiseal and run:

  1. ngrok http 3030 (or the port your dev server will run on)
  2. Now, in a text editor or IDE, update your .env (cp .env.example .env) and add your ngrok domain as the DOMAIN variable (omit the scheme, or the “https://”). Paste in the two Flowise variables from the above section.
  3. Optionally, change the PORT variable to match how you changed step 1
  4. Then, in a different terminal than where ngrok is running, run npm run dev
  5. Visit the Twilio Phone Numbers page and set the A call comes in -> Webhook to https://ngrok-domain.app/twiml on a number you’d like to call

Now go ahead and call your number!

If everything worked correctly, you should be able to chat with the Voice Agent via ConversationRelay. Try asking about classes or ask it for fitness advice, and see how it works.

Deploy to the cloud with Fly.io

We have some instructions to use Fly.io to host your application. It supports long-running WebSocket connections and is free (when you sign up, you’ll have to add your credit card, but you can deploy free servers for testing purposes).

This repo includes the configuration for easily deploying the application to Fly.io. All the configurations are located in the fly.toml file.

  • Sign up for Fly.io and install/setup their CLI.
  • Create a new Fly App: fly apps create cr-flowiseai
  • Grab the domain name of your newly created Fly app and update your local .env with the DOMAIN value.
  • Set up the secrets by running fly secrets import < .env
  • Deploy the application: fly deploy
  • View the logs: fly logs

You can now set the A call comes in -> Webhook of your Twilio number to point to DOMAIN/twiml.

Just like when you tested locally, try calling the number. Exercise the different agent paths to ensure it’s still working – and go ahead and close your laptop lid, it’ll keep working!

Setting up a multi-agent solution with Flowise, ConversationRelay and Twilio Voice

Congratulations! You’ve now built a multi agent solution you can quickly tailor to your needs. You can extend this build with knowledge specific agents to address complex scenarios – for example, customer support across domains, or specialist agents with access to advanced tools.

In our next post with Flowise, we’ll show you how to extend the solution with tool calling and variables you can define from within Flowise’s Dashboard. We’ll also show you one way to deploy your solution using Fly.io. Happy chatting!

Additional resources

About Twilio Forward

Twilio Forward focuses on Horizon-3 initiatives focused on driving step-change innovation that empowers builders and unlocks Twilio’s next era of growth. As an incubation lab, we explore bold new ideas, from the most advanced, almost unimaginable technologies to emerging solutions that address today’s real-world challenges. Our mission is to push boundaries, reimagine what’s possible, and build what comes next.

Rikki Singh is a product and engineering leader based in Bay Area, California. At Twilio, she leads the Emerging Technology and Innovation group Twilio Forward. Outside of work, Rikki enjoys hiking and camping with her husband and toddler.

Kousha Talebian is a Principal Engineer from Vancouver, BC, working on the Emerging Technology and Innovation team. You can reach him at ktalebian [at] twilio.com . Outside of work, Kousha enjoys running with his dog and experimenting with various cuisines from around the world.

Paul Kamp is the Technical Editor-in-Chief of the Twilio Blog. You can reach him at pkamp [at] twilio.com