ProjectBuild an AI Voice Receptionist: the explanation · Module 15: Safety: emergencies, scope and personal data · part 17 of 23
Part 17 · Module 15: Safety: emergencies, scope and personal data

Module 15: Safety: emergencies, scope and personal data

24 min read·
About 40 minutes · Needs: Module 10 (languages and scripts) and Module 11 (the agent graph) · Code: backend/app/agent/guardrails.py, backend/app/core/pii.py, backend/app/agent/speech_guard.py

Where this fits

WHERE THIS FITS The Medilane voice receptionist this module CLIENT React API LAYER FastAPI SAFETY SPEECH IN BRAIN LangGraph SPEECH OUT KNOWLEDGE AND DATA pgvector OPERATIONS Langfuse, Prometheus Caller app browser mic Staff app desk and admin REST API staff, sessions Voice socket audio both ways Auth + RBAC staff roles, voice tokens Guardrails emergency, PII VAD Silero, turns Whisper speech to text Language en, hi, Hinglish Agent tools, confirm Open models Groq: gpt-oss, Qwen Kokoro TTS en + hi voices Retrieval multilingual Ingestion clinic documents PostgreSQL clinic, calls, vectors Redis events, limits Front desk live events, hand-offs Observability traces, metrics Evaluation WER, safety, latency
Safety (blue: this module) sits on both sides of the agent: before any model reads a turn and before any sentence is spoken.

A clinic phone line hears things a bank chatbot never does: chest pain, a child who is not breathing, a request for a dose of medicine. This module is the code that stands on both sides of the agent. Every caller turn passes through the input guard before any model sees it, and every sentence the agent writes passes through the speech gate before Kokoro speaks it. The same personal data masker also cleans stored transcripts, logs and everything sent to the tracing service.

The rest of this project is yours to keep

This project is bought on its own, once, and stays readable afterwards, including the parts added to it later.

Or open everything with a plan