← All Labs Conversational Voice Managed voice edge BYO-LLM bridge
Conversational Voice · Built

Managed voice edge BYO-LLM bridge

OpenAI-compatible streaming /api/v1/chat/completions fronts DurableAgent for ElevenLabs Agents, Deepgram Voice Agent API, or Vapi; durable tools execute normally; HTTP disconnect triggers conv.abort().

Built Needs: streaming, tool-calling Smoke: pnpm exec tsx examples/30-voice-byo-llm-bridge/run.ts --smoke Run: pnpm exec tsx examples/30-voice-byo-llm-bridge/run.ts Source: examples/30-voice-byo-llm-bridge

Mechanism: Managed Voice Platform (ElevenLabs Agents WebRTC / Deepgram Voice Agent API think.provider.type = "custom" / Vapi) handles audio, AEC, VAD, and TTS, calling DurableAgent over POST /api/v1/chat/completions (text/event-stream). When the edge drops the HTTP request on user barge-in, res.on("close") triggers conv.abort(ctx).

Managed voice edge BYO-LLM bridge

zsh
pnpm exec tsx examples/30-voice-byo-llm-bridge/run.ts          # :7492 + /shell/ with custom:voice-byo-edge
pnpm exec tsx examples/30-voice-byo-llm-bridge/run.ts --smoke  # offline verification, exit 0

# With a real model behind the bridge
dotenvx run -- pnpm exec tsx examples/30-voice-byo-llm-bridge/run.ts \
  --model google:gemini-4-hydrogen

Open http://127.0.0.1:7492/shell/ to inspect the Voice: BYO-LLM Edge component (voice-byo-edge.js) with copyable ElevenLabs / Deepgram / Vapi configs, live SSE wire telemetry, and simulated HTTP barge-in.

Checks

CheckWhat it proves
sse-streams-openai-chunksPOST /api/v1/chat/completions with stream: true emits incremental chat.completion.chunk events and data: [DONE].
durable-tool-runs-behind-byo-llmA prompt invoking lookup_status runs the durable tool and streams the grounded answer while committing the tool entry to agent.sqlite.
client-disconnect-triggers-durable-abortAborting the streaming HTTP fetch mid-response fires conv.abort(ctx) and increments VoiceSessionDoc.bargeIns.
non-streaming-completion-worksstream: false returns a valid OpenAI chat.completion JSON response.
substrate-component-served/shell/manifest.json includes custom:voice-byo-edge and /shell/custom/voice-byo-edge.js returns 200.

Break it

In examples/30-voice-byo-llm-bridge/run.ts, remove the conv.abort(ctx) call inside res.on("close", ...). The client-disconnect-triggers-durable-abort check times out waiting for VoiceSessionDoc.bargeIns to increment and --smoke exits 1.

Files

  • run.ts: serveAgent + /api/v1/chat/completions SSE bridge, /api/voice-edge/{events,configs}, and --smoke.
  • components/voice-byo-edge.js: Zero-dependency Substrate Shell simulator + vendor config inspector.
  • PROMPT.md: Prompt to rebuild this lab.