FEATURED PROJECT

Multi-Agentic Chatbot

A multi-agent conversational system that dynamically routes user requests between specialized RAG and SQL agents for knowledge retrieval and structured-data analysis.

PythonFastAPILangChainLangGraphMySQLMCPRAGAI Agents
Multi-Agentic Chatbot

SYSTEM ARCHITECTURE

A multi-agent workflow for intelligent query routing.

The system analyzes each request, routes it to specialized agents, combines their results and generates a final response.

INPUT

User Query

Natural-language request

AGENT 01

Planner Agent

Understands the request and determines the required workflow.

ORCHESTRATION

Orchestrator

Routes the request to the appropriate specialized agents.

AGENT 02

RAG Agent

Handles knowledge-based questions by retrieving relevant contextual information from the knowledge source.

AGENT 03

SQL Agent

Handles structured-data questions by querying the connected database and returning relevant results.

SHARED WORKFLOW CONTEXT

Results from the specialized agents are carried forward through the workflow for final response generation.

AGENT 04

Response Generation Agent

Combines the available context and intermediate results to generate the final natural-language response.

OUTPUT

Final Response

HOW IT WORKS

One query, multiple sources of intelligence.

A single user request can require information from both unstructured knowledge sources and structured databases. The multi-agent workflow determines what information is required, retrieves it and combines the results into one response.

EXAMPLE USER QUERY

"What are the company's safety policies and how many incidents occurred last quarter?"

AGENT PROCESSING

01

Planner Agent

Identifies that the request contains two different information requirements: policy information and structured incident data.

02

Orchestrator

Routes the relevant parts of the request to the specialized RAG and SQL agents.

RAG AGENT

Retrieves policy information

Searches the knowledge source for relevant safety policies and returns the retrieved context.

SQL AGENT

Analyzes incident data

Queries the structured database to determine the number of incidents during the requested period.

04

Response Generation Agent

Combines the retrieved policy context and database results to generate a single coherent response.

FINAL RESPONSE

The system combines the relevant knowledge retrieved by the RAG agent with the structured results returned by the SQL agent and produces a unified natural-language response.

THE PROBLEM

Different questions require different sources.

A conversational system may receive questions that require completely different types of information. Some requests require retrieving information from documents, while others require querying structured data stored in a database.

Handling every type of request through a single workflow can make the system difficult to maintain and extend as new capabilities are introduced.

The solution was to separate responsibilities into specialized agents and coordinate them through an orchestration layer.

ARCHITECTURE COMPONENTS

Specialized agents with focused responsibilities.

Each component performs a focused responsibility while the orchestration layer coordinates the overall workflow.

01

Planner Agent

Analyzes the incoming request and determines the type of information and processing required.

02

Orchestrator

Coordinates the workflow and manages the routing of requests between specialized agents.

03

RAG Agent

Retrieves relevant contextual information from the knowledge source for knowledge-based questions.

04

SQL Agent

Interacts with structured database information to answer data-oriented questions.

05

Response Generation Agent

Combines the available context and intermediate results from the workflow to generate the final natural-language response.

REQUEST FLOW

From natural language to a contextual answer.

The workflow separates planning, retrieval, structured-data analysis and response generation into distinct stages.

01

User Query

The user submits a natural-language request.

02

Planning

The planner analyzes the request and determines the required processing.

03

Routing

The orchestrator routes the request to the appropriate specialized agent.

04

Agent Processing

The RAG and SQL agents retrieve the relevant unstructured and structured information.

05

Response Generation

The response generation agent combines the available context and produces the final answer.

ENGINEERING CHALLENGES

Designing the system around the problem.

Building a multi-agent system introduced challenges around query routing, specialized processing and combining information from different sources into a single response.

CHALLENGE 01

Routing different types of questions

User requests can require completely different sources of information and processing strategies.

SOLUTION

Planner + Orchestrator

The planner analyzes the request while the orchestrator controls the workflow and routes it toward the appropriate specialized agent.

CHALLENGE 02

Handling unstructured knowledge

Questions based on documents or other knowledge sources require contextual retrieval before generating an answer.

SOLUTION

Dedicated RAG Agent

A specialized RAG agent handles knowledge-oriented queries and provides relevant retrieved context to the workflow.

CHALLENGE 03

Querying structured business data

Database questions require structured querying and access to the underlying relational data.

SOLUTION

Dedicated SQL Agent

The SQL agent handles structured-data requests and retrieves the required information from the connected MySQL database.

CHALLENGE 04

Combining information from multiple agents

A complex request may require information produced by more than one specialized agent.

SOLUTION

Shared workflow context

Intermediate results from the specialized agents are carried through the workflow so they can be used by subsequent stages.

CHALLENGE 05

Producing one coherent answer

Results from different processing paths need to be transformed into a single natural-language response.

SOLUTION

Response Generation Agent

A dedicated response-generation stage consumes the available context and produces the final conversational response.

TECHNOLOGY

Technology stack

PythonFastAPILangChainLangGraphRAGMySQLMCPLLMs

KEY ENGINEERING IDEA

Specialized intelligence coordinated through a shared workflow.

Instead of relying on a single agent to handle every type of request, the system separates knowledge retrieval and structured-data analysis into specialized agents. Their intermediate results are then made available to the response generation agent, which produces the final answer.