- Home
- Skills
- Agents & Orchestration
- Realtime Voice Agent (pt-BR)
More screenshots
Works with the AI Agents you already use
Realtime Voice Agent (pt-BR)
by Rafael Prado
A reusable, open-source (MIT) pipeline for building real-time voice agents in Brazilian Portuguese.
Free
Realtime Voice Agent (pt-BR)
Example session with this skill installed
Using the realtime voice agent skill, set up a Portuguese (pt-BR) voice agent in this project with one tool that returns the current time. Run the offline tests first, then tell me how to start the server and what the WebSocket client has to send.
- Read your context and instructions
- Compiled the realtime voice agent
Summary
The pipeline is installed and the offline suite passes. One tool (hora_atual) is wired into the example server. Starting it with live audio needs your three API keys; I have not run it against the live APIs.
1. Install and verify (no keys needed)
python -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt -r requirements-dev.txt
pytest -q
6 passed
The 6 tests cover sentence chunking, a full turn that includes a tool call (with the filler phrase spoken before the tool runs), and barge-in leaving a valid history.
2. The tool and the wiring (from examples/server.py)
TOOLS_SCHEMA = [{
"name": "hora_atual",
"description": "Devolve a data e a hora atuais do servidor.",
"input_schema": {"type": "object", "properties": {}},
}]
class MyTools:
def run(self, name, args):
if name == "hora_atual":
return datetime.now().strftime("%Y-%m-%d %H:%M"), False
return f"ferramenta desconhecida: {name}", True
session = VoiceSession(
ws=ws, settings=s,
agent=Agent(llm, MyTools(), TOOLS_SCHEMA, s.llm_max_tool_rounds),
system_prompt=SYSTEM_PROMPT, greeting=GREETING,
stt_factory=lambda: DeepgramSTT(...),
tts_factory=lambda: ElevenLabsTTS(...),
)
run() stays synchronous and fast on purpose: the tool_use and tool_result are written to the history together, so a barge-in can never leave an invalid conversation.
3. Start it
cp .env.example .env # add ANTHROPIC_API_KEY, DEEPGRAM_API_KEY, ELEVENLABS_API_KEY
uvicorn examples.server:app --reload
4. What the WebSocket client sends and receives
| Direction | Content |
|---|---|
| Client → server | binary PCM16 mono 16 kHz frames; JSON {"type":"start"}, {"type":"interrupt"}, {"type":"stop"} |
| Server → client | binary PCM16 24 kHz voice; JSON ready, state, transcript, assistant, tool_call, tool_result, interrupt, metrics, error |
On an interrupt event the client must send "clear" to the player worklet (static/worklets.js) so audio stops immediately.
Next steps
- Swap
hora_atualfor your own tools and adapt the spoken-style prompt (short sentences, numbers written out). - Use headphones to test barge-in, or set
BARGE_IN=falsefor speakers. - Measure latency yourself: run 20 turns and read
endpointing_ms,llm_ttft_ms,tts_first_audio_msandvoice_to_voice_msfrom eachmetricsevent. The skill'sSKILL.mdexplains how to compute the median and p95.
Connects securely to your tools. The creator never sees your data.
About this skill
A reusable, open-source (MIT) pipeline for building real-time voice agents in Brazilian Portuguese. It extracts the orchestration layer of a working clinic-receptionist demo into a module you can point at your own tools and prompt.
What it does
- End-to-end streaming: microphone audio goes over a WebSocket to Deepgram Nova-3, the transcript goes to Claude (streaming, with tool calling), and the answer is spoken by ElevenLabs while it is still being generated.
- Barge-in: if the user talks over the agent, the LLM call, the TTS stream and the browser player are all cancelled, and the interrupted sentence is kept in the history as interrupted.
- Sentence chunking: LLM tokens are cut into sentences for incremental TTS. The first chunk may break at a comma to start speaking earlier; abbreviations such as "Dra." and numbers such as "1.500" are handled.
- Atomic tool rounds: a tool_use and its tool_result are written to the history together, so an interruption never leaves an invalid conversation.
- Filler phrase: a short "let me check" phrase is spoken while a tool runs.
- Per-turn metrics: endpointing, first LLM token, first sentence, first TTS audio and voice-to-voice, measured on the audio clock.
- Swappable providers: Deepgram, Claude and ElevenLabs sit behind small interfaces, so you can replace any of them.
How to use it
- Install the requirements and run
pytest -q(offline, no keys needed). - Copy
.env.exampleto.envand add your own Anthropic, Deepgram and ElevenLabs keys. - Implement your tools as an object with
run(name, args)and a tool schema in Messages API format, then adapt the voice prompt (seeexamples/server.py). - Run
uvicorn examples.server:app --reload. The WebSocket protocol and the browser audio worklets (static/worklets.js) are documented inSKILL.md.
Honest status
The 6 tests run offline with fake providers (sentence chunking, a full turn with a tool call, barge-in). This package has not been benchmarked against the live APIs yet, so the sub-1.5 s voice-to-voice figure is a design target, not a measured result. SKILL.md explains how to measure it on your own setup.
Requirements
Python 3.11+, your own API keys for Anthropic, Deepgram and ElevenLabs, and headphones to test barge-in.
Not included
SIP/phone-line integration, multi-speaker handling, and the full browser UI of the original demo. Voice quality and latency depend on your network and your providers.
Not benchmarked against the live APIs; the sub-1.5 s voice-to-voice figure is a design target. Offline tests use fake providers. Requires Python 3.11+ and your own Anthropic, Deepgram and ElevenLabs keys. No SIP/PSTN, no multi-speaker handling, and the full browser UI of the original demo is not included (only the audio worklets and the WebSocket protocol).
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Free to use
No account required to browse
Trust & safety
Security scan
Security scan passed 16 days ago
- Free with an Agensi account
- Accounts
Anthropic API keyDeepgram API key
ElevenLabs API key
- Software
Python 3.11+
Permissions
Network access: WebSocket calls to Deepgram, Anthropic and ElevenLabs. Environment variables / files: reads your own API keys from a local .env. Terminal: pytest and uvicorn. No data leaves your machine except to those three providers.
What's inside
Frequently Asked Questions
New in Agents & Orchestration
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Agents & Orchestration.