Loading…
Topic
FastAPI
3 posts about FastAPI. Every summary links to the original.
- 3 posts
- 1 company
The Good Stuff
Paid picks we use ourselves. Links carry a referral code — a subscription through one earns us a commission at no extra cost to you.
Newest first
Posts
My Voice AI Demo Was Hit by a $982 Traffic-Pumping Attack! Here’s What I Learned
A voice AI demo using Twilio Conversation Relay and FastAPI was exploited when automated clients repeatedly called its unauthenticated /api/call endpoint, generating 1,008 requests and 921 outbound calls to Israeli +972229 numbers. The incident cost $971.50 in Twilio voice usage and $10.58 in Google Gemini fees, matching International Revenue Sharing Fraud that keeps calls connected for per-minute revenue. The author used the Twilio CLI to group call records showing 920 of 921 calls targeted the same narrow Israeli range and correlated Azure Log Analytics to confirm the exploited endpoint. Calls were kept alive by automated scripts replaying conversation-extension prompts from only 541 distinct lines across 8,363 transcriptions, with some recordings mentioning happy trafficking. The post recommends authentication, duration limits, geographic permissions, signature validation, usage triggers, and demo isolation as essential controls for public voice AI apps.
How to Orchestrate Multi-Call Conversations with an LLM and Twilio Conversation Memory in Python
The tutorial builds a Python FastAPI voice service that preserves caller context, preferences, and action history across separate inbound calls using Twilio Conversation Memory. It connects a Twilio phone number to a /voice webhook and /ws WebSocket through Conversation Relay, then uses an asynchronous OpenAI client with gpt-4o-mini to generate streamed responses. A memory service retrieves stored information by caller number, while each completed call is summarized and written back to the configured memory store. The example uses an auto-repair assistant whose system prompt incorporates prior context before the next call, and the test procedure checks that a second call recalls details from the first. The setup requires Python 3.11 or later, Twilio and OpenAI credentials, a memory-store and configuration ID, and ngrok for exposing local webhooks.
How to Connect Your Twilio Agent to External APIs in Python
Voice agents can converse, but need external APIs to retrieve live data or take actions such as checking inventory and booking appointments. This tutorial builds a Python and FastAPI voice agent with Twilio Conversation Relay, OpenAI tool calling, and an unauthenticated Cat Facts REST API. A FastAPI webhook returns TwiML that connects callers to a websocket, while Conversation Relay messages are converted into conversation history and streamed responses. When the model requests a cat fact, the application executes the tool, sends its result back to OpenAI, and streams the follow-up answer to the caller. The setup uses environment variables for the OpenAI key, httpx for asynchronous external requests, and ngrok to expose local webhooks; the completed test lets a caller ask for and receive a cat fact.
Related topics
All topics →Weekly digest
The best engineering reads, once a week.