Skip to content

v2.3.0 Architecture (Production Legacy)

Production Legacy — Do Not Modify

v2.3.0 is the current production squad (775db28c-21cf-4eec-a643-d078cf9bc5c1). Any changes to this squad risk breaking live patient calls. All new development targets v3.0.

Comparison: v2.3.0 vs v3.0

Dimension v2.3.0 v3.0
Agents 6 (single multilingual pipeline) 9 (dual-track EN/ZH with dedicated Router)
Language handling Auto-detect per agent (unreliable) Explicit language gate at Router level
LLM GPT-4o (all agents) GPT-4o (all agents, ZH bake-off post-launch)
STT AssemblyAI Universal (all) AssemblyAI (Router) / Deepgram Nova-2 per-language
TTS ElevenLabs multilingual_v2 (all) ElevenLabs (EN) / Azure XiaoxiaoNeural (ZH)
Confirmation agent Dedicated agent Eliminated — absorbed into Booking/Modification/Registration
Reschedule + Cancel Separate agents Consolidated into single Modification agent per track
transfer_call MISSING from squad tools (bug) Fixed — present on all agents
Router maxTokens 150 (truncation bug) 400

Squad Overview

Squad ID: 775db28c-21cf-4eec-a643-d078cf9bc5c1

Property Value
Status PRODUCTION
Vapi API Key 0fec5f0b-12e8-4782-b961-9740818da17e
LLM GPT-4o (OpenAI) — all 6 assistants
Transcriber AssemblyAI Universal Multilingual
TTS ElevenLabs eleven_multilingual_v2, voice fQj4gJSexpu8RDE2Ii5m
Webhook https://api-dev.vitaravox.ca/api/vapi/*
Backup location /home/ubuntu/vitara-platform/backups/vapi-20260210/

Agent Inventory

Agent ID (prefix) Role Handoff Targets
Router 45f98810 Intent detection, greeting, language detection Booking, Reschedule, Cancel, Registration
Booking e5ad78c3 New appointment scheduling Confirmation, Router
Reschedule c1e6a6d8 Modify existing appointment date/time Confirmation, Router
Cancel 0d2f2b38 Cancel existing appointment Confirmation, Router
Registration f8e68875 New patient intake and demographics Confirmation, Router
Confirmation e1d5d83a Summarize call, log metadata, goodbye Router

Squad Topology

┌─────────────────────────────────────────────────────────────────────────┐
│                        VAPI SQUAD v2.3.0                                │
│                  775db28c-21cf-4eec-a643-d078cf9bc5c1                   │
│                                                                         │
│  ┌───────────────────────────────────────────────────────────────────┐  │
│  │                                                                   │  │
│  │                     ┌──────────────┐                              │  │
│  │        Incoming ───►│   ROUTER     │                              │  │
│  │          Call       │  45f98810    │                              │  │
│  │                     │  GPT-4o     │                              │  │
│  │                     │  maxTok=150 │◄── BUG: too low              │  │
│  │                     └──────┬───────┘                              │  │
│  │                            │                                      │  │
│  │              ┌─────────────┼─────────────┬──────────────┐        │  │
│  │              │             │             │              │        │  │
│  │              ▼             ▼             ▼              ▼        │  │
│  │     ┌──────────────┐ ┌──────────┐ ┌──────────┐ ┌─────────────┐ │  │
│  │     │  BOOKING     │ │RESCHEDULE│ │  CANCEL  │ │REGISTRATION │ │  │
│  │     │  e5ad78c3    │ │ c1e6a6d8 │ │ 0d2f2b38 │ │  f8e68875   │ │  │
│  │     │  GPT-4o     │ │ GPT-4o   │ │ GPT-4o   │ │  GPT-4o     │ │  │
│  │     └──────┬───────┘ └────┬─────┘ └────┬─────┘ └──────┬──────┘ │  │
│  │            │              │             │              │        │  │
│  │            └──────────────┼─────────────┼──────────────┘        │  │
│  │                           │             │                        │  │
│  │                           ▼             ▼                        │  │
│  │                     ┌──────────────────────┐                     │  │
│  │                     │   CONFIRMATION       │                     │  │
│  │                     │   e1d5d83a           │                     │  │
│  │                     │   GPT-4o             │                     │  │
│  │                     │   log_call_metadata  │                     │  │
│  │                     └──────────────────────┘                     │  │
│  │                                                                   │  │
│  │  ┌─────────────────────────────────────────────────────────────┐  │  │
│  │  │ SHARED STACK (all agents)                                   │  │  │
│  │  │  STT: AssemblyAI Universal Multilingual                     │  │  │
│  │  │  TTS: ElevenLabs eleven_multilingual_v2                     │  │  │
│  │  │  LLM: GPT-4o (OpenAI)                                      │  │  │
│  │  └─────────────────────────────────────────────────────────────┘  │  │
│  └───────────────────────────────────────────────────────────────────┘  │
│                                                                         │
│  ❌ transfer_call tool MISSING from squad tools (bug — fixed in v3.0)   │
│                                                                         │
└─────────────────────────────────────────────────────────────────────────┘

