Implementing Multi-Agent RAG Architecture for Customer Care Automation

doctolib · Healthcare · 2024 · source Agentic: yes · promotional bias: low · source-backed · extracted with prompt 0.5.6 (schema v2)

Generated from extraction.json — do not edit by hand. Every claim cites verbatim source evidence; stated means the quote directly asserts the claim, implied means it supports it indirectly.

Problem

Domain: Agentic customer-care automation for healthcare support workflows

Doctolib wanted to move beyond a basic RAG customer-care assistant so the system could handle multi-step support tasks, ask clarifying questions, fetch user/context data, execute back-end actions, and route between specialized domains without letting a single large prompt or general-purpose agent become unreliable.

Constraints:

Architecture

Doctolib selected LangGraph to build a hierarchical multi-agent RAG architecture for customer care. A root assistant greets the user, converses until a clear Doctolib query emerges, and routes the query with an ML classifier to a specialized assistant. Each specialized assistant owns one or two use cases, with a smaller prompt, fewer tools, and focused context. Assistants can use data-fetching tools, the existing FAQ/RAG search tool, sensitive execution tools for back-end customer-support actions, and completion/cancellation tools that return the flow to the root assistant. Sensitive tools include a fact-check step to verify arguments before execution and require explicit user validation.

Diagram confidence: explicit (topology described by the source).

flowchart LR
  User["User"] --> Root_assistant["Root assistant"]
  Root_assistant --> ML_routing_classifier["ML routing classifier"]
  ML_routing_classifier --> Specialized_assistants["Specialized assistants"]
  Root_assistant --> Specialized_assistants
  Specialized_assistants --> Data_fetching_tools["Data fetching tools"]
  Specialized_assistants --> FAQ_search_tool["FAQ search tool"]
  Specialized_assistants --> Sensitive_execution_tools["Sensitive execution tools"]
  Specialized_assistants --> Task_completion_tools["Task completion tools"]
  Data_fetching_tools --> Doctolib_databases["Doctolib databases"]
  FAQ_search_tool --> FAQ_knowledge_base["FAQ knowledge base"]
  Sensitive_execution_tools --> Fact_check_step["Fact-check step"]
  Fact_check_step --> User_validation_gate["User validation gate"]
  User_validation_gate --> User
  User_validation_gate --> Customer_support_back_end["Customer support back end"]
  Task_completion_tools --> Root_assistant
  LangGraph_runtime["LangGraph runtime"] --> Root_assistant
  LangGraph_runtime --> Specialized_assistants
  LangGraph_runtime --> Deterministic_functions["Deterministic functions"]
  Doctolib_databases --> Data_referential["Data referential"]
  API_documentation["API documentation"] --> Data_referential
  API_documentation --> Sensitive_execution_tools
  Evaluation_tooling["Evaluation tooling"] --> LangGraph_runtime
Drag to pan · scroll or use +/− to zoom · reconstructed from the source's described component topology

Components

Component Role Interacts with
User Practitioner or customer-care user asking for help with a Doctolib support task. Root assistant, User validation gate
Root assistant Primary LLM assistant that greets the user, elicits a clear query, and routes to the correct specialized assistant. User, ML routing classifier, Specialized assistants
ML routing classifier Classification model used by the root assistant to route a query to the appropriate specialized assistant. Root assistant, Specialized assistants
Specialized assistants Focused LLM agents, each handling one or two use cases with a smaller prompt and limited tool set. Root assistant, Data fetching tools, FAQ search tool, Sensitive execution tools, Task completion tools
Data fetching tools Tools that retrieve user or query context from relevant Doctolib database resources. Specialized assistants, Doctolib databases
FAQ search tool Existing RAG component reused as one tool among the specialized assistant's tools. Specialized assistants, FAQ knowledge base
Sensitive execution tools Tools that automate customer-support back-end actions and require user validation before execution. Specialized assistants, Fact-check step, User validation gate, Customer support back end
Fact-check step Safety net that checks tool arguments are properly filled before sensitive execution. Sensitive execution tools, User validation gate
User validation gate Explicit user confirmation before executing sensitive actions on the user's behalf. User, Fact-check step, Sensitive execution tools, Customer support back end
Task completion tools Signals task completion or cancellation and loops the conversation back to the root assistant. Specialized assistants, Root assistant
LangGraph runtime Stateful cyclical graph framework for multi-agent workflows with nodes, branches, loops, and conditional logic. Root assistant, Specialized assistants, Deterministic functions
Deterministic functions Non-LLM graph nodes used for processing steps and control flow. LangGraph runtime
Doctolib databases Data resources used to enrich customer-care context and execute actions. Data fetching tools, Data referential
FAQ knowledge base RAG source from the earlier implementation, now exposed as an assistant tool. FAQ search tool
Data referential Structured dataset mapping scopes/use cases to prompts, context, tools, data tables, and instructions. Specialized assistants, Doctolib databases, API documentation
API documentation OpenAPI-style specifications and natural-language descriptions used to create correct action tools. Data referential, Sensitive execution tools
Evaluation tooling Future/error-analysis tooling such as Literal or LangSmith for evaluating components and root causes. LangGraph runtime, Specialized assistants

