First, let’s look at the high-level architectural flow (Fig. 3)
The workflow follows these steps:
- User (in this case, a Reply employee)
- Formulates a query in natural language
- Master Agent receives and evaluates which sub-agent(s) should handle the query
- Sub-agents process the query and extract relevant results
- Master Agent takes the results and formats them into HTML
- Results are displayed to the user through a conversational interface
Let’s dive deep into how our system processes queries and retrieves information.
The Master Agent: The Orchestra Conductor 🎼🪄🤵
The master agent acts as an intelligent orchestrator, performing several crucial tasks:
- Query Analysis: Interprets natural language queries to identify key elements
- Task Distribution: Determines which specialized agents to activate
- Result Synthesis: Combines and formats the final output for presentation
Think of it as a skilled conductor, coordinating different sections of an orchestra to create a harmonious performance.
Specialized Agents: The Expert Performers
It’s important to note that each agent operated on a different data source covering specific domains: “Projects”, “Events”, and “Posts”. Given that each data source had its unique structure, every agent was tasked with manipulating the data based on both the query received from the master agent and the specific characteristics of its data source. This led to the creation of three specialized agent types:
- Structured Data Agent: Handles SQL queries for well-organized, tabular data
- Unstructured Data Agent: Manages text-heavy content using advanced embedding techniques
- Hybrid Search Agent: Combines multiple search approaches for optimal results
A Practical Example 📝
Let’s walk through how our system handles a real query: “What GenAI events took place in Turin in 2024?”
1 Query Analysis Phase 🔍
The master agent identifies four key elements:
- “Events” (Structured — Category)
- “Turin” (Structured — Location)
- “2024” (Structured — Date)
- “GenAI” (Unstructured — Topic)
2 Search Strategy Selection ♟️
- For structured elements (Events, Turin, 2024) -> The system uses SQL queries to filter the initial dataset.
- For unstructured elements (GenAI) -> Implements hybrid search combining: GPT embeddings for semantic understanding and TF-IDF for rare term optimization.
3 Result Processing 📊
- Initial SQL filtering creates a focused subset of relevant events
- Hybrid search ranks results based on relevance to “GenAI”