Handoff Paths (Detailed)

                    ┌─────────────────────────────────────────────┐
                    │            HANDOFF FLOW MAP                 │
                    └─────────────────────────────────────────────┘

  CALLER DIALS IN
  ┌──────────┐   "book appointment"    ┌──────────┐   task done    ┌──────────────┐
  │  ROUTER  │ ──────────────────────► │ BOOKING  │ ─────────────► │ CONFIRMATION │
  │          │                         └──────────┘                └──────┬───────┘
  │          │                                                            │
  │          │   "reschedule"          ┌──────────┐   task done           │
  │          │ ──────────────────────► │RESCHEDULE│ ─────────────────────►│
  │          │                         └──────────┘                       │
  │          │                                                            │
  │          │   "cancel"              ┌──────────┐   task done           │
  │          │ ──────────────────────► │  CANCEL  │ ─────────────────────►│
  │          │                         └──────────┘                       │
  │          │                                                            │
  │          │   "new patient"/"register" ┌──────────────┐  task done    │
  │          │ ──────────────────────────►│ REGISTRATION │ ─────────────►│
  │          │                            └──────────────┘               │
  │          │◄──────────────────────────────────────────────────────────┘
  │          │   (return to Router for new intent or goodbye)
  └──────────┘

  NOTES:
  ├── Router detects intent from first utterance
  ├── Each task agent can hand back to Router if user changes intent mid-call
  ├── Confirmation agent logs call metadata then returns to Router or ends call
  └── transfer_call to human receptionist is BROKEN (tool missing from squad)

Call Flow (End-to-End)

