Building an AI Outbound Calling Agent on Google Voice with Python, Groq and FastAPI
Description and use
An automated voice agent using Google Voice in a browser implements reliable call‑state detection, audio routing, voicemail classification, and a web console for management, completing the full outbound call cycle.
Problem
Automating outbound calls via Google Voice in a browser requires reliable call state detection, audio routing, and voicemail handling, which are hard because browsers lack native call state events and the DOM is noisy.
Outcome
The agent reliably places outbound calls via Google Voice, speaks scripted lines, engages in real‑time conversation, detects voicemail, logs all events, and can be managed through a web console, achieving a level of automation not possible with standard telephony APIs.
Workflow
- Load .env, dialer_config.json, contacts and CRM data
- Run preflight checks for Groq, Chrome profile, contacts, callback number and audio devices
- Launch Google Voice with a persistent Chrome profile (Selenium + webdriver‑manager)
- Prepare opening‑line and voicemail audio
- Dial one contact
- Poll detect_call_state() until call is connected, voicemail, no answer, ended or failed
- Start conversation loop only after confirmed connection
- Watch for voicemail in early connected window and hand off if confirmed
- Save call log, transcript, recording, CRM update and call archive
- Wait out a cooldown, then move to next contact
Evidence
A browser doesn't. You read the page (the DOM), and the page is noisy: banners from the last call stay on screen, call controls can show up before anyone picks up, and voicemail cues can appear while the phone is still ringing.
The most important logic is in src/google_voice.py. It's a conservative state gate: ...
Once a call is confirmed connected, conversation_loop.py takes over: ...
The README describes this runtime flow: ...
The agent is meant to run on a Windows desktop, so: ...
- Record date: 2026-11-01T03:44:15.842Z