How nirwan-teji/swasthiq-front-desk-agent works
SwasthiQ is a safety-first clinic front-desk agent for appointment booking, rescheduling, cancellation, and human escalation, with a staff dashboard for reviewing handoffs and conversation outcomes. Callers submit a dated, multi-turn conversation through the API; the agent screens for safety, uses an LLM and clinic tools for routine requests, then returns a grounded result. The API captures successful runs for the dashboard, where staff can inspect conversations and resolve escalations. Edges follow excerpts, the SOURCE INDEX, or README; unsampled implementation details are not inferred.
Main entry points: orchestrator.py Conversation orchestrator · App.tsx Dashboard app · client.ts API client · routes_agent.py Agent endpoint
Components 22
Staff dashboard
- Dashboard app
frontend/src/App.tsx - API client
frontend/src/api/client.ts - Run simulation
frontend/src/components/RunSimulationModal.tsx - Handoff queue
frontend/src/pages/HandoffQueue.tsx - Handoff table
frontend/src/components/HandoffTable.tsx - Conversation detail
frontend/src/pages/ConversationDetail.tsx - Transcript view
frontend/src/components/TranscriptView.tsx - Outcome panel
frontend/src/components/OutcomePanel.tsx
Backend API
- FastAPI app
backend/app/main.py - Agent endpoint
backend/app/api/routes_agent.py - Dashboard endpoints
backend/app/api/routes_queue.py - Request and response schemas
backend/app/schemas.py
Conversation agent
- Conversation orchestrator
backend/app/agent/orchestrator.py - Safety guard
backend/app/agent/safety_guard.py - Relative date engine
backend/app/agent/date_resolver.py - Clinic instructions
backend/app/agent/prompt.py - LLM client
backend/app/agent/llm_client.py
Clinic operations
- Clinic state and tools
backend/app/database.py - Clinic data
clinic.json
Other components
- Caller
- Clinic staff
- Groq and Gemini
Connections 24
- Caller → Run simulation: enters turns
frontend/src/components/RunSimulationModal.tsx - Run simulation → API client: runs simulation
frontend/src/components/RunSimulationModal.tsx - API client → Agent endpoint: posts run
frontend/src/api/client.ts - Agent endpoint → Request and response schemas: validates payload
backend/app/api/routes_agent.py - Agent endpoint → Conversation orchestrator: runs conversation
backend/app/api/routes_agent.py - Conversation orchestrator → Safety guard: screens turns
backend/app/agent/orchestrator.py - Conversation orchestrator → Relative date engine: resolves dates
backend/app/agent/orchestrator.py - Conversation orchestrator → Clinic instructions: uses instructions
backend/app/agent/orchestrator.py - Conversation orchestrator → LLM client: requests completion
backend/app/agent/orchestrator.py - LLM client → Groq and Gemini: calls provider
backend/app/agent/llm_client.py - Conversation orchestrator → Clinic state and tools: dispatches tools
backend/app/agent/orchestrator.py - Clinic state and tools → Clinic data: loads clinic data
README.md - FastAPI app → Agent endpoint: registers route
backend/app/main.py - FastAPI app → Dashboard endpoints: registers routes
backend/app/main.py - FastAPI app → Dashboard endpoints: stores run result
backend/app/main.py - API client → Dashboard endpoints: fetches and resolves
frontend/src/api/client.ts - Dashboard app → API client: loads dashboard data
frontend/src/App.tsx - Dashboard app → Handoff queue: shows queue
frontend/src/App.tsx - Dashboard app → Conversation detail: shows conversation
frontend/src/App.tsx - Handoff queue → Handoff table: renders table
frontend/src/pages/HandoffQueue.tsx - Conversation detail → Transcript view: renders transcript
frontend/src/pages/ConversationDetail.tsx - Conversation detail → Outcome panel: renders outcome
frontend/src/pages/ConversationDetail.tsx - Clinic staff → Dashboard app: reviews handoffs
README.md - Dashboard endpoints → Dashboard app: serves run records
backend/app/api/routes_queue.py