Add a voice agent to any website. No framework required, no build step needed. The widget ships as a self-contained bundle with its own Preact runtime (~160KB gzipped), six layout modes, full design-token theming, and built-in voice activity detection. It works from a CDN or as an ES module, and tears down cleanly for single-page apps.
The widget bundles everything internally. No React or build tooling required. For React-native integration, see React UI Components.
Replace YOUR_AGENT_ID with a Reusable Agent Configuration UUID, or pass an inline agent config object instead. See Agent Configuration for both patterns.
Load the widget from cdn.deepgram.com for a no-build path:
The latest segment in the URL above is replaced with the current pinned version when this page loads, so the snippet you copy targets a specific build, not a moving release pointer.
The package ships a UMD bundle at dist/widget.umd.js for <script>-tag usage. Copy or symlink it from node_modules/@deepgram/agents-widget/dist/widget.umd.js into your static assets, then load it like any other script:
Never include your API key in client-side code. Use tokenFactory to fetch short-lived tokens from your server. The apiKey option exists only for local development.
The widget ships with six layout modes. Set the layout option to choose one.
A panel that slides in from the edge of the screen. Toggled by a floating action button (FAB).
A FAB button that reveals a floating overlay panel.
Mounts directly into an existing DOM element. No FAB, no overlay.
Full-width card with configurable aspect ratio. Includes the conversation transcript. Ideal for landing pages and product demos.
A single talk button — press to start, press again to stop. Minimal footprint.
The Deepgram animated hoop visualization with start/stop controls. Audio-reactive — the orb responds to input and output volume in real time.
For layouts with a FAB (sidebar, floating, button, orb), set where the button appears:
To use your own button instead of the built-in FAB, pass its element ID:
To toggle the widget programmatically from anywhere:
Toggle UI features on or off:
Enable Silero VAD to gate audio so only speech frames reach the agent. Pass true for defaults, or fine-tune the thresholds:
When VAD is enabled, the microphone captures continuously but transmits only when speech is detected. This reduces bandwidth and improves turn-taking accuracy.
Override labels and placeholder text:
Override the agent’s system prompt or greeting for this session without changing the agent configuration in the Deepgram console:
Listen to agent lifecycle events for analytics, logging, or UI integration:
Control how the widget adapts to light and dark mode:
The class-based option watches for a CSS selector on any ancestor element. Use it when the host app controls theme via a class on <html> rather than OS preference.
Customize the widget’s appearance by overriding design tokens. Each property maps to a CSS custom property on the widget root element ([data-dg-agent]). Set a token here to override the built-in adaptive default in both light and dark modes.
To override only one color scheme, skip the theme option and write CSS directly:
The embedded layout supports additional sizing tokens:
The init() function returns a teardown function. Call it to unmount the widget, remove all injected styles, and release audio resources. This is essential for single-page apps where the widget mounts and unmounts as the user navigates.
For frameworks with lifecycle hooks, call teardown in the cleanup phase: