Build a chatbot
Learn how to build a chatbot using our Agent APIs. In this tutorial, we create an onboarding assistant for a manufacturing use case. This chatbot answers employee questions from uploaded documents that contain safety protocols and equipment manuals. This example may provide inspiration for your specific use case.
What you will build
A single-page web app with a clean chat interface, powered by React for the frontend and Vectara's Agent APIs for the backend. The agent uses corpora and web search tools to provide beginner-friendly answers in Markdown format. The application has the following features:
The chatbot will look like this example:

Prerequisites
Before starting this tutorial, ensure you have the following:
- Basic knowledge of React and TypeScript.
- Vectara account: Sign up and get an API key with query and indexing permissions, or use your Personal API key.
- Install the latest releases of Node.js and npm.
This tutorial includes complete instructions for creating a corpus with sample manufacturing data, so no existing data is required.
Chatbot build overview
Follow this process to create the chatbot.
- Set up your Vectara corpus.
- Create an agent with search tools.
- Create a new React project.
- Install required dependencies.
- Create the project structure and components.
- Test your chatbot.
Step 1. Set up your corpus with sample data
Create a corpus and populate it with sample manufacturing data. This example shows you how to create a corpus with the API.
Create the corpus
CREATE CORPUS
Code example with bash syntax.1
Add sample documents
Index sample documents to populate your corpus. Here are example documents you can add:
Safety protocol document
INDEX SAFETY PROTOCOL DOCUMENT
Code example with bash syntax.1
Equipment manual document