# Deepgram Rust Voice Agent

> Using Deepgram Voice Agent (Rust SDK)

- Skill: `deepgram/deepgram-rust-voice-agent` (Agent Skill)
- Install (CLI): `npx skillmds@latest add deepgram/deepgram-rust-voice-agent`
- Raw SKILL.md: https://api.skillmd.com/api/skills/deepgram/deepgram-rust-voice-agent/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: AI & ML
- Author: deepgram (https://skillmd.com/u/deepgram)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/deepgram/deepgram-rust-voice-agent

---


# Using Deepgram Voice Agent (Rust SDK)

Use this skill when the user wants the full Voice Agent API from Rust.

## When to use this product

- Building an end-to-end conversational voice agent on Deepgram's Agent WebSocket.
- Explaining the difference between Flux conversational STT support and unsupported full Agent support in this crate.
- Pointing maintainers or app developers to raw WebSocket fallback guidance.

## Authentication

**Not yet supported in this crate as a first-class module.** There is no `deepgram::agent`, `deepgram::voice_agent`, or typed `/v1/agent/converse` client in `src/` today.

Use raw WebSocket code if you must call Agent before the crate adds support.

## Quick start: raw WebSocket fallback

The raw fallback requires four extra crates. These versions + features match the ones already used by this repo (`Cargo.toml`), so you won't pull in duplicate major versions or an unexpected OpenSSL dependency:

```toml
[dependencies]
tokio = { version = "1", features = ["full"] }
tokio-tungstenite = { version = "0.28", features = ["rustls-tls-webpki-roots"] }
futures = "0.3"
http = "1.4"
```

```rust
use futures::{SinkExt, StreamExt};
use tokio_tungstenite::{connect_async, tungstenite::Message};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let api_key = std::env::var("DEEPGRAM_API_KEY")?;

    let request = http::Request::builder()
        .uri("wss://agent.deepgram.com/v1/agent/converse")
        .header("Authorization", format!("Token {api_key}"))
        .body(())?;

    let (mut ws, _) = connect_async(request).await?;

    ws.send(Message::Text(r#"{"type":"Settings","audio":{"input":{"encoding":"linear16","sample_rate":16000}}}"#.into())).await?;

    while let Some(message) = ws.next().await {
        println!("{:?}", message?);
    }

    Ok(())
}
```

## Key parameters

- Endpoint: `wss://agent.deepgram.com/v1/agent/converse` (distinct from `api.deepgram.com` — Voice Agent runs on its own host).
- Auth header: `Authorization: Token <api_key>`.
- Initial message ordering matters: send settings/config before media.
- If the request is really about turn-based STT only, prefer the supported Flux Rust APIs instead.

## API reference (layered)

1. **In-repo**
   - No dedicated voice-agent module exists in this crate today
   - Closest supported surface is `src/listen/flux.rs` for conversational STT only
2. **OpenAPI**
   - Raw spec: `https://developers.deepgram.com/openapi.yaml`
   - Voice Agent reference page: `https://developers.deepgram.com/reference/voice-agent/voice-agent`
3. **AsyncAPI**
   - Raw spec: `https://developers.deepgram.com/asyncapi.yaml`
   - Voice Agent channel reference: `https://developers.deepgram.com/reference/voice-agent/voice-agent`
4. **Context7**
   - `/llmstxt/developers_deepgram_llms_txt`
5. **Product docs**
   - `https://developers.deepgram.com/docs/voice-agent`

## Gotchas

1. **Flux is not Voice Agent.** `flux_request()` only gives conversational STT events, not the full agent orchestration API.
2. **Do not invent crate APIs.** There is no supported Rust wrapper for agent settings, audio replies, function calls, or reusable agent configs.
3. **Agent is WebSocket-first.** If you implement a workaround, validate message sequencing against the official docs, not the Rust crate.

## Example files in this repo

- No dedicated Voice Agent examples are present in this Rust repository.
- Closest related examples are Flux examples under `examples/transcription/flux/`.

## Central product skills

For cross-language Deepgram product knowledge — the consolidated API reference, documentation finder, focused runnable recipes, third-party integration examples, and MCP setup — install the central skills:

```bash
npx skills add deepgram/skills
```

This SDK ships language-idiomatic code skills; `deepgram/skills` ships cross-language product knowledge (see `api`, `docs`, `recipes`, `examples`, `starters`, `setup-mcp`).

