What to Do If Number of Intents Goes Skyrocket High

Dialogflow Mega Agents Vpodcastr Jana Bergant
by Jana Bergant

Dialogflow Mega Agents Tutorial

Hi there. If you’re working with any sort of QnA type of chatbots, you soon or later realize that the number of intents can go skyrocket high.

The more chatbot needs to know the more intents and training phrases you have.

Soon or later it can become a mess. It can get pretty crazy. And we all want to have a reliable bot. And satisfied users.

Turns out that to get a reliable chatbot, you need to be really careful with your intents and training phrases, especially when there’s a lot of them.

And there is another limitation with DialogFlow. One agent can only have 2000 intents and 250 entity types.

What I did with some of my clients is create an app that knew how to switch from one agent to another agent in the middle of the conversation. A hack, I know.

But somehow we needed to make this manageable. Up until now. Looks like we were not the only ones. DialogFlow recently published mega agents. Yej!

Dialogflow Mega Agent in Action

Let’s go through a sample bot that will have several agents combined into one powerful bot. This will be a company’s bot responsible for supporting employees in their daily activities.

The bot will be responsible for:

  • onboarding
  • checking daily with the employee and helping him with daily activities and tasks
  • he will be the knowledge base / Q&A chatbot helping employes

What we want is to have separated agents handling each of these processes:

  • one agent will be in charge of onboarding a new employee.
  • another agent will help with todo lists, issues, meetings, lunch, asking of employee satisfaction (yes, we care about our employees)
  • and we want an agent that will have in-depth knowledge of companies tools, processes, all the knowledge base an employee might need

So far all this was stuffed into one agent. Now we’ll separate it to standalone agents that work together under one MEGA agent.

The company is named Quanto (not real). And therefore the agent’s name will be QuantHelp.

Here is what we’ll do. We’ll create a mega agent. To create a mega agent in DialogFlow you need to tick ‘Set as a Mega agent’ when you set agents type. Like this:

Create a mega agent

Sub agents of the Mega agent in DialogFlow

Now you will see Sub Agent on the menu.

Before you can add Sub Agents you need to create them.

Now one big warning!

Each agent will still have its Google project. You cannot have more agents in one Google project. We will need to sey up permissions for the Mega agent.

Create Sub-Agents

Now we can create sub-agents. I’ll create DailiesBot, FAQBot, and OnBoardningBot. Each will be responsible for separate tasks.

  • DailiesBot will be helping with todo lists, issues, meetings, lunch, asking of employee satisfaction.
  • OnBoardingBot will handle the onboarding of new employees and
  • FAQBot is the companies knowledge base bot.

They all are combined int one mega QuanHelp bot. Let’s create them.

What to do if the Number of your Intents Skyrockets

Make sure you don’t set them as Mega Agents.

Add Sub-Agents to the Mega Agent

Now you can add them to the Mega agent as sub-agents. Like this:

What to do if the Number of your Intents Skyrockets

Add Intents Into Sub-Agents

Now we can add all the intent into sub-agents. For example, a FAQBot will be answering employees about the companies refund policy procedure.

What to do if the Number of your Intents Skyrockets

Refund policy intent

OnBoardingBot will do its job with onboarding:

What to do if the Number of your Intents Skyrockets

And DailiesBot will be helping with daily activities, like giving the next thing on the todo list:

What to do if the Number of your Intents Skyrockets

A todo list could read information from any issue tracker, managing tool a company might have.

What to do if the Number of your Intents Skyrockets

Set up the Permissions

And now comes an issue with permissions. Here is what happens when I go and greet the QuantHelp bot.

What to do if the Number of your Intents Skyrockets

IAM permissions are not set for the sub-agents. Let’s fix this.

If you go to your Mega agent’s settings you will see Google Project ID and the Service account. Copy this service account. We will use this account to access sub-agents.

What to do if the Number of your Intents Skyrockets

Then we can go to the Google Cloud console, to the project of the sub-agents. Into the IAM settings of the sub-agents Google project.

Here:

What to do if the Number of your Intents Skyrockets

Click the add button to add permissions. Now you can paste in the service account of the Mega Agent in here. Also, be sure to select the DialogFlow API client role.

Like this:

What to do if the Number of your Intents Skyrockets

We need to do this for all the sub-agents. This is how a Mega agent will have the right to query sub-agents.

Once you have added all the permissions you can go again to the DialogFlow’s test console and ask QuantHelp mega agent a question. Something like: next todo. Witch is an intent that was added to DailiesBot.

What to do if the Number of your Intents Skyrockets

The same thing would happen if we start onboarding with the mega agent.

What to do if the Number of your Intents Skyrockets

Diagnostic Info

What is the difference now with mega agents?

Let’s see the Diagnostic Info. In the output context, there is another property. Here you can see __most_recent_agents_ids__.

Also, you can see the output contexts name is __mega_agent_context__

Contexts in Mega Agent

Contexts work like before when we had one agent. They will have their lifespan and will persist during the conversation.

Let’s add two follow up intents to the onboarding intent. In the onboarding intent, I ask for the preferred type of coffee in the morning.

What to do if the Number of your Intents Skyrockets

I will create two follow up intents. One for coffee with milk.

What to do if the Number of your Intents Skyrockets

And one for black coffee.

What to do if the Number of your Intents Skyrockets

Like this:

What to do if the Number of your Intents Skyrockets

Now, when I answer in the onboarding question I will get contexts like this:

What to do if the Number of your Intents Skyrockets

As you can see now we have another output context. The first part of the context name is a google project Id of the agent the intent was from. That is onboardingBot project Id (onboardingbot-vpljux). And the second part is the output context of the onboarding intent, the startonboarding-folowup context.

Now one thing important about contexts. If I was to change the lifespan of the output context in the onboarding intent (startonboarding-folowup context) to 5, then this context would be active only while I’m interacting with the onboardingBot agent.

If I ask a question from the DailiesBot (next todo), then this context would not be visible.

But if I went back and ask onboarding bot something, this context would again be active. This is something to be aware of.

In any case, MEGA agents are a nice step to making massive bots more manageable. Mega agents are currently in the beta version. We hope to get more improvements from Google.

If you enjoyed this article, do subscribe to my channel. I will be posting more content I am passionate about. My passion is chatbots, conversations, living a good life as a freelance developer.

About the author

Jana Bergant
Jana Bergant
Freelance developer & instructor at

I'm a mentor for web developers. You'll get help navigating the sea of resources. By having an accountability partner and a cheerleader when you get stuck, you'll reach your goals faster. My passion is chatbots, conversational design and living a full life as a freelance developer.

Share this article

If you found value in this article, please consider helping others by sharing to your network. Just click one of the links below.

What do you think?

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Related Posts

Webby Statue Mod 1 Paige Harkness
Steve Tingiris Dabble Lab
Podcast Nick McCullum

Get notified about new articles

Upcoming Events


Featured Products