Data flow

A user asks a customer-care question. The root assistant interacts until the request is clear, then routes it to a specialized assistant using an ML classification model. The specialized assistant may fetch contextual data, search FAQs through the original RAG component, ask clarifying questions, and prepare a sensitive execution tool call. Before an action such as granting agenda access runs, the system checks tool arguments and asks the user for validation. When the task is completed or canceled, a completion tool loops the conversation back to the root assistant.

"The root assistant goals are :

“Routing the user query to the correct specialized assistant (currently based on a ML classification model)”article, stated
“Before giving his secretary access, the arguments are checked and we ask for user validation to execute the action on its behalf.”article, stated

Why this architecture

Doctolib chose specialized agents and LangGraph to reduce the pressure on any one LLM, constrain prompts and tool sets, and enable loops, conditional branches, and human validation around sensitive actions. The design is intended to make customer-care tasks more generalizable while reducing hallucination, tool-choice variance, and prompt-size problems.

3 supporting quotes
“It eases the pressure on having one agent do everything and enables better agents because they are specialized.”article, stated
“We created those specialized agents to reduce the pressure on them, by limiting their scope, prompt size and number of tools associated.”article, stated
“LangGraph models all interactions as cyclical graphs. A graph is made of nodes and branches”article, stated

Models used: LLM-based root assistant · LLM-based specialized assistants · ML classification model · LangGraph · LangChain

Scale

Oct 7, 2024"

— article, stated

Alternatives considered (roads not taken)

Continue with a basic RAG-only system

Rejected because: Doctolib needed multi-step reasoning, tool use, API calls, follow-up questions, and action execution beyond retrieval and response generation.

“Due to some limits, we decided to research more powerful solutions, such as Agentic frameworks.”article, stated
“This multi-step reasoning capability enables more complex tasks like formulating follow-up questions, comparing documents, fetching data, making API calls or routing to other agents.”article, stated

Hard-coded bot flow

Rejected because: The team wanted agents to decide which actions to take and in what sequence instead of following a hard-coded next step.

“This is the main difference from a BOT system, which is hard-coded on what to do next. Here, the LLMs decide what to do and in what sequence.”article, stated

One generalist agent handling all customer-care tasks

Rejected because: A broad agent would have larger prompts, more tools, and more behavior variance, so Doctolib split scope across specialized assistants.

“It eases the pressure on having one agent do everything and enables better agents because they are specialized.”article, stated
“limiting their scope, prompt size and number of tools associated.”article, stated

Other agent frameworks such as CrewAI or AutoGen

Rejected because: Doctolib selected LangGraph for flexibility, security guardrails, simpler user interaction, clearer documentation, and LangChain ecosystem integration.

“we explored several new frameworks (crew.ai, autogen, LangGraph).”article, stated
“After a comparison, we chose LangGraph (reasons below), which is a powerful multi-agent framework”article, stated

Execute sensitive customer-support actions without user validation

Rejected because: Back-end actions require explicit validation and argument checks before being run on a user's behalf.

“Tools, classified as sensitive (asking for user validation), to automate the Customer Support back-end actions”article, stated
“It has a fact check step as a safety net, to make sure that the arguments of the tool are properly filled”article, stated

Patterns

multi-agent-orchestration (agent-architecture)

Doctolib coordinates a root assistant with several specialized assistants, each scoped to limited use cases and tools.

