Skip to content

[Suggestion] Durable voice agent with SQLite conversation persistence and cross-session resume (Python) #335

Description

@deepgram-robot

What to build

A working example that adds durable conversation persistence to a Deepgram Voice Agent session using SQLite: every turn (user utterance, agent response, tool calls, timing metadata) is persisted to a local database, and conversations can be resumed across sessions with full context restoration.

Why this matters

Production voice agents need conversation continuity — a customer who calls back should not have to repeat themselves. Currently, Deepgram voice agent examples are ephemeral: conversation context is lost when the WebSocket disconnects. Developers building customer service, healthcare intake, or sales qualification agents need a persistence pattern that works without infrastructure overhead. SQLite provides zero-configuration durability (no Redis/Postgres setup) while demonstrating the pattern that developers can later scale to their production database. This pattern also enables conversation analytics, compliance audit trails, and debugging replay.

Suggested scope

  • Language: Python
  • Deepgram APIs: Voice Agent API (WebSocket)
  • Dependencies: sqlite3 (stdlib), deepgram-sdk
  • Components:
    • SQLite schema: conversations, turns (role, content, timestamp, latency), tool_calls, session_metadata
    • Conversation persistence middleware: automatically records every voice agent event
    • Session resume: load previous conversation context when reconnecting with a conversation ID
    • Context compression: summarize older turns to fit within LLM context window on resume
    • CLI commands: --new (start fresh), --resume <id> (continue), --list (show conversations), --replay <id> (print transcript)
  • Complexity: Medium — single Python application with SQLite persistence layer

Acceptance criteria

  • Runnable with minimal setup (clone, add API key, run)
  • README explains the pattern clearly
  • Uses current SDK version
  • Persists full conversation state to SQLite (no external database required)
  • Supports resuming a conversation with context from previous sessions
  • Includes CLI interface for listing and replaying past conversations

Raised by the DX intelligence system.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions