prefactor-livekit
LiveKit Agents integration for Prefactor observability. This package wraps
livekit-agents sessions and emits Prefactor spans from public LiveKit session
events.
Installation
pip install prefactor-livekit
Usage
Factory pattern
from livekit.agents import AgentSession
from prefactor_livekit import PrefactorLiveKitSession
session = AgentSession(...)
tracer = PrefactorLiveKitSession.from_config(
api_url="https://app.prefactorai.com",
api_token="your-api-token",
agent_id="voice-agent", # Optional for deployment-scoped tokens
agent_name="Voice Agent",
)
await tracer.start(session=session, agent=my_agent)
await tracer.close()
With a deployment-scoped token you can omit agent_id; the backend derives the
agent and environment from the token during registration.
Example runner
The example script has a local smoke mode that emits representative LiveKit session events into Prefactor without needing STT/TTS providers or a room.
uv run python packages/livekit/examples/simple_session.py --mode smoke
It prints the Prefactor instance ID plus ready-to-run Prefactor CLI commands for retrieving the instance and listing spans for the example's time window.
prefactor agent_instances retrieve <instance-id>
prefactor agent_spans list \
--agent_instance_id <instance-id> \
--start_time <recent-start-time> \
--end_time <recent-end-time> \
--include_summaries
There is also a model-backed mode for a real text turn:
uv run python packages/livekit/examples/simple_session.py \
--mode live \
--model anthropic/claude-sonnet-4-5-20250929
Manual attachment
Use this when your app manages the session lifecycle itself and you just want the LiveKit events traced.
from prefactor_livekit import PrefactorLiveKitSession
tracer = PrefactorLiveKitSession(instance=instance)
await tracer.attach(session)
await session.generate_reply(user_input="hello")
await tracer.close()
Traced span types
livekit:sessionlivekit:user_turnlivekit:assistant_turnlivekit:toollivekit:llmlivekit:sttlivekit:ttslivekit:statelivekit:error
Development
uv run pytest packages/livekit/tests -v
Metadata
Release files for prefactor-livekit 0.1.5
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 |
|---|---|---|---|---|
| prefactor_livekit-0.1.5.tar.gz | 21.7 kB | Without provenance | Details for prefactor_livekit-0.1.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| prefactor_livekit-0.1.5-py3-none-any.whl | Python 3 | none | any | Details for prefactor_livekit-0.1.5-py3-none-any.whl |
Total release size: 35.5 kB
Release files / prefactor_livekit-0.1.5.tar.gz
| Download URL | prefactor_livekit-0.1.5.tar.gz |
|---|---|
| Size | 21.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d413125708fbf993f48b8247d88f24d0bbd224ae34c5734145ae7fe0571cd19e
|
|
BLAKE2b-256 checksum How to use checksums |
aa2e3c08cf80f278f3fea3297b10b6c8286b3b452f2f8dd6618d621ce7682198
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / prefactor_livekit-0.1.5-py3-none-any.whl
| Download URL | prefactor_livekit-0.1.5-py3-none-any.whl |
|---|---|
| Size | 13.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b3c661ac646dcfac808b79403aa64b71780a533ff5b56b6d84f52935476b7e7f
|
|
BLAKE2b-256 checksum How to use checksums |
e81a11243368f3a6d09fb0ede1f9d2b63411170f138f2268862b3d93350afa03
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for prefactor-livekit 0.1.5
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A 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.