Build a multi-agent customer support system with a supervisor that routes conversations to specialist agents. Then create a knowledge base and connect it so your agents can answer questions grounded in your documentation. By the end, you know how to:
- Create a supervisor with handoff rules
- Define specialist agents with distinct capabilities
- Configure context passing between agents
- Handle escalation and error scenarios
- Create a knowledge base and ingest documents
- Connect a knowledge base to an agent as a tool
- Test RAG-powered responses
Prerequisites
- Completed Add structured steps to an agent
- A project open in Studio
- Understanding of agents, tools, and flows
- Documents to upload (PDF, DOCX, TXT, or Markdown files) for the knowledge base section
What You’ll Build
A retail customer support system with:
- Retail_Supervisor — Routes customer queries to the right specialist.
- Order_Tracker — Handles order status and shipping inquiries.
- Returns_Agent — Processes returns and refund requests.
- Product_Advisor — Answers product questions and gives recommendations.
- A knowledge base — Powers agents with document-based search for accurate, grounded answers.
Build a Supervisor
Step 1: Create the order tracking agent
Create agents/order_tracker.agent.abl:
This agent defines its own HANDOFF rule. If a customer asks about a return during an order tracking conversation, the agent hands off to the Returns_Agent with the relevant context.
Step 2: Create the returns agent
Create agents/returns_agent.agent.abl:
Step 3: Create the product advisor agent
Create agents/product_advisor.agent.abl:
Step 4: Create the supervisor
Create supervisor.agent.abl at the project root:
Step 5: Understand the supervisor structure
The supervisor is the orchestration layer. Here is what each section does:
SUPERVISOR — Declares this as a supervisor (not an agent). Supervisors route conversations; they do not handle domain tasks directly.
TEMPLATES — Reusable message templates. TEMPLATE(welcome) references the named template.
ON_START — Runs when a new session begins. Sends the welcome message before the user types anything.
MEMORY — Session variables the supervisor tracks across the conversation.
HANDOFF — Routing rules ordered by priority. Each rule specifies:
- TO — The target agent
- WHEN — The condition that triggers the handoff
- CONTEXT — What data to pass to the target agent
- pass — List of session variables to include
- summary — A natural language description for the receiving agent
- RETURN — Whether control returns to the supervisor after the agent finishes
ESCALATE — Conditions that trigger escalation to a human agent.
ON_ERROR — Error handling for routing failures.
Add Delegation & Routing
Step 6: Configure context passing
The CONTEXT block controls what information flows between agents. Here is a more detailed example:
When RETURN: true, the conversation returns to the supervisor after the specialist agent finishes. ON_RETURN specifies what the supervisor does next. With RETURN: false, the specialist agent handles the rest of the session.
Step 7: Test the orchestration flow
Open the Chat panel and start a conversation:
The supervisor routes to Order_Tracker. The agent asks for the order number and provides status updates.
Try switching contexts:
The order tracker hands off to the returns agent, passing the order context along.
Start a new session and try:
The supervisor routes directly to Product_Advisor.
Step 8: Review the orchestration trace
Open the Traces panel to see the multi-agent flow:
- Supervisor receives message — Intent classification happens
- Handoff decision — The matching HANDOFF rule fires
- Context transfer — Session variables pass to the target agent
- Agent execution — The specialist agent handles the conversation
- Return or complete — The agent either returns to the supervisor or ends the session
Each agent’s execution appears as a nested span under the supervisor span. This gives you full visibility into routing decisions and context flow.
Project file structure
Add a Knowledge Base
Now add document-based knowledge so your agents can answer questions grounded in your content. You create a knowledge base, upload documents, and connect it to an agent using retrieval-augmented generation (RAG).
Step 9: Create a knowledge base in Studio
Open your project in Studio. Navigate to the Knowledge section in the left sidebar. Select Create Knowledge Base and configure it:
- Name:
product-docs
- Description: “Product documentation and help articles”
Studio creates the knowledge base and opens the document management view.
Step 10: Upload documents
Select Upload Documents and add your files. The platform supports:
- PDF documents
- DOCX (Microsoft Word)
- Plain text files (.txt)
- Markdown files (.md)
The platform processes each document through the ingestion pipeline:
- Extraction — Converts the document to plain text
- Chunking — Splits the text into semantic chunks
- Embedding — Generates vector embeddings for each chunk
- Indexing — Stores the chunks in the search index
The processing status appears next to each file. Wait for all documents to show “Indexed” status before continuing.
Create support_agent.agent.abl:
The agent uses three search tools:
- vocabulary_resolve — Maps informal or domain-specific terms (like “SSO” or “2FA”) to canonical forms for better search precision
- search_hybrid — Combines vector similarity with keyword matching for precise results
- search_vector — Pure semantic search for broader, meaning-based queries
Step 12: Connect the knowledge base in Studio
In Studio, open your agent’s configuration panel. Under Tools, you see the search tools defined in the ABL file. Select Configure next to search_hybrid and map it to your knowledge base:
- Index ID: Select
product-docs from the dropdown
Studio automatically configures the tool binding to use your knowledge base’s search index. The index_id parameter is resolved at runtime to the correct index.
Step 13: Test RAG-powered responses
Open the Chat panel and ask a question that relates to your uploaded documents:
The agent:
- Receives your question
- Calls
search_hybrid to search the knowledge base
- Receives relevant document chunks
- Synthesizes an answer based on the retrieved content
- Responds with the answer and source attribution
Open the Traces panel to see the RAG pipeline in action:
- Search query — The query sent to the search tool
- Retrieved chunks — The document segments returned
- Relevance scores — How closely each chunk matched
- Generated response — The final answer synthesized from the chunks
Connect Knowledge to Your Multi-Agent System
The knowledge base and multi-agent system are even more powerful together. Here is how to wire them up.
Update agents/product_advisor.agent.abl to include knowledge base search alongside catalog tools:
Now the Product Advisor can answer both “What laptops do you have under $1000?” (catalog search) and “Does the ProBook support USB-C charging?” (knowledge base search) in the same conversation.
Step 15: Add a knowledge-powered FAQ to the supervisor
You can also give the supervisor a knowledge tool for quick FAQ-style answers that do not require routing to a specialist:
This pattern keeps simple questions at the supervisor level while routing complex requests to specialists. Fewer handoffs mean faster responses and better user experience.
What You Learned
- SUPERVISOR is the orchestration layer that routes conversations to specialist agents
- HANDOFF rules define when and where to route based on intent
- CONTEXT controls what data flows between agents via
pass and summary
- RETURN: true sends control back to the supervisor; RETURN: false lets the agent finish the session
- ON_START sends a welcome message before the user types anything
- TEMPLATES define reusable messages referenced by name
- ESCALATE defines conditions for human handoff
- ON_ERROR handles routing failures with retry and fallback
- Agents can define their own HANDOFF rules for agent-to-agent transfers
- Knowledge bases store and index your documents for retrieval
- The ingestion pipeline extracts, chunks, embeds, and indexes documents
- search_hybrid combines vector similarity with keyword matching; search_vector performs pure semantic search
- vocabulary_resolve maps domain terms to canonical filters for precision
- RAG (retrieval-augmented generation) grounds agent responses in your content
- Knowledge tools can be added to individual agents or the supervisor for FAQ handling
Use RETURN: true on handoffs when you want the supervisor to resume after a specialist finishes. Use RETURN: false when the specialist should own the rest of the session.