1. Why voice AI breaks differently than text chat
When a chatbot hallucinates inside an internal dashboard, a user clicks refresh. When an autonomous outbound voice agent calls real people on the PSTN network, every bug has immediate financial, legal, and reputational consequences: dialing the same contact twice from concurrent workers, transferring a call to an attacker-supplied number, or reporting optimistic "closed sales" on a leaderboard.
"Start with simple prompts, optimize them with comprehensive evaluation, and add multi-step agentic systems only when simpler solutions fall short. ... Consistently, the most successful implementations weren't using complex frameworks or specialized libraries. Instead, they were building with simple, composable patterns."
While scaling Power Dialer from a single AI helper into a concurrent campaign fleet, the guiding principle became clear: treat the conversational LLM as an untrusted execution plane, never as an authority over money, telephony routing, or business metrics.
2. Three planes & server-authorized call transfers
Instead of giving an LLM free-form tools that accept phone numbers or prices, Power Dialer enforces a strict split:
- Human Control Plane: Defines campaigns, versioned immutable playbooks/personas pinned at call creation, supervises live transcripts via Laravel Reverb, injects live nudges, and performs QC review.
- Server Authorization Plane: Runs deterministic Laravel services for DNC/consent eligibility, calling hours, spend caps, atomic lead leases, typed transfer resolution, and append-only outcome recording.
- AI Execution Plane: Listens and speaks in real time. When a transfer
is needed, the model emits only a typed
reason.TransferResolvermaps that reason to an authorized destination (human queue, AI pool, or approved PSTN target) and forwards a redacted context package.
// Model tool call (untrusted input boundary):
{ "tool": "request_transfer", "args": { "reason": "billing_escalation", "summary": "..." } }
// Server TransferResolver (Laravel):
// 1. Validates reason against campaign's TransferPolicy allow-list
// 2. Maps reason -> typed TransferDestination (never accepts raw phone/ID from LLM)
// 3. Builds redacted TransferContextPackage + splits opener/closer attribution
3. Atomic contact leases & swappable realtime audio lanes
Read-then-write lead picking
Querying WHERE status = 'pending' then updating inside a worker lets
two concurrent executors dial the same lead within milliseconds, and leaves
leads stranded if a worker crashes.
Conditional atomic lease + reconcile
Deterministic fleet allocation assigns owners upfront; execution takes a
conditional lease with heartbeat renewal, scheduled expiry reaping, idempotent
webhooks, and dialer:reconcile drift checks.
Behind one conversation engine, Power Dialer supports three swappable voice transports:
turn-based Twilio <Gather>, Twilio ConversationRelay, and full-duplex
OpenAI Realtime μ-law audio bridged through a stateless Node 20 sidecar on port 8091.
Global and per-agent feature flags behind a circuit breaker let operators roll back
voice behavior immediately as configuration rather than waiting on a deploy.
4. Stopping reward hacking & encoding compliance
"How important evals are to the team is a major differentiator between folks rushing out hot garbage and those seriously building products in the space."
When an AI sales agent scores its own call as a "hot lead" or "sale", feeding that signal straight onto revenue leaderboards invites specification gaming. Power Dialer enforces three structural defenses:
- Claimed vs. QC-verified separation: Calls write canonical states to an append-only outcome ledger; scoreboards display only sales confirmed by the QC review queue.
- Static reward-hacking scanner: A build check fails CI if any model-generated interest score is consumed by a ranked, paid, or headline surface.
- Compliance in code: Non-disableable guardrail floors enforce EU AI Act Art. 50 disclosure, transcript-only sentiment scoring (never acoustic emotion inference, respecting Art. 5(1)(f)), German §7 UWG consent provenance, and per-call Twilio webhook token validation.
5. Bonus Architecture: 100% Local Privacy-First Voice Loop (CoachAI)
While Power Dialer orchestrates cloud telephony at fleet scale, CoachAI (built at Solution Planets with FastAPI, Next.js, and Docker Compose) proves the opposite end of the spectrum: an interactive Socratic voice tutor running completely on local hardware with zero cloud API calls and zero external OS FFmpeg subprocesses.
6. Actionable Tips & Tricks Checklist
Pin AI config bundles per call at creation
Freeze persona, playbook, and guard versions onto the call row so later audits can reproduce exact call behavior.
Log explicit STT locale per tenant
Defaulting multilingual calls to English silently corrupts DE/TR transcripts. Pass explicit language codes per campaign.
Keep hermetic tests decoupled from brokers
Power Dialer runs 1,644 PHPUnit tests without Reverb or Redis running, keeping CI fast while guarding core state machines.
Never publish unmeasured latency claims
Instrument per-span timers (LatencyRecorder) early, and mark live
caller-heard SLOs as unverified until staged rollout traffic runs.
Read full Power Dialer case study Next article: Document AI & DB Boundaries →