streamlit-livekit
Talk to a LiveKit voice agent from a Streamlit app, in real time.
voice_agent() is a Streamlit custom component (v2). It renders:
- Start and End buttons plus a Mute button.
- Audio meters for you and for the agent, along with the agent's state (listening, thinking, speaking).
- A live transcript.
It follows the app's light, dark, or custom theme.
Audio streams directly between the browser and LiveKit through livekit-client. Python only creates the access token. That token dispatches your agent to a fresh room for each conversation.
Installation
Until it's published on PyPI, install it from GitHub:
pip install git+https://github.com/dataprofessor/streamlit-livekit
It needs Python 3.10+ and Streamlit 1.51+. You also need a LiveKit Cloud project (or a self-hosted LiveKit server) and an agent built with LiveKit Agents.
Usage
import streamlit as st
from streamlit_livekit import voice_agent
result = voice_agent("my-agent") # the agent_name your agent registers with
st.write(result.state) # "idle" | "connecting" | "connected" | "ended"
st.write(result.transcript) # [{"role": "user" | "agent", "text": "..."}]
# Let the user save the conversation
st.download_button("Export transcript", result.to_text(), file_name="transcript.txt")
Credentials come from LIVEKIT_URL, LIVEKIT_API_KEY, and LIVEKIT_API_SECRET, or from the url, api_key, and api_secret arguments.
Talking to an agent on your machine
lk agent dev registers under a random dev-... deployment unless you name one. Name it, and pass the same name to voice_agent():
lk agent dev --deployment local-dev
voice_agent("my-agent", deployment="local-dev")
Leave deployment empty to reach the production deployment on LiveKit Cloud.
API
voice_agent(agent_name, *, deployment="", url=None, api_key=None, api_secret=None, room_prefix="streamlit", token_ttl=timedelta(minutes=15), key="voice_agent")
It returns a VoiceAgentResult with these fields:
| Field / method | Description |
|---|---|
state |
"idle", "connecting", "connected", or "ended" |
transcript |
Final lines so far, as [{"role": "user" | "agent", "text": ...}] |
room |
The LiveKit room for the current conversation |
to_text() |
The transcript as plain text, one You: or Agent: line per turn |
Each conversation gets its own room, because LiveKit only dispatches an agent when a room is created. The panel's "New conversation" button asks Python for a fresh room and token.
Example app
example/streamlit_app.py is a complete page with transcript export. Copy example/.streamlit/secrets.toml.example to secrets.toml, fill in your LiveKit credentials, start your agent, and run:
cd example
streamlit run streamlit_app.py
Development
git clone https://github.com/dataprofessor/streamlit-livekit
cd streamlit-livekit
uv sync
uv run streamlit run example/streamlit_app.py
The component lives in streamlit_livekit/: the Python API is in __init__.py, and the browser side is in frontend/ (HTML, CSS, and JS). Streamlit serves the CSS and JS from the asset_dir declared in streamlit_livekit/pyproject.toml. It picks up JS and CSS edits on reload, but changes to the Python code need a restart of streamlit run.
Format and lint with uv run ruff format and uv run ruff check.
Releasing
Publishing a GitHub release publishes the package to PyPI through .github/workflows/publish.yml, using trusted publishing, so no API token is stored. To release:
-
Bump
versioninpyproject.toml(or runuv version --bump patch), and commit. -
Publish a GitHub release tagged with that version and a leading
v, e.g.v0.1.1:gh release create v0.1.1 --generate-notes
The workflow fails without publishing if the tag doesn't match the version.
Notes
- The browser loads
livekit-clientfrom jsDelivr the first time you start a conversation. - Microphone access needs a secure context:
localhostor HTTPS. result.transcriptgets only final lines, so Streamlit doesn't rerun on every partial word. The panel itself shows the partial words as they arrive.
License
MIT
Metadata
Release files for streamlit-livekit 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| streamlit_livekit-0.1.0.tar.gz | 14.1 kB | With provenance | Details for streamlit_livekit-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| streamlit_livekit-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for streamlit_livekit-0.1.0-py3-none-any.whl |
Total release size: 27.5 kB
Release files / streamlit_livekit-0.1.0.tar.gz
| Download URL | streamlit_livekit-0.1.0.tar.gz |
|---|---|
| Size | 14.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7169d4e24f674d010192caf9030ee39029558fb498dbf6dab4ed7134bcf9bc98
|
|
BLAKE2b-256 checksum How to use checksums |
fa846a90a5aa66301f5920a71067e4fd9d395bab46b5ab87529eed62ea505a92
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.
Transparency logRelease files / streamlit_livekit-0.1.0-py3-none-any.whl
| Download URL | streamlit_livekit-0.1.0-py3-none-any.whl |
|---|---|
| Size | 13.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c742f65140fcd02025817f3dcbdd434fd743281cc0ee7c52a077b9ab5db704cb
|
|
BLAKE2b-256 checksum How to use checksums |
a162c9166d7c3fbe770f36106bfc2ed1caab59dd071150ee4c1e528ef1ac633e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.
Transparency logSecurity for streamlit-livekit 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for streamlit_livekit-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.