“we’ve got multi-agent orchestration. Imagine having multiple specialized agents, each being an expert in their own domain or data source”article, stated
“the agentic framework is built on two types of LLM agents:”article, stated

rag-retrieval (knowledge-architecture)

The original RAG/FAQ search system remains available as one tool that specialized agents can invoke.

“A FAQ search tool, which is actually the RAG described in the first paragraph”article, stated

tool-use-orchestration (agent-architecture)

Specialized assistants choose between context-fetching tools, FAQ search, sensitive execution tools, and completion/cancellation tools.

“It can have access to tools used to run specific tasks such as retrieving data, fetching data, reading a document, changing data in a database”article, stated
“A tool indicating that the task is complete or canceled to loop back to the root assistant”article, stated

human-in-the-loop-gate (governance)

Sensitive tools require explicit user validation before customer-support actions are executed.

“Before giving his secretary access, the arguments are checked and we ask for user validation to execute the action on its behalf.”article, stated
“Tools, classified as sensitive (asking for user validation), to automate the Customer Support back-end actions”article, stated

safety-policy-enforcement (governance)

The system classifies sensitive tools and fact-checks tool arguments before allowing actions against back-end systems.

“The sensitive tool is instantiated with applicative APIs documentationIt has a fact check step as a safety net”article, stated
“to make sure that the arguments of the tool are properly filled by the specialized assistant”article, stated

data-quality-loop (quality)

Doctolib treats data referentials, API documentation, OpenAPI specs, governance, and labeled data as core inputs for improving agent reliability.

“The effectiveness of agentic RAG agents hinges on the accuracy, completeness, and relevance of the data they use.”article, stated
“providing labeled data to better guide the agents will reduce the complexity of the tasks the agentic systems face”article, stated

eval-driven-development (quality)

The team identifies multi-component evaluation as critical for finding performance bottlenecks and error root causes before production deployment.

“The evaluation part of the system is a critical aspect, yet very complex as the system is composed of many bricks that need to be evaluated separately”article, stated
“Frameworks such as Literal or Langsmith can help us understand error root causes of our system.”article, stated

context-compaction (context-management)

The specialized-agent design reduces prompt size and tool scope to mitigate long-context attention problems.

“To use an agentic architecture, we must feed all the relevant information about the agent (tools description and execution, stack of messages…) through the prompt”article, stated
“Reducing the task expected from a LLM and limiting its degree of freedom can mitigate this variance.”article, stated

Tradeoffs

LangGraph framework selection

Chose LangGraph on top of LangChain over CrewAI, AutoGen, or continuing without an agentic framework.

Rationale: Doctolib preferred LangGraph's flexibility, sensitive-tool guardrails, simpler user interaction, clearer documentation, and LangChain integration.

“we explored several new frameworks (crew.ai, autogen, LangGraph).”article, stated
“It best suits our use case. It offers the most flexibility to develop, while providing some security guardrails (sensitive tools)”article, stated

Specialized assistants

Chose multiple agents with fixed one-or-two-use-case scopes over one general assistant with all tools and instructions.

Rationale: Specialization limits prompt size, tool count, and freedom of action, reducing variance and improving reliability.

“each specialized assistant is meant to handle requests over a fixed scope (one or two use cases).”article, stated
“limiting their scope, prompt size and number of tools associated.”article, stated

Sensitive tool validation

Chose fact-check and user validation before execution over agent-only execution of back-end actions.

Rationale: Customer-support actions can affect real user accounts, so sensitive tools need argument checks and explicit user approval.

“Tools, classified as sensitive (asking for user validation), to automate the Customer Support back-end actions”article, stated
“It has a fact check step as a safety net, to make sure that the arguments of the tool are properly filled”article, stated

Documentation as agent input

Chose API docs, OpenAPI specs, and data referentials as structured inputs over hand-written agent prompts disconnected from source-of-truth APIs.

Rationale: Correct action execution depends on accurate tool arguments, API semantics, and governed data descriptions.

“the quality of our system also depends directly on the quality of code, which can now be treated as a valuable source of information for our system.”article, stated
“The goal is to use the OpenAPI specifications of all the APIs to directly feed our system.”article, stated

POC before production

Chose continue iterating on robustness, evaluation, and cross-team dependencies over declaring the agentic architecture production-ready.

Rationale: The team acknowledges LangGraph maturity, evaluation complexity, robustness, and organizational dependencies still need work.

