SuperAPI AI Directory

deepgram-rust-voice-agent

Agents & models

View repository

Updated 10-15 20:35

About this skill

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:

[dependencies]
tokio = { version = "1", features = ["full"] }
tokio-tungstenite = { version = "0.28", features = ["rustls-tls-webpki-roots"] }
futures = "0.3"
http = "1.4"
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:

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).