┌─────────────────────────────────────────────────────────────────────────────────┐
│                        COMPLETE CALL FLOW                                       │
├─────────────────────────────────────────────────────────────────────────────────┤
│                                                                                 │
│  PHONE NETWORK          VAPI PLATFORM              OUR SERVER        OSCAR EMR  │
│  ─────────────          ─────────────              ──────────        ─────────  │
│                                                                                 │
│  1. Patient dials                                                               │
│     clinic number                                                               │
│        │                                                                        │
│        ▼                                                                        │
│  ┌───────────┐    SIP     ┌─────────────┐                                      │
│  │ PSTN/VoIP │ ─────────► │ Vapi Inbound│                                      │
│  │ Provider  │            │ Handler     │                                      │
│  └───────────┘            └──────┬──────┘                                      │
│                                  │                                              │
│  2. Audio stream starts          ▼                                              │
│                           ┌─────────────┐                                      │
│                           │ AssemblyAI  │                                      │
│                           │ STT Engine  │                                      │
│                           │ (Universal) │                                      │
│                           └──────┬──────┘                                      │
│                                  │ text transcript                              │
│                                  ▼                                              │
│  3. LLM processes         ┌─────────────┐                                      │
│     transcript            │ GPT-4o      │                                      │
│                           │ (Router)    │                                      │
│                           │ maxTok=150  │                                      │
│                           └──────┬──────┘                                      │
│                                  │                                              │
│                     ┌────────────┼────────────┐                                │
│                     │ tool call  │ text reply │                                │
│                     ▼            ▼            │                                │
│  4. Tool calls     ┌──────────┐ ┌──────────┐ │                                │
│     to server      │ Webhook  │ │ElevenLabs│ │                                │
│                    │ POST to  │ │  TTS     │ │                                │
│                    │ /api/vapi│ │ Engine   │ │                                │
│                    └────┬─────┘ └────┬─────┘ │                                │
│                         │            │ audio  │                                │
│  5. Server              ▼            ▼        │                                │
│     processes    ┌────────────┐  ┌────────┐   │                                │
│     tool call    │ Express    │  │ Audio  │   │                                │
│                  │ :3002      │  │ Stream │   │                                │
│                  │ PM2 managed│  │ to     │   │                                │
│                  └────┬───────┘  │ Caller │   │                                │
│                       │          └────────┘   │                                │
│  6. Adapter     ┌─────▼───────┐               │                                │
│     routes      │ EmrAdapter  │               │                                │
│     to OSCAR    │ Factory     │               │                                │
│                 └──┬──────┬───┘               │                                │
│                    │      │                    │                                │
│            ┌───────▼┐  ┌──▼──────────┐        │                                │
│            │ SOAP   │  │ OAuth 1.0a  │        │                                │
│            │Adapter │  │ REST Adapter│        │                                │
│            │(self-  │  │ (Kai-hosted)│        │                                │
│            │hosted) │  │             │        │                                │
│            └───┬────┘  └──────┬──────┘        │                                │
│                │              │                │                                │
│  7. OSCAR      ▼              ▼                │                                │
│     responds ┌────────────────────┐            │                                │
│              │   OSCAR EMR        │            │                                │
│              │   (Provider,       │            │                                │
│              │    Schedule,       │            │                                │
│              │    Demographic     │            │                                │
│              │    Services)       │            │                                │
│              └────────┬───────────┘            │                                │
│                       │ response data          │                                │
│                       ▼                        │                                │
│  8. Result     ┌────────────┐                  │                                │
│     returned   │ Tool Result│                  │                                │
│     to Vapi    │ JSON → Vapi│                  │                                │
│                └────────────┘                  │                                │
│                       │                        │                                │
│  9. LLM generates     ▼                        │                                │
│     natural      ┌─────────────┐               │                                │
│     language     │ GPT-4o      │               │                                │
│     response     │ (Task Agent)│               │                                │
│                  └──────┬──────┘               │                                │
│                         │ text                  │                                │
│                         ▼                       │                                │
│  10. TTS +       ┌─────────────┐               │                                │
│      audio       │ ElevenLabs  │───────────────┘                                │
│      to caller   │ TTS → Audio │                                                │
│                  └─────────────┘                                                │
│                                                                                 │
└─────────────────────────────────────────────────────────────────────────────────┘

Booking Data Flow (Detailed)

