Building a Simple Multi-Agent System with ChatBotKit
In this tutorial, we'll explore how to build a simple multi-agent system using ChatBotKit. We'll create multiple bots with different skillsets and enable them to collaborate in order to achieve specific tasks. By leveraging the Bot Ask (bot/ask) and Bot Call (bot/call) abilities, we can create a master bot that orchestrates communication between the other bots.
Understanding Bot Ask vs. Bot Call
Before diving in, it helps to understand the two main ways one bot can communicate with another:
- Bot Ask (
bot/ask) — Sends a standalone question to another bot. The target bot only sees the question itself, with no surrounding conversation context. This is lightweight and efficient for simple lookups. - Bot Call (
bot/call) — Invokes another bot with the full conversation context, letting it generate richer, more context-aware responses. Use this for complex tasks where the downstream bot needs to understand what's already been discussed.
Both abilities also have dynamic variants (bot/ask[by-id] and bot/call[by-id]) that let you specify the target bot's ID at runtime rather than wiring it statically in the blueprint.
Step 1: Create Multiple Bots in a Blueprint
- In ChatBotKit, open the Blueprint Designer and start with a blank blueprint.
- Add a master bot with its own skillset. This bot will orchestrate the others.
- Add a second bot with a web search skillset (e.g., using the Web Search ability from Serper or Brave).
- Add a third bot with a web fetch skillset (using the Fetch Web Page (
fetch/text/get) ability).
You now have three bots with distinct, complementary capabilities.
Step 2: Assign Abilities to Each Bot
Master bot skillset
Add the Bot Ask (bot/ask[by-id]) ability to the master bot's skillset. This gives it the power to delegate questions to the specialist bots by their ID. For tasks that require conversational context to be passed along, use Bot Call (bot/call[by-id]) instead.
Web search bot skillset
Add a web search ability such as Web Search from Serper (serper/search/web) or Brave (brave/search/web). These require an API key configured as a secret in ChatBotKit.
Web fetch bot skillset
Add the Fetch Web Page (fetch/text/get) ability. This bot retrieves and converts web page content to plain text, which the master bot can then summarize or reason over.
Step 3: Configure the Master Bot's Backstory
In the master bot's backstory, give it explicit instructions about which specialist bot handles which task. Reference each bot by its ID (visible in the blueprint designer when you click on a bot node). For example:
You are a research assistant. When you need to search the web, delegate to bot
with ID <web-search-bot-id> using the Bot Ask ability. When you need to read
the full content of a web page, delegate to bot with ID <web-fetch-bot-id>.
Combine the results and provide a clear, concise answer to the user.
Save the blueprint after configuring all three bots.
Step 4: Test the Multi-Agent System
- Open Collabo, ChatBotKit's built-in testing environment for blueprints.
- Send a command to the master bot such as: "Find anything about ChatBotKit and give me a summary."
- Observe how the master bot delegates the search to the web search bot, then optionally asks the fetch bot to retrieve a specific page, and finally synthesizes the results into a summary.
Extending the System
- Add more specialist bots — Introduce bots for tasks like database lookups, email drafting, or calendar management and register their IDs in the master bot's backstory.
- Use Bot Call for richer delegation — Switch from
bot/ask[by-id]tobot/call[by-id]when the specialist bot needs full conversation context to perform its task well. - Add memory — Attach a Memory ability to the master bot so it can remember facts across turns without re-delegating the same lookups.
- Explore agent spawning — For more advanced workflows, the Agent Execute (
agent/execute) ability can spawn a dedicated sub-agent with its own backstory and model, giving you finer control over reasoning strategies (e.g., pairing a planner with an executor and an evaluator).
Conclusion
ChatBotKit makes it straightforward to build multi-agent systems where intelligent bots collaborate to accomplish tasks. By creating specialist bots with focused skillsets and wiring them together through the bot/ask or bot/call abilities, you can design a master bot that coordinates complex workflows without needing any custom code.
Experiment with different bot configurations, ability combinations, and communication patterns to create powerful pipelines tailored to your specific needs.