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:
- Healthcare support actions can modify sensitive agenda access rights.
- Agents need access to customer data without elevated admin privileges.
- The support workload is conversational and multi-turn.
- Hallucinated IDs or action parameters would be unsafe in healthcare workflows.
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
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.
Why this architecture
LangGraph lets Doctolib mix LLM agents with deterministic nodes, while human confirmation and JWT propagation keep sensitive healthcare actions safe.
Models used: LLMs · LangGraph · Literal.ai
Scale
- The target support scale is approximately 1,700 support cases per business day.“* ~1,700 support cases per business day * Assuming ~10 interactions per conversation * Results in ~17,000 messages daily While this volume is manageable from a pure throughput perspective, it presents interesting challenges:”article, stated
- Assuming about 10 interactions per conversation, that becomes about 17,000 messages daily.“* Assuming ~10 interactions per conversation * Results in ~17,000 messages daily While this volume is manageable from a pure throughput perspective, it presents interesting challenges: * Maintaining conversation context across multiple interactions”article, stated
- The initial use case is doctor-calendar access management.“For Q4 2024 we wanted to address one specific yet common scenario: managing access rights to a doctor’s calendar.”article, stated
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.
Let the LLM directly execute sensitive agenda changes.
Rejected because: LLMs hallucinate, so the final sensitive action must stay in the user's hands.
Give agents elevated admin access.
Rejected because: Doctolib chose least-privilege user-context propagation so API calls respect existing authorization boundaries.
Patterns
multi-agent-orchestration (support)
LangGraph coordinates specialized LLM agents and deterministic functions through directed graph paths.
"Each edge defines the possible communication paths
- The flow of information follows these predefined paths"
— article, stated
rag-retrieval (knowledge)
Doctolib's existing support RAG engine becomes a specialized agent in the system.
human-in-the-loop-gate (safety)
Users must confirm sensitive agenda access changes after deterministic verification.
safety-policy-enforcement (security)
JWT claims and user-context propagation make agent API calls respect existing permissions.
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.
Agent permissions
Chose Inherited user permissions over Elevated admin access.
Rationale: Existing authorization boundaries remain consistent with normal user interactions.
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.
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.
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
Outcomes
- Doctolib implemented an early LangGraph-based agentic support architecture.
- The first proof-of-concept targets doctor-calendar access management.
- The design preserves human confirmation and least-privilege access for sensitive healthcare operations.
The article frames the support workload as roughly 1,700 business-day cases, 10 interactions per conversation, and 17,000 messages daily.