Building an Agentic AI System for Healthcare Support Using LangGraph

doctolib · Healthcare · 2024 · source Agentic: yes · promotional bias: low · source-backed · extracted with prompt 0.5.4 (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: Healthcare professional support automation

Doctolib needed to automate routine healthcare-support requests while preserving safety, user permissions, human confirmation for sensitive operations, and customer satisfaction.

Constraints:

Architecture

Doctolib built Alfred as a LangGraph-orchestrated multi-agent support system. Specialized agents such as Data Retriever and RAG operate as graph nodes, JWT-based context propagation preserves user permissions, sensitive actions are transformed into action requests checked by deterministic nodes, and users confirm the final human-readable operation.

Diagram confidence: reconstructed (reconstructed from prose).

flowchart LR
  healthcare-professional[Healthcare Professional] --> alfred-agent[Alfred Agent]
  alfred-agent --> langgraph-orchestrator[LangGraph Orchestrator]
  langgraph-orchestrator --> data-retriever-agent[Data Retriever Agent]
  langgraph-orchestrator --> rag-agent[RAG Agent]
  data-retriever-agent --> customer-data-apis[Customer Data APIs]
  customer-data-apis --> jwt-authentication[JWT Authentication]
  rag-agent --> support-knowledge-base[Support Knowledge Base]
  langgraph-orchestrator --> deterministic-action-checker[Deterministic Action Checker]
  deterministic-action-checker --> frontend-confirmation[Frontend Confirmation]
  frontend-confirmation --> alfred-agent
  literal-ai-evaluation[Literal.ai Evaluation] --> alfred-agent
Drag to pan · scroll or use +/− to zoom · reconstructed from the source's described component topology

Components

Component Role Interacts with
Healthcare Professional Doctolib user requesting support or calendar-access changes. Alfred Agent
Alfred Agent Agentic support assistant coordinating specialized agents and deterministic checks. Healthcare Professional, LangGraph Orchestrator, Frontend Confirmation
LangGraph Orchestrator Directed graph of LLM agents and deterministic processing nodes. Alfred Agent, Data Retriever Agent, RAG Agent, Deterministic Action Checker
Data Retriever Agent Specialized least-privilege agent for gathering customer data through curated APIs. LangGraph Orchestrator, Customer Data APIs
RAG Agent Specialized support-knowledge retrieval agent. LangGraph Orchestrator, Support Knowledge Base
Support Knowledge Base Doctolib support content used by the RAG agent to enrich responses. RAG Agent
Customer Data APIs Doctolib APIs accessed with propagated user context and service identity. Data Retriever Agent, JWT Authentication
JWT Authentication Service-to-service and user identity claims propagated to downstream services. Customer Data APIs
Deterministic Action Checker Fact-checks LLM-crafted action requests and fetches fresh human-readable resource data. LangGraph Orchestrator, Frontend Confirmation
Frontend Confirmation Human-in-the-loop confirmation UI for sensitive agenda access changes. Alfred Agent, Deterministic Action Checker
Literal.ai Evaluation Evaluation platform used for the healthcare support agent. Alfred Agent

Data flow

A practitioner asks Alfred for support, LangGraph routes among specialist agents and deterministic functions, RAG retrieves support knowledge, data agents call curated APIs under the user's permissions, sensitive update requests pass through a deterministic action checker, and the frontend shows a human-readable confirmation before execution.

“The interaction between agents is governed by a directed graph structure, where: * Each node is a computation/processing step: it can be an LLM-based agent or just a deterministic function * Each edge defines the possible communication paths”article, stated
“Under the hood, our agentic system is built on LangGraph, a powerful framework for orchestrating these complex agent interactions.”article, stated

Why this architecture

LangGraph lets Doctolib mix LLM agents with deterministic nodes, while human confirmation and JWT propagation keep sensitive healthcare actions safe.

“* Each node is a computation/processing step: it can be an LLM-based agent or just a deterministic function * Each edge defines the possible communication paths * The flow of information follows these predefined paths, depending on the output of the previous node”article, stated
“The final step of changing agenda accesses always remains in the users’ hands. This “human-in-the-loop” approach ensures safety while maintaining efficiency.”article, stated

Models used: LLMs · LangGraph · Literal.ai

Scale

Alternatives considered (roads not taken)

Linearly scale the human support team.

Rejected because: Doctolib wanted sustainable support costs while keeping humans focused on complex empathetic cases.

“The traditional approach would be to simply scale our support team linearly with demand. However, we saw an opportunity to think differently: what if we could have sustainable support costs while maintaining our high standards of customer satisfaction?”article, stated
“It’s not about replacing human interaction, but about enhancing it. By handling routine queries intelligently, we’re freeing our support teams to focus on cases where human expertise and empathy matter the most.”article, stated

Let the LLM directly execute sensitive agenda changes.

Rejected because: LLMs hallucinate, so the final sensitive action must stay in the user's hands.

“As non-deterministic systems, large language models do hallucinate. Sometimes a little, sometimes more. That’s a fact, and it is a part of the equation we cannot ignore.”article, stated
“After extensive discussions with engineers, legal department, and leadership, we established a crucial principle: the LLM will never directly execute sensitive actions. The final step of changing agenda accesses always remains in the users’ hands.”article, stated

Give agents elevated admin access.

Rejected because: Doctolib chose least-privilege user-context propagation so API calls respect existing authorization boundaries.

“However, following the principle of least privilege, we decided against giving them elevated “✌️admin✌️” access to our APIs. Instead, we implemented a more nuanced approach:”article, stated

Patterns

multi-agent-orchestration (support)

LangGraph coordinates specialized LLM agents and deterministic functions through directed graph paths.

"Each edge defines the possible communication paths

— article, stated

rag-retrieval (knowledge)

Doctolib's existing support RAG engine becomes a specialized agent in the system.

“we developed a Retrieval Augmented Generation (RAG) engine that enriches AI responses with our support knowledge base. Guess what? It will now become a specialized agent”article, stated

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

Users must confirm sensitive agenda access changes after deterministic verification.

“This “human-in-the-loop” approach ensures safety while maintaining efficiency.”article, stated

safety-policy-enforcement (security)

JWT claims and user-context propagation make agent API calls respect existing permissions.

“Agents inherit the exact same permissions as the user they’re assisting”article, stated
“Each API call respects existing authorization boundaries”article, stated

Tradeoffs

Sensitive action execution

Chose LLM drafts request, deterministic checker verifies, user confirms over LLM directly executes the update.

Rationale: The design preserves safety while still making the workflow efficient.

“AI agents should never directly execute sensitive operations.”article, stated

Agent permissions

Chose Inherited user permissions over Elevated admin access.

Rationale: Existing authorization boundaries remain consistent with normal user interactions.

“Security remains consistent with our regular user interactions”article, stated

Gotchas (what bit them)

Displaying a friendly name while sending the wrong ID would be dangerous.

Root cause: An LLM can hallucinate or mismatch resource identifiers.

Resolution: Use a deterministic Action Request Checker to fetch fresh technical and human-readable resource data.

“how to make sure that when we display “Maria Smith” it’s actually not John Doe’s ID that is sent”article, stated
“Ensure the parameters were not hallucinated by the LLM (fact-checking)”article, stated

Least privilege is harder than giving agents admin access.

Root cause: Agents need useful customer data but must act with the user's permissions.

Resolution: Propagate both service identity and user authorization through JWT claims.

“The service-to-service JWT (proving Alfred’s identity)”article, stated
“Users authenticate upon our identify provider (Keycloak). As a result they get a JWT as proof of identity”article, stated

Evaluation

Doctolib uses Literal.ai for evaluating the healthcare support agent, with quality assurance needs around context, response time, logs, and sensitive action correctness.

Metrics: Support-case volume · Daily message volume · Conversation context continuity · Response time consistency · Action request correctness

“For this crucial task, we leverage Literal.ai, a specialized platform for AI evaluation.”article, stated

Outcomes

The article frames the support workload as roughly 1,700 business-day cases, 10 interactions per conversation, and 17,000 messages daily.

“While our initial focus on calendar access management serves as a proof of concept, it’s just the beginning”article, stated