Dialogflow Mega Agent
A Mega Agent..so what?!
Ok so you could argue that I need to get out more...but I was excited to notice yesterday that there is a new feature which has sneaked into the Dialogflow console. This is the concept of a Mega Agent. It's the ability to set an agent type to mega agent so that you can combine multiple agents into one single agent.
So why is this so important? At The Bot Forge, some of our Dialogflow agents can have 1000's of intents, particularly if they are providing an information service for a knowledge base. Unfortunately, the knowledge base functionality can be limiting as looked at in my post: Dialogflow Knowledge Connectors so it's often necessary to create one intent per FAQ to get the required accuracy and control. This can quickly use up an agents 2000 intent limit.
We have recently had to look at creating our own version of a mega agent. This was to be used in a website chatbot implementation which would serve as a gatekeeper to initial enquiries so that we could hand over a conversation to a specific chatbot overseeing a specific knowledge domain. So not really ideal and involving more middleware complexity particularly as we were planning to handle some sort of context between all the agents.
There are some caveats, its still one GCP project and there is a maximum of 10 sub-agents per mega agent.
A Quick look at Mega Agents
It’s also important to remember this feature is in beta! You can read more about setting up the new Mega Agent here. At the time of writing the link on the add agent page is incorrect.
I took a really quick look at the new mega agent functionality.
Adding a mega agent
Adding a Mega Agent is pretty straightforward, when you add a new agent then you just select the switch:
Your mega agents are then listed in the agent list:
Adding a sub-agent
Once the agent is selected then a Sub Agent button is enabled:
After selecting the sub-agents button I had already created a test agent to use as my sub-agent so I connected it.
When choosing adding sub-agents you can select an environment or whether to include or exclude the knowledge Base. There is also a handy link to the sub-agent:
My test agent was a simple default agent with one added intent:
Does_mega_agent_work with one training phrase "does mega agent work"
Testing it out
So far so good. Just to recap I have created a mega agent and another agent to act as my sub. So now for a test drive of my Mega Agent in the Dialogflow simulator
Unfortunately, I didn't get the result I hoped for:
This was obviously an IAM permissions issue so I figured probably something which I had not done. I went back to the information page and re-read the section: Set up roles
Basically, to interact with a mega agent in the Dialogflow simulator, the service account that is linked to your mega agent in the Dialogflow Console needs a role with detect intent access for all sub-agents. To achieve this I went to the IAM permissions page for the sub-agent and added the mega agent's service account email address as a member of the project with a role of Dialogflow API Client.
Going back to the simulator and trying out does mega agent again resulted in the correct response from the sub-agent!
Where to go from here with mega agents.
For me, this is a major step for chatbots which have big numbers of intents > 2000. Or where different teams need to manage a particular knowledge area for one chatbot subject, use-case or topic area.
This post has really only taken a quick view of the new Dialogflow mega agent functionality. In a later post, I want to investigate leveraging contexts between agents and use a more complex example.
There are still some areas which need work though. The biggest one which springs to mind is that the training pages area of the console for a mega agent needs to be able to support the concept of sub-agents to assign sub intents. It's still just a beta feature so hopefully, more to come!
About The Bot Forge
Consistently named as one of the top-ranked AI companies in the UK, The Bot Forge is a UK-based agency that specialises in chatbot & voice assistant design, development and optimisation.
If you'd like a no-obligation chat to discuss your project with one of our team, please book a free consultation.