AI System for Doctor Appointment Management

Emmanuel Ezeokeke

Emmanuel Ezeokeke

Summary

An intelligent conversational AI system that manages doctor appointments through natural language. Built with LangGraph's multi-agent architecture, it uses a supervisor pattern to coordinate specialized agents that handle appointment inquiries and bookings. Users can check doctor availability, book appointments, cancel, or reschedule—all through plain English queries via a Streamlit web interface or REST API.

Details

Architecture Overview

The system implements a supervisor-worker pattern with three core nodes:

Supervisor Node

Acts as the orchestrator and decision-maker
Uses GPT-4o with structured output to route queries to appropriate agents Analyzes conversation context to determine when tasks are complete
Implements recursion limits and circular conversation detection to prevent infinite loops

Information Node

Specialized agent for availability queries
Provides doctor availability by name or specialization
Uses ReAct (Reasoning + Acting) pattern with two tools:
check_availability_by_doctor - searches by specific doctor name
check_availability_by_specialization - searches by dental specialty (general, cosmetic, pediatric, etc.)

Booking Node

Handles all appointment modifications
Equipped with three tools:
set_appointment - books new appointments
cancel_appointment - cancels existing appointments
reschedule_appointment - moves appointments to new time slots

Data Flow

User submits query with ID number via Streamlit UI or API
FastAPI endpoint initializes agent state with message and user ID
Supervisor analyzes intent and routes to appropriate specialized agent
Specialized agent executes tools against CSV database
Agent returns to supervisor with results
Supervisor decides: continue to another agent or FINISH
Final response returned to user

Data Validation

Uses Pydantic models with regex validators:
DateModel: DD-MM-YYYY format
DateTimeModel: DD-MM-YYYY HH:MM format
IdentificationNumberModel: 7-8 digit patient IDs

Storage

CSV-based storage (doctor_availability.csv) tracks:
Doctor names and specializations
Available time slots
Booking status
Patient assignments

Tech Stack

Core Framework

LangGraph - Multi-agent orchestration and state management
LangChain - LLM abstraction and tool integration
FastAPI - REST API server
Uvicorn - ASGI server
Pydantic - Data validation and settings management
Streamlit - Interactive web UI for user queries
Python - Base language
Like this project

Posted Oct 29, 2025

Built an AI system for managing doctor appointments using LangGraph's architecture.