feat: use official deepgram-sdk for voice agent - #10
Open
GregHolmes wants to merge 2 commits into
Open
Conversation
…SDK major
- On EventType.ERROR, forward a structured {type: Error, code: PROVIDER_ERROR}
frame to the browser before teardown, restoring the pre-migration contract
(previously a mid-session Deepgram error only closed the socket with no
payload).
- Pin deepgram-sdk>=7.6.0,<8 so a future breaking major can't be pulled in.
- Document why control frames go through the private _send(): agent.v1 offers
only typed senders and no public raw/dict send, so a transparent proxy has
no public path (tracking a public raw send upstream).
GregHolmes
marked this pull request as ready for review
July 31, 2026 16:28
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Migrate the Deepgram-facing side of this Voice Agent proxy from a raw
websocket-clientconnection to the officialdeepgram-sdk(client.agent.v1).How
websocket.create_connection(wss://agent.deepgram.com/...)withdeepgram.agent.v1.connect(), running the SDK's blockingstart_listening()in a background thread and forwarding agent messages to the browser (binary audio as-is, JSON events viamodel_dump_json).connection.send_media(...); browser JSON control frames (Settings, Update*, InjectAgentMessage, KeepAlive, ...) are forwarded verbatim, so no frontend changes are required.requirements.txt: droppedwebsocket-clientand the now-unusedrequests, addeddeepgram-sdk>=7.6.0.deepgram.toml:sdk = "deepgram-sdk"./api/session,/api/metadata, monkeypatch, and shutdown unchanged.Notes
dg-request-idfrom the raw upgrade response headers; the SDK connection does not expose those, so that log line was dropped (minor observability change).test_app.pyis pre-existing dead code unrelated to this change: it importssocketio/dg_connectionfrom a removedflask-socketioimplementation and does not match the currentflask-sockapp. Left untouched; it should be rewritten separately.Verified
pip install -r requirements.txt(resolveddeepgram-sdk 7.6.0),python -c "import app"imports cleanly.Manual verification needed
test_app.py.