# puri-adityakumar/agentic-ai architecture

> Architecture diagram of the GitHub repository puri-adityakumar/agentic-ai, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/puri-adityakumar/agentic-ai
- Repository: https://github.com/puri-adityakumar/agentic-ai

## Overview

The repository is a learning-oriented collection of three AI-agent products: email assistance, healthcare appointments, and sales representation. The email workflow is the best-supported: a user submits a chat message, the API stores it and invokes a supervisor, which can use email-related tools; users can also retrieve recent chat messages. Healthcare exposes appointment operations through a Supabase-backed API. Sales has workflow and prompt assets, but their runtime wiring is not shown. Healthcare and sales details are limited to the README, tree, and sampled healthcare endpoint.

Main entry points: [`email_agent/backend/src/api/chat/routing.py`](https://github.com/puri-adityakumar/agentic-ai/blob/main/email_agent/backend/src/api/chat/routing.py) (Chat API), [`email_agent/backend/src/api/ai/tools.py`](https://github.com/puri-adityakumar/agentic-ai/blob/main/email_agent/backend/src/api/ai/tools.py) (Email tools), [`email_agent/backend/src/main.py`](https://github.com/puri-adityakumar/agentic-ai/blob/main/email_agent/backend/src/main.py) (API application), [`email_agent/backend/src/api/ai/agents.py`](https://github.com/puri-adityakumar/agentic-ai/blob/main/email_agent/backend/src/api/ai/agents.py) (Agent supervisor)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_email["Email agent"]
  node_email_api["Chat API<br/>[routing.py]"]
  node_email_app["API application<br/>[main.py]"]
  node_chat_store[("Chat records<br/>[models.py]")]
  node_db_access["Database access<br/>[db.py]"]
  node_supervisor["Agent supervisor<br/>[agents.py]"]
  node_agent_tools["Email tools<br/>[tools.py]"]
  node_email_services["Message generation<br/>[services.py]"]
  node_llm_config["LLM client<br/>[llms.py]"]
  node_inbox_reader["Inbox reader<br/>[inbox_reader.py]"]
  node_imap_parser["Gmail IMAP parser"]
  node_mail_sender["Mail sender<br/>[sender.py]"]
end

subgraph group_healthcare["Healthcare agent"]
  node_health_api["Appointments API<br/>[index.ts]"]
  node_appointments[("Appointments<br/>[schema.sql]")]
  node_health_workflow["Agent workflow<br/>[workflow.json]"]
  node_health_prompts["Agent prompts"]
end

subgraph group_sales["Sales agent"]
  node_sales_workflow["Sales workflow<br/>[workflow.json]"]
  node_sales_prompts["Sales prompts"]
end

node_user(("User"))
node_llm_provider{{"OpenAI-compatible model"}}
node_gmail{{"Gmail IMAP"}}
node_smtp{{"SMTP email service"}}
node_health_user(("Patient or staff"))
node_supabase{{"Supabase"}}
node_sales_user(("Sales user"))

node_user -->|"sends requests"| node_email_app
node_email_app -->|"mounts routes"| node_email_api
node_email_api -->|"gets session"| node_db_access
node_email_api -->|"stores and lists"| node_chat_store
node_email_api -->|"invokes"| node_supervisor
node_supervisor -.->|"tool use"| node_agent_tools
node_agent_tools -->|"generates research"| node_email_services
node_email_services -->|"gets model"| node_llm_config
node_llm_config -->|"calls"| node_llm_provider
node_agent_tools -->|"reads inbox"| node_inbox_reader
node_inbox_reader -->|"fetches messages"| node_imap_parser
node_imap_parser -->|"searches mail"| node_gmail
node_agent_tools -->|"sends message"| node_mail_sender
node_mail_sender -->|"delivers email"| node_smtp
node_health_user -->|"requests appointments"| node_health_api
node_health_api -->|"reads and writes"| node_supabase
node_supabase -->|"stores records"| node_appointments
node_sales_user -.->|"uses agent"| node_sales_workflow
node_sales_workflow -.->|"prompt wiring unclear"| node_sales_prompts
node_health_workflow -.->|"prompt wiring unclear"| node_health_prompts

click node_email_api "https://github.com/puri-adityakumar/agentic-ai/blob/main/email_agent/backend/src/api/chat/routing.py"
click node_email_app "https://github.com/puri-adityakumar/agentic-ai/blob/main/email_agent/backend/src/main.py"
click node_chat_store "https://github.com/puri-adityakumar/agentic-ai/blob/main/email_agent/backend/src/api/chat/models.py"
click node_db_access "https://github.com/puri-adityakumar/agentic-ai/blob/main/email_agent/backend/src/api/db.py"
click node_supervisor "https://github.com/puri-adityakumar/agentic-ai/blob/main/email_agent/backend/src/api/ai/agents.py"
click node_agent_tools "https://github.com/puri-adityakumar/agentic-ai/blob/main/email_agent/backend/src/api/ai/tools.py"
click node_email_services "https://github.com/puri-adityakumar/agentic-ai/blob/main/email_agent/backend/src/api/ai/services.py"
click node_llm_config "https://github.com/puri-adityakumar/agentic-ai/blob/main/email_agent/backend/src/api/ai/llms.py"
click node_inbox_reader "https://github.com/puri-adityakumar/agentic-ai/blob/main/email_agent/backend/src/api/emailer/inbox_reader.py"
click node_imap_parser "https://github.com/puri-adityakumar/agentic-ai/blob/main/email_agent/backend/src/api/emailer/gmail_imap_parser.py"
click node_mail_sender "https://github.com/puri-adityakumar/agentic-ai/blob/main/email_agent/backend/src/api/emailer/sender.py"
click node_health_api "https://github.com/puri-adityakumar/agentic-ai/blob/main/healthcare_agent/src/servless/index.ts"
click node_appointments "https://github.com/puri-adityakumar/agentic-ai/blob/main/healthcare_agent/src/schema.sql"
click node_health_workflow "https://github.com/puri-adityakumar/agentic-ai/blob/main/healthcare_agent/src/workflow/workflow.json"
click node_health_prompts "https://github.com/puri-adityakumar/agentic-ai/tree/main/healthcare_agent/prompts"
click node_sales_workflow "https://github.com/puri-adityakumar/agentic-ai/blob/main/sales_rep_agent/workflow.json"
click node_sales_prompts "https://github.com/puri-adityakumar/agentic-ai/tree/main/sales_rep_agent/prompts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_email_api,node_email_app,node_chat_store,node_db_access,node_supervisor,node_agent_tools,node_email_services,node_llm_config,node_inbox_reader,node_imap_parser,node_mail_sender,node_user,node_sales_user toneBlue
class node_health_api,node_appointments,node_health_workflow,node_health_prompts toneAmber
class node_sales_workflow,node_sales_prompts toneMint
class node_llm_provider,node_gmail,node_smtp,node_health_user,node_supabase toneIndigo
```

## Components

### Email agent

- [Chat API](https://github.com/puri-adityakumar/agentic-ai/blob/main/email_agent/backend/src/api/chat/routing.py): `email_agent/backend/src/api/chat/routing.py`
- [API application](https://github.com/puri-adityakumar/agentic-ai/blob/main/email_agent/backend/src/main.py): `email_agent/backend/src/main.py`
- [Chat records](https://github.com/puri-adityakumar/agentic-ai/blob/main/email_agent/backend/src/api/chat/models.py): `email_agent/backend/src/api/chat/models.py`
- [Database access](https://github.com/puri-adityakumar/agentic-ai/blob/main/email_agent/backend/src/api/db.py): `email_agent/backend/src/api/db.py`
- [Agent supervisor](https://github.com/puri-adityakumar/agentic-ai/blob/main/email_agent/backend/src/api/ai/agents.py): `email_agent/backend/src/api/ai/agents.py`
- [Email tools](https://github.com/puri-adityakumar/agentic-ai/blob/main/email_agent/backend/src/api/ai/tools.py): `email_agent/backend/src/api/ai/tools.py`
- [Message generation](https://github.com/puri-adityakumar/agentic-ai/blob/main/email_agent/backend/src/api/ai/services.py): `email_agent/backend/src/api/ai/services.py`
- [LLM client](https://github.com/puri-adityakumar/agentic-ai/blob/main/email_agent/backend/src/api/ai/llms.py): `email_agent/backend/src/api/ai/llms.py`
- [Inbox reader](https://github.com/puri-adityakumar/agentic-ai/blob/main/email_agent/backend/src/api/emailer/inbox_reader.py): `email_agent/backend/src/api/emailer/inbox_reader.py`
- [Gmail IMAP parser](https://github.com/puri-adityakumar/agentic-ai/blob/main/email_agent/backend/src/api/emailer/gmail_imap_parser.py): `email_agent/backend/src/api/emailer/gmail_imap_parser.py`
- [Mail sender](https://github.com/puri-adityakumar/agentic-ai/blob/main/email_agent/backend/src/api/emailer/sender.py): `email_agent/backend/src/api/emailer/sender.py`

### Healthcare agent

- [Appointments API](https://github.com/puri-adityakumar/agentic-ai/blob/main/healthcare_agent/src/servless/index.ts): `healthcare_agent/src/servless/index.ts`
- [Appointments](https://github.com/puri-adityakumar/agentic-ai/blob/main/healthcare_agent/src/schema.sql): `healthcare_agent/src/schema.sql`
- [Agent workflow](https://github.com/puri-adityakumar/agentic-ai/blob/main/healthcare_agent/src/workflow/workflow.json): `healthcare_agent/src/workflow/workflow.json`
- [Agent prompts](https://github.com/puri-adityakumar/agentic-ai/tree/main/healthcare_agent/prompts): `healthcare_agent/prompts`

### Sales agent

- [Sales workflow](https://github.com/puri-adityakumar/agentic-ai/blob/main/sales_rep_agent/workflow.json): `sales_rep_agent/workflow.json`
- [Sales prompts](https://github.com/puri-adityakumar/agentic-ai/tree/main/sales_rep_agent/prompts): `sales_rep_agent/prompts`

### Other components

- **User**
- **OpenAI-compatible model**
- **Gmail IMAP**
- **SMTP email service**
- **Patient or staff**
- **Supabase**
- **Sales user**

## Connections

- User → API application: sends requests
- API application → Chat API: mounts routes
- Chat API → Database access: gets session
- Chat API → Chat records: stores and lists
- Chat API → Agent supervisor: invokes
- Agent supervisor → Email tools: tool use
- Email tools → Message generation: generates research
- Message generation → LLM client: gets model
- LLM client → OpenAI-compatible model: calls
- Email tools → Inbox reader: reads inbox
- Inbox reader → Gmail IMAP parser: fetches messages
- Gmail IMAP parser → Gmail IMAP: searches mail
- Email tools → Mail sender: sends message
- Mail sender → SMTP email service: delivers email
- Patient or staff → Appointments API: requests appointments
- Appointments API → Supabase: reads and writes
- Supabase → Appointments: stores records
- Sales user → Sales workflow: uses agent
- Sales workflow → Sales prompts: prompt wiring unclear
- Agent workflow → Agent prompts: prompt wiring unclear