┌─────────────────────────────────────────────────────────────────────────────────┐
│                  BOOKING FLOW: Patient Phone → Confirmed Appointment            │
├─────────────────────────────────────────────────────────────────────────────────┤
│                                                                                 │
│  STEP 1: PATIENT IDENTIFICATION                                                │
│  ─────────────────────────────────                                              │
│                                                                                 │
│  Caller Phone ──► search_patient_by_phone ──► OSCAR demographicService         │
│  (from Vapi        │                              │                             │
│   call.customer    │                              ▼                             │
│   .number)         │                     ┌─────────────────┐                   │
│                    │                     │ Patient Record   │                   │
│                    │                     │ {demographicNo,  │                   │
│                    │                     │  firstName,      │                   │
│                    │                     │  lastName,       │                   │
│                    │                     │  phone}          │                   │
│                    │                     └────────┬─────────┘                   │
│                    │                              │                             │
│  If not found: ◄───┘                              │                             │
│  search_patient (name/DOB)                        │                             │
│  OR register_new_patient                          │                             │
│                                                   │                             │
│  STEP 2: EXISTING APPOINTMENT CHECK               │                             │
│  ──────────────────────────────────                │                             │
│                                                   ▼                             │
│  demographicNo ──► check_appointments ──► OSCAR scheduleService                │
│                        │                      │                                 │
│                        │                      ▼                                 │
│                        │             ┌─────────────────────┐                   │
│                        │             │ Existing Appts[]     │                   │
│                        │             │ {id, date, time,     │                   │
│                        │             │  providerName,       │                   │
│                        │             │  status}             │                   │
│                        │             └─────────┬───────────┘                   │
│                        │                       │                               │
│  STEP 3: FIND SLOTS   │                       │                               │
│  ──────────────────    │                       │                               │
│                        ▼                       │                               │
│  {providerId,    ──► find_earliest_appointment │                               │
│   date_range}        │                         │                               │
│                      ▼                         │                               │
│              ┌───────────────┐                  │                               │
│              │ OSCAR         │                  │                               │
│              │ getSchedule   │                  │                               │
│              │ Slots         │                  │                               │
│              └───────┬───────┘                  │                               │
│                      │                          │                               │
│                      ▼                          │                               │
│  ┌──────────────────────────────┐               │                               │
│  │ Available Slots[]            │               │                               │
│  │ SOAP: from day work schedule │               │                               │
│  │ REST: synthetic 09:00-17:00  │               │                               │
│  │       (must filter against   │               │                               │
│  │        existing appointments │◄──────────────┘                               │
│  │        for true availability)│                                               │
│  └──────────────┬───────────────┘                                               │
│                 │                                                                │
│  STEP 4: BOOK  │                                                                │
│  ─────────────  │                                                                │
│                 ▼                                                                │
│  {demographicNo,  ──► create_appointment ──► OSCAR schedule/add                 │
│   providerId,         │                         │                               │
│   date,               │ Advisory Lock           │                               │
│   startTime,          │ (collision guard)       │                               │
│   duration,           │                         ▼                               │
│   status: 't'}        │                  ┌────────────────┐                    │
│                       │                  │ SOAP: addAppt  │                    │
│                       │                  │   arg0: {      │                    │
│                       │                  │     appointmentTransfer │            │
│                       │                  │   }             │                    │
│                       │                  │                 │                    │
│                       │                  │ REST: POST      │                    │
│                       │                  │   /schedule/add │                    │
│                       │                  │   NewApptTo1 {  │                    │
│                       │                  │     startTime:  │                    │
│                       │                  │       "HH:mm",  │                    │
│                       │                  │     duration:   │                    │
│                       │                  │       int,      │                    │
│                       │                  │     status: 't' │                    │
│                       │                  │   }             │                    │
│                       │                  └───────┬────────┘                    │
│                       │                          │                              │
│  STEP 5: CONFIRM      │                          ▼                              │
│  ────────────────      │                  ┌────────────────┐                    │
│                       │                  │ Appointment ID │                    │
│                       │                  │ (e.g., 314138) │                    │
│                       │                  └───────┬────────┘                    │
│                       │                          │                              │
│                       ▼                          │                              │
│              Booking Agent speaks:                │                              │
│              "Your appointment is                │                              │
│               booked for [date]                  │                              │
│               at [time] with                     │                              │
│               Dr. [name]"                        │                              │
│                       │                          │                              │
│                       ▼                          │                              │
│              Handoff → CONFIRMATION              │                              │
│              agent for call summary              │                              │
│              + log_call_metadata                 │                              │
│                                                                                 │
└─────────────────────────────────────────────────────────────────────────────────┘

Server Architecture

