Real-Time Voice Agent for a Fire-Information Line
I built a real-time voice agent that answers people who report a fire by phone-style voice: it listens, works out where the caller is, checks that place against the list of affected areas, and answers out loud in the caller's language. I compared a rule-based design with one where the LLM writes the answers, and kept the one that is both natural and safe: the model talks, the code decides what counts as safe.
TL;DR: Key Takeaway The interesting question was not "can an LLM run a safety line?" but "what should the LLM be trusted with?" It is good at understanding messy speech and writing a calm, natural answer. It is not good enough, alone, at deciding which areas are affected. Giving each part the job it is good at, and letting the code verify the one decision that must not be wrong, kept the answers natural and safe. I measured it before building it, which saved me from shipping the version that looked best in a demo.
The Problem
When a fire is spreading, emergency lines get saturated. Many callers ask the same few things: is my area affected, and what should I do? A person answering them one by one is slow, and a recorded message cannot react to what the caller says.
At Sofrecom, I built a voice agent that takes the first-level calls: the caller says what they see and where they are, and gets a spoken answer in their own language, English or Dutch. The hard part is not the voice. It is safety: the one error this system must never make is telling someone in an affected area that they are safe. A friendly but wrong answer is worse than no answer.
There were also practical constraints. The answer has to come within about two to three seconds or the call feels broken. The speech has to be understood on a real microphone, with accents and noise, not on clean test recordings. And everything had to run on a platform I could deploy myself and replay at will, so that other teams could reuse the pipeline for a hotline.
The Approach
I split the system into a chain of steps that each do one thing: detect when the caller has finished speaking, transcribe the speech, decide what to say, write the sentence, and speak it. The speech models run as GPU endpoints that I deployed on the Gcore AI Grid; the orchestration runs with Pipecat.
Decision: let the code decide, or let the LLM decide?
My first version (V1) was deliberately cautious. A short piece of code looks the town up in two lists (affected and not affected), decides the case (affected, not affected, no town, off topic, goodbye), and the LLM only says the matching fixed sentence. It is very predictable and never wrongly reassures anyone. But it is not really "AI": the model recites, and every answer sounds the same.
Decision: measure the LLM alone before trusting it
The obvious next step was to let the LLM understand the caller and answer in its own words. Before building that, I tested it. I wrote 60 sentences (English and Dutch, including towns close to the fire, misheard names, friends in danger, off-topic messages and attempts to trick the line) and asked the model alone to classify them. It got 41 to 51 of 60 right depending on the prompt, mostly false alarms for towns next to the affected area, and in some variants it said "not affected" for an affected place. For a safety line that is not good enough.
Decision: a hybrid, where the model writes and the code has the last word (V2)
In V2 the model reads the lists and the caller's sentence and answers with a small JSON: the place it heard, a category, and the reply. The code compares the model's category with its own decision from the same lists. If they agree and the reply passes a few checks (it mentions 112 when it should, it asks a question when it needs the town, it never reassures unless the town is known as not affected, it is short, it is in the right language), the model's own words are spoken. If anything disagrees, the fixed sentence of V1 is spoken instead. With this check, 59 of 60 sentences were right, with no dangerous answer.
Implementation Details
Making the microphone work. The first live tests lost the beginning of many sentences. Replaying a recorded call through the app in two ways showed the cause: my client kept one speech-recognition session open for the whole call, while the reference recipe opens one per utterance. Opening a new session after each phrase (about 0.5 s, with no audio lost) fixed it, and a dedicated English recognition profile understood English names much better than the multilingual one. The end-of-phrase wait is 1.3 s for English: shorter, and a one-second pause splits a sentence in two; longer, and every answer is slower.
Rules that look small and matter a lot. A message with no town now asks "Which town are you in?" instead of guessing. If a caller names an affected town and later only not-affected ones, the line never says "safe": it asks again. A goodbye ("Okay, thank you. Goodbye.") ends the call without repeating the alert. Speech-recognition slips of town names ("to lose" for Toulouse) are collected from real calls into a dictionary.
The guard in V2. The model's JSON is held until it is complete, parsed, compared and checked, then released as one sentence to the voice. Follow-up questions always use the fixed sentence, because the model could name a wrong town from earlier in the call. In an offline check on 40 sentences the model's own words were spoken for 34, the fixed sentence for 6 (all of them false alarms that the code blocked), and none were dangerous. The answer time is about 0.2 to 0.3 s longer than V1 (about 2.4 to 2.6 s against 2.1 to 2.4 s).
How I tested it. A 40-sentence bilingual test set and a text runner flag unsafe answers; recorded real calls are replayed through the live app; and the new components have their own unit tests. I recorded the same scripted call in V1 and in V2 so the two versions can be compared line by line.
What is not validated yet. English is tested live with one voice and one microphone. Dutch is built (prompts, fixed sentences, voice, test sentences, offline checks) but the live Dutch voice test is still to do; French has not been started. There is no load test: each speech model runs on one GPU.
Data note. All towns and the fire are invented for the demo. No company data is used.
Key Takeaway
The interesting question was not "can an LLM run a safety line?" but "what should the LLM be trusted with?" It is good at understanding messy speech and writing a calm, natural answer. It is not good enough, alone, at deciding which areas are affected. Giving each part the job it is good at, and letting the code verify the one decision that must not be wrong, kept the answers natural and safe. I measured it before building it, which saved me from shipping the version that looked best in a demo.
Comments
FAQ
Does an LLM decide whether an area is affected?
No. The model reads and writes, but the decision comes from the affected-area lists, checked by code. If the model disagrees, the fixed verified answer is spoken.
What happens when the model is wrong?
The guard replaces its reply with a fixed sentence. In the offline check this happened for 6 of 40 sentences, always on the safe side.
Which languages work?
English is validated live. Dutch is built and tested in text; the live Dutch voice test is planned. French is not started.
How fast is the voice agent?
About 2.1 to 2.6 seconds from the end of the caller sentence to the start of the answer, depending on whether the rule-based V1 or the hybrid V2 is used.
Is this real fire or company data?
No. All towns and the fire are invented for the demo, and no company data is used.