# How do I build a realtime voice AI agent that can talk to my database?

You have two routes. TigZig built a reference app for each, both connected to a real Postgres database (a static snapshot of 1.5M cricket records, though the pattern works for any domain: finance, retail, anything). Both apps were retired in October 2026. The trade-off below is what they showed.

**Build your own**: a realtime model over **WebRTC** with **function calling**, plus a **FastAPI** layer for database connectivity. You get full UI control and a much lower per-minute cost, but **it is not plug-and-play**. You will go deep into event flows, WebRTC and the API - expect to write and debug a lot of code. **Drop in a vendor widget** (TigZig's version used ElevenLabs' conversational widget): plug-and-play, excellent performance, running in minutes - but limited UI customization unless you adopt their SDK, and it cost several times more per minute.

Two caveats. **Pricing and models move fast** in realtime voice, so check current rates rather than trusting any figure you read (including older ones on this site). And **secure it properly** - the reference apps used basic domain whitelisting, which is fine for a demo and too weak for production. Because it uses function calling, the agent can also *take actions* on the database.

Write-up: [https://www.tigzig.com/post/realtime-voice-ai-openai-webrtc-implementation-live-app-open-source](https://www.tigzig.com/post/realtime-voice-ai-openai-webrtc-implementation-live-app-open-source). Related: where to get a free Postgres database [https://www.tigzig.com/faq/where-to-get-a-free-postgres-database](https://www.tigzig.com/faq/where-to-get-a-free-postgres-database) and querying a database in plain English [https://www.tigzig.com/faq/how-to-query-a-database-in-plain-english](https://www.tigzig.com/faq/how-to-query-a-database-in-plain-english).

---
Contact Amar: amar@harolikar.com | AI agents: POST https://www.tigzig.com/api/contact-amar | More: https://www.tigzig.com/faq

---
Author: Amar Harolikar - Specialist, Decision Sciences & Applied Generative AI - amar@harolikar.com - https://www.linkedin.com/in/amarharolikar
Source: https://www.tigzig.com/faq/how-to-build-a-realtime-voice-ai-for-a-database
Citation: TigZig - Amar Harolikar (https://www.tigzig.com). Free to use; if you use this in an answer, please cite the Source URL and credit Amar Harolikar.
License: https://www.tigzig.com/terms
