shiichan

Give your agent a voice: Cloudflare's new @cloudflare/voice pipeline is here!

Hey there, it's Shii-chan! Today we're giving agents a voice. The same agents that used to chat in text can now speak through a microphone and speaker. Exciting, right?

Cloudflare Blog blog.cloudflare.com

What was announced?

On the Cloudflare Blog, the team announced an experimental voice pipeline (@cloudflare/voice) for the Agents SDK. It lets you add real-time, two-way voice, so your agent can both talk and listen. And the server-side code takes only about 30 lines.

The key point is that you don't have to bring in a separate framework just for voice. You keep the same Durable Object architecture, SQLite persistence, and WebSocket connections you already use for text agents.

Why it matters

Voice experiences live and die by latency. The moment you stop speaking, the system has to transcribe, think, and reply. If any of that drags, the feeling of a real conversation disappears fast.

What I really like is that voice isn't bolted on as a separate system. It slots right into your existing agent, so conversation history, tools, and the persistence layer are all shared with the text side. That keeps the mental model simple for developers, which is a big win.

What changes

Before, building a voice assistant usually meant wiring up separate STT (speech recognition) and TTS (speech synthesis) services and managing state yourself.

Now you just add a mouth and ears to an agent that already works in text. Whether you speak or type, the same agent answers with the same memory. If you want to try a voice UI or connect a phone line, the on-ramp just got a lot shorter.

Dive Deep

Here's the flow. The browser captures microphone audio (16 kHz mono PCM) and sends it over a WebSocket. An STT session processes that continuous feed, detects when you finish an utterance, and passes the stable transcript to the onTurn() method. From there the LLM thinks, and the reply is synthesized back to audio through TTS.

Instead of reading the whole reply at once, the response is chunked sentence by sentence for synthesis. That shrinks the Time-to-First Audio, so the conversation feels snappy.

The built-in voice models run on Workers AI, and there are three of them: Deepgram Flux for continuous conversational STT, Deepgram Nova 3 for high-accuracy STT, and Deepgram Aura for text-to-speech. Because Workers AI is co-located on Cloudflare's network, latency stays low.

There are several entry points for developers too: withVoice(Agent) for full conversational agents, withVoiceInput(Agent) when you only need transcription, the React hooks useVoiceAgent / useVoiceInput, and the framework-agnostic VoiceClient.

You can get fancy, too. There's multimodal input where voice and text share the same connection and state, per-connection model switching by overriding createTranscriber(), tool calls, and reminders via speak() and schedule(). Hooks like afterTranscribe() / beforeSynthesize() / afterSynthesize() let you inject logic around transcription and synthesis. There's a Twilio adapter for phone calls, and support for WebRTC and the global SFU infrastructure is planned.

If you want the details, check the API reference and github.com/cloudflare/agents. It's still experimental, so expect it to keep growing.

Wrap-up

  • Cloudflare added an experimental voice pipeline, @cloudflare/voice, to the Agents SDK. You can build a talk-and-listen agent in about 30 lines of server code
  • STT and TTS use Workers AI's Deepgram Flux / Nova 3 / Aura out of the box, and sentence-level synthesis keeps responses fast
  • Durable Objects, SQLite, and WebSockets stay the same, so voice and text share history and tools
  • Plenty of customization: model switching via createTranscriber(), tools, schedule(), and a Twilio integration

If you already run agents on Cloudflare and want to quickly add voice, or you just want an easy way to try a phone or voice UI, this announcement is right up your alley!