Overview
The application uses PostgreSQL with two main tables:leads: incoming lead queue and retry statecalls: one record per outbound call attempt
db.py creates and migrates the schema at startup. It is safe to call init_db() repeatedly.
leads Table
calls Table
Qualification JSON
The exact JSON differs by agent mode. Sarvam mode stores broader machinery qualification:Important Helpers
Duration Tracking
Forcalled, pushed, and failed terminal records, duration is calculated from:
LEGACY_SUCCESS_CALL_ESTIMATE_MINUTES for older successful calls that do not have complete duration fields.