“we still have many challenges ahead of us to make this a real AI product, reliable and scalable.”article, stated
“we need to achieve a very strong robustness level of our system to be confident to deploy it in production.”article, stated

Gotchas (what bit them)

Agents do not consistently choose the right tool or parameters.

Root cause: LLM behavior is non-deterministic, especially when prompt size and degrees of freedom grow.

Resolution: Reduce the task expected from each LLM, specialize assistants, limit tools, and fact-check sensitive tool arguments.

3 supporting quotes
“It does not always invoke the correct tool at the right moment”article, stated
“It does not always execute tools with the proper specified parameters”article, stated
“Reducing the task expected from a LLM and limiting its degree of freedom can mitigate this variance.”article, stated

Large agent prompts cause instruction-following degradation.

Root cause: Agent prompts include tool descriptions, execution details, message history, and other relevant information, creating lost-in-the-middle risk.

Resolution: Limit specialized assistant scope, prompt size, and tool count.

“This leads to very large prompts.”article, stated
“the more information the LLM gets in the prompt, the less likely the LLM will follow our guidelines.”article, stated

Unstructured context extraction is unreliable.

Root cause: Agents must extract useful information from unstructured data and interpret it to ask relevant questions.

Resolution: Create a clear data referential and labeled data to guide agents through smaller manageable tasks.

“the agent should extract useful information and make sense of unstructured data in order to ask relevant questions.”article, stated
“The goal is to create a structured dataset breaking down the user queries into big use cases or user scenarios”article, stated

API and data documentation become part of the AI system.

Root cause: Agents need natural-language descriptions of product APIs, tool arguments, tables, and tasks to execute actions correctly.

Resolution: Use OpenAPI specifications, strong data governance, and high-quality code documentation as data sources for the agents.

“The documentation of the APIs will be needed to create the right tools for our agents, all the relevant arguments with the correct type and description.”article, stated
“The goal is to use the OpenAPI specifications of all the APIs to directly feed our system.”article, stated

Evaluating multi-agent systems is not a single-model metric problem.

Root cause: The system has many interdependent bricks that need separate evaluation to locate bottlenecks and root causes.

Resolution: Evaluate components separately and use tracing/evaluation frameworks such as Literal or LangSmith for root-cause analysis.

“the system is composed of many bricks that need to be evaluated separately to understand the performance bottlenecks.”article, stated
“Frameworks such as Literal or Langsmith can help us understand error root causes of our system.”article, stated

Productionizing the POC requires organizational change.

Root cause: Production deployment depends on cross-team synchronization, governed data assets, and a robust library/tooling foundation.

Resolution: Coordinate design, feature, PM, ML platform, data governance, and documentation work before production rollout.

“we need a strong collaboration and synchronisation with the different teams involved (design, feature teams, PM, ML Platform…).”article, stated
“We need to develop real data assets that are correctly governed and maintained, which need organizational change in the whole company.”article, stated

Evaluation

Doctolib explicitly says evaluation is critical but complex because the system has many components that must be evaluated separately. The article does not report quantitative performance metrics; it identifies needed evaluation tooling such as Literal or LangSmith, plus component-level evaluation to find bottlenecks and root causes before production confidence.

Metrics: no quantitative production metrics reported · component-level evaluation required · tool-choice correctness · tool-argument correctness · root-cause analysis through Literal or LangSmith · robustness level required before production deployment · data referential freshness and governance

3 supporting quotes
“The evaluation part of the system is a critical aspect, yet very complex as the system is composed of many bricks that need to be evaluated separately”article, stated
“Frameworks such as Literal or Langsmith can help us understand error root causes of our system.”article, stated
“we need to achieve a very strong robustness level of our system to be confident to deploy it in production.”article, stated

Outcomes

This is valuable precisely because it is honest POC evidence. The architecture is strong, but the extraction should not count it as proof that multi-agent customer-care automation is production-ready. Its durable lessons are specialization, sensitive-tool validation, and documentation/data governance as prerequisites for action-taking agents.

3 supporting quotes
“Many thanks to the incredible team that worked on the project and developed the POC”article, stated
“This architecture enabled us to tackle a first use case that you can see in the demo above.”article, stated
“Even if it represents an opportunity full of promise that we hope could be a generic brick that we could plug before managing any user intent”article, stated