Mario Ruiz Díaz
← All case studies

Case study · AI Systems

Afterhour: a multi-tenant AI voice receptionist that never loses a call

A production SaaS that answers law firms' calls 24/7, qualifies leads, warm-transfers hot cases and syncs every call into the firm's tools, built for Big Voodoo Interactive.

Visit afterhour.ai
Product
afterhour.ai ↗
Client
Big Voodoo Interactive
Industry
Legal marketing · Law firms
Role
Principal Engineer
Period
2025 – present
24/7
AI intake for law firms
~7%
of calls recovered by reconciliation
25K+
calls processed
Afterhour: a multi-tenant AI voice receptionist that never loses a callPEOPLEVOICE LAYERCALL PIPELINE · AWS (CDK)CUSTOMER PORTALDATA & INTEGRATIONSCaller24/7 inboundFirm staffportal usersTwilio numberinbound callsVAPI assistantsquads · toolsWarm transferbusiness hoursWebhook ingestAPI Gateway · LambdaRaw payloadnever lose a callAmazon SQSretries · DLQCall processorextract · archive · routeReconcile cronEventBridge · 5 minTriggers & alertsqualified leadsWeb appReact · Vite · ClerkAgent BuilderAI SDK · Claude · GPTNeon PostgresTypeORM · migrationsRecordings · S3private S3 · presignedNotificationsResend · Twilio SMSCRM integrationsClio · Lawmatics · ZapierAvailability APIschedules · time zonesObservabilitySentry · CloudWatch · Slackhot caseend of callmissed calls

Scroll sideways to see the full diagram →

Afterhour architecture. Calls are answered by VAPI on Twilio numbers; every call is persisted first, processed asynchronously on AWS, recovered by reconciliation if its webhook is lost, and fanned out to storage, notifications and CRMs.Download diagram (PNG) ↓

Context

Big Voodoo Interactive is a legal-marketing agency whose clients are law firms. For a firm, a missed call is a missed case: prospects call after hours, on weekends, or while everyone is busy, and they call the next firm if nobody answers. Traditional answering services are expensive and cannot do intake.

The challenge

Turn conversational AI into an operational product that non-technical firm staff can configure safely: tenant isolation, reliable post-call processing even when upstream webhooks fail, recordings the firm owns, warm transfers that respect business hours, and integrations with the CRMs firms already use.

The solution

Calls arrive on Twilio numbers and are handled in real time by VAPI assistants. When a call ends, the platform persists the raw payload first and processes it asynchronously on AWS: structured extraction, phone normalization, recording archival, triggers, notifications and CRM sync. A reconcile job recovers any call the webhook missed. Firms manage everything from a React portal, including a chat-based Agent Builder and in-browser test calls.

  • Voice layer

    Twilio numbers wired to VAPI assistants and squads, with tools for warm transfer and business-hours checks.

  • Availability-aware warm transfer

    VAPI has no availability feature, so a function tool asks the Afterhour backend at the start of each call whether a human can take a transfer, using per-day schedules with time zones and split shifts, cached for the whole call.

  • Durable call pipeline

    Webhook ingest on API Gateway + Lambda stores the raw payload, enqueues only the call id on SQS, and typed jobs process it with retry schedules and dead-letter queues.

  • Reconcile cron

    An EventBridge job every 5 minutes compares against the provider and recovers calls whose webhook never arrived.

  • Structured extraction

    Every call yields caller info, qualification and a summary as structured outputs at low temperature, ready for notifications and CRMs.

  • Recordings the firm owns

    Recordings are fetched through the provider's authenticated endpoint into private S3, served with presigned URLs, and integration access is audit-logged.

  • Agentic form (Agent Builder)

    A conversational form that builds a voice agent for any goal: the LLM calls tools to fill each setting as a candidate with confidence and provenance, streams changes live, flags conflicts with uploaded knowledge, and blocks publishing until everything is confirmed.

  • Observability

    Sentry with profiling, CloudWatch custom metrics and dashboards (including reconciliation), Slack alerts, structured webhook logging and admin diagnostics endpoints.

Key decisions

  1. 01

    Persist first, process later

    The webhook handler only stores the raw payload and enqueues the call id. Processing can fail, retry or be replayed without ever losing the original call.

    Alternatives considered Processing inline inside the webhook request.

  2. 02

    Don't trust webhooks alone: reconcile

    Roughly 7% of calls never arrived via webhook. A scheduled reconcile job recovers them, so completeness no longer depends on a third party's delivery.

    Alternatives considered Relying on provider retries.

  3. 03

    Availability lives in our backend, not in the voice platform

    The voice provider could transfer calls but not decide when a human is available. A backend endpoint exposed as a tool owns that rule, and out-of-hours, no-answer and rejected transfers all converge into one fallback: the AI keeps the caller, takes their details and promises a callback. In hold-and-detect mode, a failed transfer hands the conversation back to the AI instead of dropping the call.

    Alternatives considered Encoding schedules in the prompt; separate behavior per failure case.

  4. 04

    Serverless with typed jobs

    API and workers run on Lambda with SQS, each job type declaring its retry schedule. It scales to zero when idle and absorbs call spikes without capacity planning.

    Alternatives considered Long-running containers with an in-process queue.

  5. 05

    Structured outputs over free-form analysis

    Notifications, qualification and CRM sync need fields, not prose. Low-temperature structured outputs make extraction predictable and testable.

  6. 06

    Prompt changes ship like code

    A misclassification was silently dropping returning clients with new matters. The fix shipped with an offline eval harness on labeled transcripts, a versioned and reversible patch script, and a canary rollout.

    Alternatives considered Editing production prompts by hand.

  7. 07

    An agentic form: AI proposes, humans confirm

    Instead of a long settings form, the user describes the goal and an LLM fills the agent's configuration through tool calls. Every value starts as a candidate with confidence and provenance; only an explicit user action confirms it, and publishing is blocked until settings and knowledge are consistent. Non-technical users get speed without losing control.

  8. 08

    Observability before features

    A voice product fails quietly: a dropped webhook or a lost recording looks like nothing happened. Custom metrics, dashboards, alerts and diagnostics endpoints made those silent failures visible, which is how the missing-calls problem was found and measured in the first place.

What I did

  • Lead the platform's architecture and technical roadmap as Principal Engineer.
  • Designed the durable call pipeline and the reconcile job that recovers missed calls.
  • Designed availability-aware warm transfer with a backend tool, business-hour schedules and a unified fallback.
  • Designed the agentic form (Agent Builder) and in-browser agent testing.
  • Built the observability layer: metrics, dashboards, alerts and diagnostics.
  • Led the migration of call recordings to authenticated, private storage with an idempotent backfill.
  • Introduced evaluation harnesses and canary rollouts for prompt changes, and spec-driven development with OpenSpec.

Outcomes

  • In production for law firms, answering calls 24/7.
  • Calls lost by webhook delivery (about 7%) are now recovered automatically.
  • 25,000+ calls processed; the recordings backfill recovered 833 missing recordings with zero errors.
  • Firm staff configure, test and publish voice agents through a chat instead of complex forms.

Sources & press

Contact

Bring me a real problem.

A scaling issue, a risky migration, an AI workflow that must become reliable, or a team that needs sharper technical direction.

Founder-level conversation · Practical feedback · NDA available on request