Skip to content

AI Agent system designed to help clinics manage appointments, integrated with Google Calendar and Email Service

License

Notifications You must be signed in to change notification settings

fahmiaziz98/SmartClinicAgent

Repository files navigation

SmartClinicAgent

Your AI-powered assistant for clinic scheduling & patient communication

SmartClinicAgent is an Agentic AI system designed to help clinics manage appointments, update schedules, and handle cancellations seamlessly. Integrated with Google Calendar and email services, it ensures patients and doctors stay in sync effortlessly.

✨ Features

  • 📅 Smart Scheduling – Book, update, and cancel doctor appointments with ease.
  • 🔄 Google Calendar Integration – Real-time sync with doctor's availability.
  • 📧 Email Notifications – Automated reminders and confirmations.
  • 🩺 Doctor Information Lookup – Retrieve schedules and details without patient data exposure.
  • 🤖 Agentic AI Orchestration – Uses multiple tools for intelligent workflow automation.

ReAct Pattern

Example UI 1

Challenges & Solutions

LLM Optimization

Latency

  • With Gemini 2.5 Pro, average response time (p50) was 4–5s, which is too slow for real-time applications.
  • Switching to Gemini 2.5 Flash reduced latency to 2–4s (p50, p95 <10s).
Model p50 Latency p95 Latency Notes
Gemini 2.5 Pro 4–5s >15s Too slow for real-time usage
Gemini 2.5 Flash 2–3s <10s Optimized without quality loss

Model Trade-off

  • Transitioning to Gemini Flash delivered significant latency improvement with no major quality degradation.

Memory

  1. Challenge: Memory operations (mem0.add()) take 1-12 seconds, blocking user responses and creating poor user experience.
  2. Solution: Background Tasks: Using asyncio.create_task() makes the coroutine run simultaneously without waiting for it to finish.
  3. Pros & Cons
    • Pros: Fast user response, better UX,
    • Cons: Memory is not immediately available,

🛠 Tech Stack

  • Python 3.12+
  • LangChain / LangGraph – AI orchestration
  • Google Calendar API – Scheduling integration
  • Gmail SMTP – Email automation
  • uv - Python package installer and resolver

🚀 Quick Start

Prerequisites

  • Python 3.10 or higher.
  • uv for virtual environment management (Learn more).

Clone Repository

git clone https://github.com/fahmiaziz98/SmartClinicAgent.git
cd SmartClinicAgent

1. Create env & activate

# create venv
uv venv

# activate venv
source .venv/bin/activate

# install dependencies
uv sync

2.Environment Variables

To copy the .env.example file to .env, you can use the following command in your terminal:

cp .env.example .env

This will create a .env file with the same content as .env.example. You can then edit the .env file to add your actual environment variables.

# api key
GOOGLE_API_KEY=""

# gmail service
ACCOUNT_GMAIL=""
PASSWORD_GMAIL=""

# calendar service
SERVICE_ACCOUNT_FILE="path-service-acount.json"
CALENDAR_ID="you-id-calendar"

# tracing llm
LANGSMITH_TRACING_V2="true"
LANGSMITH_PROJECT="name-project"
LANGSMITH_API_KEY="langsmith-api-key"

3. Launch LangGraph Server 🚀

make run

# or

langgraph dev --allow-blocking

# Sample Output
>    Ready!
>
>    - API: [http://localhost:2024](http://localhost:2024/)
>
>    - Docs: http://localhost:2024/docs
>
>    - LangGraph Studio Web UI: https://smith.langchain.com/studio/?baseUrl=http://127.0.0.1:2024

Note:
You can try the app at https://agentchat.vercel.app/

  1. Copy and paste your deployment URL (e.g., http://localhost:2024)
  2. Add your Agent ID
  3. (Optional) Provide your LangSmith API Key

🖼️ Example UI Screenshot

Example UI 1

🚀 Roadmap

  • create base agent-tools
  • Integration google-calendar
  • Add memory presistance
  • Sending email with SMTP (create-update-deleted)
  • Add rag tools
  • Add human-interupt (approve/reject)
  • Add Long-Term Memory with mem0/memU
  • Implement Chat-UI
  • Deploy on Docker
  • Deploy on Cloud

🤝 Contributing

  1. Fork the repository.
  2. Create a feature branch (git checkout -b feature/amazing-feature).
  3. Commit your changes (git commit -m 'Add amazing feature').
  4. Push to the branch (git push origin feature/amazing-feature).
  5. Open a Pull Request.

Resources


📄 License

This project is licensed under the MIT License - see the LICENSE file for details.


🆘 Support


Made with ❤️ by fahmiaziz98

About

AI Agent system designed to help clinics manage appointments, integrated with Google Calendar and Email Service

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published