惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

G
Google Developers Blog
WordPress大学
WordPress大学
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
小众软件
小众软件
人人都是产品经理
人人都是产品经理
美团技术团队
Blog — PlanetScale
Blog — PlanetScale
S
SegmentFault 最新的问题
博客园 - 【当耐特】
V
V2EX
Microsoft Azure Blog
Microsoft Azure Blog
博客园 - 叶小钗
Google DeepMind News
Google DeepMind News
量子位
罗磊的独立博客
月光博客
月光博客
N
Netflix TechBlog - Medium
大猫的无限游戏
大猫的无限游戏
博客园_首页
P
Proofpoint News Feed
Jina AI
Jina AI
云风的 BLOG
云风的 BLOG
博客园 - 司徒正美
腾讯CDC

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
How I built a voice AI agent that answers phone calls and...
David · 2026-05-10 · via DEV Community

David

I got tired of seeing small businesses miss calls. So I built Vokio — a voice AI agent that answers real phone calls, remembers callers between sessions, and generates a post-call summary automatically.

Here's the full architecture and how I solved the hard parts.

Stack

  • Python + Flask (webhook server)
  • Vapi (telephony + STT)
  • Claude Haiku (conversation)
  • Deepgram Nova 3 (Spanish STT)
  • Azure TTS (Spanish voices)
  • SQLite (memory between calls)

How it works

Vapi handles the phone call and speech recognition. Instead of using a built-in LLM, I configured Vapi to use a Custom LLM — pointing it to my Flask server. Every time the caller says something, Vapi sends a POST request to my endpoint and expects an OpenAI-compatible streaming response.

@app.route("/chat/completions", methods=["POST"])
def chat():
    data = request.json or {}
    phone = data["call"]["customer"]["number"]
    last_message = [m for m in data["messages"] if m["role"] == "user"][-1]["content"]
    response = generate_response(phone, last_message)
    # return SSE streaming response

Enter fullscreen mode Exit fullscreen mode

The memory system

This is the interesting part. Every caller is stored in SQLite by phone number. When a call comes in, I query the DB and inject the caller's history into the system prompt.

def generate_response(phone: str, user_message: str) -> str:
    caller = get_caller(phone)
    history = get_history(phone)

    if caller and caller.get("name"):
        system += f"\n\nYou already know this caller, their name is {caller['name']}."

    if caller and caller.get("sentiment") == "frustrated":
        system += "\n\nNOTE: This caller was frustrated last time. Be especially patient."

Enter fullscreen mode Exit fullscreen mode

If the caller was frustrated last time, Claude knows and adjusts its tone automatically.

Post-call analysis

When the call ends, Vapi sends a webhook to /end-call. I pass the transcript to Claude and get back:

  • 2-line summary
  • Urgency score (1-5)
  • Required action ("call back today", "send quote", "none")
  • Customer sentiment (satisfied / neutral / frustrated)

All stored in SQLite. The business knows at a glance which calls need attention today.

The tricky parts

Streaming is required. Vapi expects SSE streaming responses. If you return regular JSON the call hangs up immediately. Took me a while to figure that out.

Tool use + verbal response. When Claude uses a tool (like saving the caller's name) without producing text, you get an empty response. I added a follow-up API call to get the verbal response without Claude announcing what it just saved.

dotenv loading. If environment variables already exist in the system, load_dotenv() won't override them. Use override=True.

Result

A 5-minute call costs approximately €0.28. The agent answers in Spanish, detects if the caller switches to English or Catalan, and responds in the same language automatically.

I packaged it as a ready-to-deploy template with 6 business sector prompts included (dental clinic, restaurant, hair salon, real estate, mechanic, hostel).

https://kitbot.gumroad.com/l/vokio