┌─────────────────────────────────────────────────────────────────────────────────┐
│                         SERVER ARCHITECTURE                                     │
├─────────────────────────────────────────────────────────────────────────────────┤
│                                                                                 │
│  VAPI CLOUD                     OCI ARM (Toronto)               OSCAR EMR       │
│  ──────────                     ─────────────────               ─────────       │
│                                                                                 │
│  ┌──────────┐    HTTPS POST    ┌─────────────────────────────┐                 │
│  │ Vapi     │ ────────────────►│ nginx (reverse proxy)       │                 │
│  │ Platform │    /api/vapi/*   │   ├── SSL termination       │                 │
│  │          │◄─────────────────│   └── proxy_pass :3002      │                 │
│  └──────────┘    JSON response │                             │                 │
│                                └────────────┬────────────────┘                 │
│                                             │                                   │
│                                             ▼                                   │
│                                ┌─────────────────────────────┐                 │
│                                │ Express.js :3002             │                 │
│                                │ PM2: vitara-admin-api        │                 │
│                                │                             │                 │
│                                │ ┌─────────────────────────┐ │                 │
│                                │ │ Middleware Stack         │ │                 │
│                                │ │  ├── CORS               │ │                 │
│                                │ │  ├── JSON body parser   │ │                 │
│                                │ │  ├── Pino logger        │ │                 │
│                                │ │  └── Zod validation     │ │                 │
│                                │ └───────────┬─────────────┘ │                 │
│                                │             │               │                 │
│                                │             ▼               │                 │
│                                │ ┌─────────────────────────┐ │                 │
│                                │ │ Route: /api/vapi/*      │ │                 │
│                                │ │  vapi-webhook.ts        │ │                 │
│                                │ │  ├── Parse tool call    │ │                 │
│                                │ │  ├── Extract params     │ │                 │
│                                │ │  ├── Validate w/ Zod    │ │                 │
│                                │ │  └── Dispatch to handler│ │                 │
│                                │ └───────────┬─────────────┘ │                 │
│                                │             │               │                 │
│                                │             ▼               │                 │
│                                │ ┌─────────────────────────┐ │                 │
│                                │ │ EmrAdapterFactory       │ │                 │
│                                │ │  ├── Clinic lookup      │ │                 │
│                                │ │  │   (Prisma → DB)      │ │                 │
│                                │ │  ├── preferRest check   │ │                 │
│                                │ │  └── Adapter selection  │ │                 │
│                                │ └──┬──────────────────┬───┘ │                 │
│                                │    │                  │     │                 │
│                                │    ▼                  ▼     │                 │
│                                │ ┌───────────┐ ┌───────────┐ │                 │
│                                │ │OscarSoap │ │OscarSoap │ │                 │
│                                │ │Adapter   │ │Adapter   │ │                 │
│                                │ │(SOAP     │ │(REST     │ │                 │
│                                │ │ mode)    │ │ mode)    │ │                 │
│                                │ └─────┬─────┘ └─────┬─────┘ │                 │
│                                │       │             │       │                 │
│                                │       │  ┌──────────┘       │                 │
│                                │       │  │                  │                 │
│                                │       ▼  ▼                  │                 │
│                                │ ┌─────────────────────────┐ │                 │
│                                │ │ Circuit Breaker         │ │                 │
│                                │ │ (opossum)               │ │                 │
│                                │ │  ├── timeout: 4000ms    │ │                 │
│                                │ │  ├── errorThreshold: 50%│ │                 │
│                                │ │  ├── resetTimeout: 30s  │ │                 │
│                                │ │  └── volumeThreshold: 5 │ │                 │
│                                │ └───────────┬─────────────┘ │                 │
│                                │             │               │                 │
│                                └─────────────┼───────────────┘                 │
│                                              │                                  │
│                            ┌─────────────────┼──────────────────┐               │
│                            │                 │                  │               │
│                            ▼                 ▼                  ▼               │
│                   ┌──────────────┐  ┌──────────────┐  ┌──────────────┐         │
│                   │ Self-Hosted  │  │ Kai-Hosted   │  │ OSCAR Bridge │         │
│                   │ OSCAR        │  │ OSCAR Pro    │  │ (dev only)   │         │
│                   │              │  │              │  │              │         │
│                   │ SOAP over    │  │ OAuth 1.0a   │  │ REST API     │         │
│                   │ HTTPS        │  │ REST over    │  │ 15.222.50.48 │         │
│                   │              │  │ HTTPS (CF)   │  │ :3000        │         │
│                   │ WS-Security: │  │              │  │              │         │
│                   │ UsernameToken│  │ Consumer:    │  │ Key:         │         │
│                   │ PasswordText │  │ Vitaradev    │  │ c86986426... │         │
│                   │ hasTimestamp: │  │              │  │              │         │
│                   │   false      │  │ CF WAF blocks│  │ /api/v1/*    │         │
│                   │              │  │ SOAP POST    │  │              │         │
│                   └──────────────┘  └──────────────┘  └──────────────┘         │
│                                                                                 │
└─────────────────────────────────────────────────────────────────────────────────┘

Tool Inventory

Tool-to-Agent Matrix

Agent Tools Available
Router get_clinic_info, search_patient_by_phone, ~~transfer_call~~ (MISSING)
Booking search_patient_by_phone, search_patient, check_appointments, find_earliest_appointment, create_appointment, get_providers, add_to_waitlist
Reschedule search_patient_by_phone, search_patient, check_appointments, find_earliest_appointment, update_appointment, get_providers
Cancel search_patient_by_phone, search_patient, check_appointments, cancel_appointment
Registration search_patient, register_new_patient, get_clinic_info
Confirmation log_call_metadata
Tool Description OSCAR Service Agents
search_patient_by_phone Lookup patient by caller phone number DemographicService Router, Booking, Reschedule, Cancel
search_patient Search by name and/or date of birth DemographicService (quickSearch) Booking, Reschedule, Cancel, Registration
get_clinic_info Clinic hours, address, contact Local DB (Prisma) Router, Registration
check_appointments Get existing appointments for patient ScheduleService Booking, Reschedule, Cancel
find_earliest_appointment Search available time slots ScheduleService + filtering Booking, Reschedule
create_appointment Book a new appointment ScheduleService (schedule/add) Booking
update_appointment Reschedule existing appointment ScheduleService (updateAppointment) Reschedule
cancel_appointment Cancel existing appointment ScheduleService (appointment/{id}/updateStatus) Cancel
register_new_patient New patient intake DemographicService Registration
add_to_waitlist Add to cancellation waitlist Local DB (Prisma) Booking
log_call_metadata Log call summary and outcome Local DB (Prisma) Confirmation
get_providers List clinic doctors/providers ProviderService (getProviders2) Booking, Reschedule
transfer_call Transfer to human receptionist N/A (Vapi native) MISSING FROM SQUAD

transfer_call Bug

The transfer_call tool is referenced in the Router's system prompt but was never added to the squad's tool configuration. This means patients who request to speak with a human are stuck in a loop. This was discovered during v3.0 development and fixed there.


OSCAR Integration Details

Dual-Mode Adapter

┌──────────────────────────────────────────────────────────────────┐
│              OscarSoapAdapter — Dual Mode                        │
├──────────────────────────────────────────────────────────────────┤
│                                                                  │
│  clinic.preferRest === true?                                     │
│         │                                                        │
│    YES  │          NO                                            │
│    ┌────▼────┐    ┌────▼────┐                                   │
│    │  REST   │    │  SOAP   │                                   │
│    │  Mode   │    │  Mode   │                                   │
│    └────┬────┘    └────┬────┘                                   │
│         │              │                                         │
│         ▼              ▼                                         │
│  OAuth 1.0a       WS-Security                                   │
│  consumer key     UsernameToken                                  │
│  + secret         PasswordText                                   │
│         │              │                                         │
│         ▼              ▼                                         │
│  /ws/services/*   /ws/XxxService?wsdl                            │
│  (CXF REST)       (CXF SOAP)                                    │
│         │              │                                         │
│         │              │                                         │
│    ┌────▼────┐    ┌────▼────┐                                   │
│    │ JSON or │    │  XML    │                                   │
│    │ XML resp│    │ SOAP    │                                   │
│    │         │    │ Envelope│                                   │
│    └─────────┘    └─────────┘                                   │
│                                                                  │
│  OSCAR API Namespaces:                                           │
│  ├── /ws/XxxService          — SOAP endpoints                   │
│  ├── /ws/rs/*                — Cookie-auth REST (not used)      │
│  └── /ws/services/*          — OAuth 1.0a REST (preferred)      │
│                                                                  │
│  Key Behaviors:                                                  │
│  ├── Provider JSON returns 406 → XML fallback (Accept: app/xml) │
│  ├── REST schedule/add requires NewAppointmentTo1 format         │
│  ├── startTime must be "HH:mm" (.slice(0,5), NOT .replace())    │
│  ├── status field REQUIRED (use 't' for To Do)                  │
│  ├── REST updateAppointment returns 500 → use updateStatus       │
│  └── quickSearch uses ?query= param (not searchString/term)      │
│                                                                  │
└──────────────────────────────────────────────────────────────────┘

Circuit Breaker Configuration

Parameter Value Notes
Timeout 4000ms Under Vapi's 5s tool timeout
Error Threshold 50% Opens breaker after 50% failures
Reset Timeout 30s Half-open after 30s
Volume Threshold 5 Minimum calls before breaker logic activates
Fallback Return error JSON Vapi agent sees error and informs patient

Cold Start Consideration

The adapter's warmUp() method must be awaited for preferRest clinics. Cold TLS handshake to Kai's Cloudflare edge takes ~6 seconds, exceeding the 4s circuit breaker timeout. The factory now awaits warmUp on PM2 startup.


Known Issues & Limitations

# Severity Issue Impact Fixed In
1 Critical transfer_call missing from squad tools Patients cannot reach human receptionist v3.0
2 High Single multilingual pipeline LLM mixes EN/ZH responses, confuses patients v3.0 (dual-track)
3 High Router maxTokens=150 GPT-4o tool-call JSON (80-120 tokens) + text silently truncated v3.0 (raised to 400)
4 Medium Confirmation agent low utility Logs metadata already captured by task agents — adds latency v3.0 (eliminated)
5 Medium Separate Reschedule + Cancel agents Identical tool sets, unnecessary handoff complexity v3.0 (consolidated to Modification)
6 Medium Deepgram nova-2 multi forces English Mandarin speech transcribed as English phonetics v3.0 (per-language STT)
7 Low ElevenLabs multilingual_v2 Mandarin English-accented Chinese, unnatural prosody v3.0 (Azure ZH TTS)

Lessons Learned

These issues directly informed the v3.0 architecture decisions:

  • Issues 2, 6, 7 → Dual-track EN/ZH with dedicated STT/TTS per language
  • Issue 3 → Router maxTokens raised to 400
  • Issues 4, 5 → Agent consolidation (6 agents → 4 roles per track)
  • Issue 1 → transfer_call tool added to all appropriate agents

Configuration Reference

STT Configuration (All Agents)

transcriber:
  provider: assembly-ai
  model: universal  # Multilingual auto-detect
  # NOTE: AssemblyAI has NO "endpointing", "languageDetection",
  # or "model" fields like Deepgram — different schema

TTS Configuration (All Agents)

voice:
  provider: eleven-labs
  voiceId: fQj4gJSexpu8RDE2Ii5m
  model: eleven_multilingual_v2
  # WARNING: eleven_turbo_v2_5 is English-only
  # multilingual_v2 needed for CJK but quality is poor

LLM Configuration (All Agents)

model:
  provider: openai
  model: gpt-4o
  maxTokens: 150  # Router — TOO LOW (bug)
  # Task agents: default maxTokens

Backup & Recovery

Item Location
Full v2.3.0 backup /home/ubuntu/vitara-platform/backups/vapi-20260210/
Gold master prompts /home/ubuntu/vitara-platform/backups/vapi-20260210/prompts-v2.4-gold/
Squad configuration Vapi API: GET /squad/775db28c-21cf-4eec-a643-d078cf9bc5c1
Server code vitara-platform/admin-dashboard/server/ (git versioned)

Recovery Procedure

If v2.3.0 needs restoration after accidental modification:

  1. Retrieve gold master prompts from backup directory
  2. PATCH each assistant via Vapi API with backup prompt
  3. Verify squad member linkage via GET /squad/{id}
  4. Test with inbound call to squad phone number
  5. Do NOT re-push from GitOps — v3.0 configs would overwrite v2.3.0