Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.
Muralidhar Chavan edited this page Feb 5, 2019 · 8 revisions

Short title

Compose domain specific bots using an agent bot

Long title

Bots Compose showcases how Watson Assistant can be used to compose bots, serving different domains, coordinated by an Agent Bot.

Author

URLs

Github repo

Other URLs

Summary

There are scenarios where an user wants to have a conversation involving multiple domains. For example - When I want to travel to a place, I want to query for the weather and then book a cab or flight. I might have to end up switching between two bots, weather bot and travel bot. What if I could just have one interface bot which will redirect my messages to a specific bot and get answers to me?

Well, this code pattern showcases an implementation of this approach.

Technologies

  • Conversation
  • Artificial Intelligence
  • Node.js

Description

Generally bots address queries related to a specific domain or topic. If a user wants to query for something from a different domain then the user will have to switch to a different bot and ask question. E.g. If I want to travel to a place, I might query for weather and also book a cab or flight. I might have to end up switching between two bots, weather bot and travel bot. What if I could just have one interface bot which will redirect my messages to a specific bot and get answers to me? Well, this code pattern showcases an implementation of this approach.

The solution here is to have an agent bot (or an interface bot) and a few other bots which can handle queries for a specific domain, let's call these specific bots. The agent bot knows about the specific bots and also about which domain each of them can handle. When user initiates conversation with agent bot, the agent bot will understand the intent of user query and it will redirect the user query to a specific bot. Subsequent requests from user are redirected to specific bot. When the conversation with the specific bot is over or when the specific bot is not able to handle the request, the control is given back to agent bot which will then redirect the messages to appropriate bot.

This approach provides and seamless experience for the user. It can be used by organisations which provide a host of services to its customers like financial services, tours and travel agencies, news agencies etc..

Advantages with this approach are:

  • plug and play the bots
  • Modular approach facilitates bots composition
  • Come up with new services by composing two or more bots
  • Easy to maintain, make changes, add/remove functionalities
  • Easy to troubleshoot issues
  • Transparent to user

In this code pattern we will use Watson assistant bot for building bots and Nodejs application as orchestration layer.

Flow

Architecture

  1. User accesses web application and types in a message. Nodejs application, an orchestration later, sends user message to agent bot
  2. Agent bot determines the intent of the message and responds with the specific bot details, to which the message needs to be redirected.
  3. Nodejs application sends message to the specific bot (Weather Bot, in this case). Specific bot responds. Conversation continues between user and specific bot.
  4. When the conversation with specific bot is over, user message is then sent to agent bot to determine the intent.
  5. Nodejs application sends message to the specific bot (Travel Bot, in this case). Specific bot responds. Conversation continues between user and specific bot.

Instructions

Find the detailed steps for this pattern in the readme file. The steps will show you how to:

  1. Create Watson Assistant service instance on IBM Cloud.
  2. Download the code from GitHub.
  3. Create bots by importing files from git repo.
  4. Configure and deploy the application on IBM Cloud.
  5. Run the application.
  6. If required, add more bots.

Components and services

  • IBM Cloud
  • Node Package Manager
  • Watson Assistant (formerly Conversation)
  • SDK for Node.js

Runtimes

  • node

Related IBM Developer content

Related links

Announcement

A chatbot is an application that facilitates conversation between a human and a machine, in a natural language way. Chatbots are mostly used for customer service and involves dialog between humans and bots. They use artificial intelligence technology to understand human conversation and provide with relevant information.

Typically chatbots are designed to cater to a domain specific queries from humans. e.g. a Weather Bot can handle messages such as What is the weather forecast for today?, What will be the maxiumum temperature tomorrow?, Will it rain in the evening?. A Travel Bot can handle questions such as Book a cab, Book a flight, What is the flight duration between Bengaluru and Mumbai?. A human user will have to switch between bots to ask questions related to different domain bots. There can be several bots and expecting a user to switch between bots can be unreasonable.

How about having only one interface for different domain bots and the user does not need to know or switch between bots for different domain questions? Well, the Code Pattern addresses this situation. In this Code Pattern, we build two domain specific Bots along with an agent bot. Agent bot deflects the queries to the specific bot by understanding the intent of the user message. User is not bothered with switching between the bots and remains transparent to the user as to which bot responded to the query.

In this solution, new bots can be used as plug and play with a simple configuration update. The solution becomes extensible and flexible to make necessary changes.

This approach provides a seamless experience for the user. It can be used by organisations which provide a host of services to its customers like financial services, tours and travel agencies, news agencies etc..

Advantages with this approach are:

  • plug and play the bots
  • Modular approach facilitates bots composition
  • Come up with new services by composing two or more bots
  • Easy to maintain, make changes, add/remove functionalities
  • Easy to troubleshoot issues
  • Transparent to user

This code pattern uses Watson Assistant bot for building bots and Node.js application as orchestration layer.