Compare commits

...
10 Commits
Author SHA1 Message Date
zhanghaotian 1fd693a998 my first commit
Ruff / ruff-check (push) Canceled after 0s
Template Check / check-template-files (push) Canceled after 0s
Tests / test (push) Canceled after 0s
2026-08-20 15:05:05 +08:00
Tina Nguyen ddc18eb851 update default (#94) 2026-08-11 21:08:26 -04:00
Tobias Fried 7c0af539fe chore(docs): update model description in readme (#93) 2026-07-21 14:34:53 -06:00
Shayne Parlo 7d194813a3 Change default LLM model from OpenAI to Google Gemma (#92) 2026-07-06 14:24:55 -04:00
u9g 07a75c4369 post_create: skip the install hint when deps already installed (#91)
The 'uv sync' next-step is redundant when the LiveKit CLI already ran the
install task during `lk agent init --install`. Move it into a guarded subtask
that is skipped when LIVEKIT_DEPS_INSTALLED is set (the CLI sets it on a
successful install), matching the existing status-guard pattern used for
LIVEKIT_AGENT_NAME and LIVEKIT_SANDBOX_ID.
2026-06-24 15:16:24 -04:00
9bf4404101 Update starter to use new turn detection model (#85)
* Update starter to use new turn detection model

* rm redundant para.

* Untrack uv.lock and loosen livekit-agents version constraint

uv.lock should not be tracked in the template (enforced by
template-check.yml CI). Also change livekit-agents from ==1.6.0 to
>=1.6.0 so the starter picks up newer compatible releases.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* Update livekit-agents dependency to version 1.6.1

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: Chenghao Mou <chenghao.mou@livekit.io>
2026-06-17 17:53:16 +01:00
Tobias Fried a7575e8af0 chore(deps): bump livekit-agents to 1.6.0 (#88) 2026-06-11 17:36:28 -06:00
u9g d48dfda85d docs: use long-form flags in lk app env example (#87) 2026-06-09 11:21:57 -04:00
Ben Cherry 7c53a9b613 Fix dependency version specification for livekit-agents (#86)
* Fix dependency version specification for livekit-agents

* Update pyproject.toml
2026-06-08 11:41:00 -07:00
Topherhindmanandlk-agents-sync[bot] <lk-agents-sync[bot]@users.noreply.github.com> f31b78f6d6 chore: bump livekit-agents to 1.5.17 (#83)
- `livekit-agents` → `1.5.17`

Co-authored-by: lk-agents-sync[bot] <lk-agents-sync[bot]@users.noreply.github.com>
2026-06-05 10:50:08 -04:00
5 changed files with 2631 additions and 37 deletions
+9 -11
View File
@@ -9,10 +9,14 @@ A complete starter project for building voice AI apps with [LiveKit Agents for P
The starter project includes:
- A simple voice AI assistant, ready for extension and customization
- A voice AI pipeline built on [LiveKit Inference](https://docs.livekit.io/agents/models/inference)
with [models](https://docs.livekit.io/agents/models) from OpenAI, Cartesia, and Deepgram. More than 50 other model providers are supported, including [Realtime models](https://docs.livekit.io/agents/models/realtime)
- A voice AI pipeline built on [LiveKit Inference](https://docs.livekit.io/agents/models/inference), providing zero-configuration access to [models](https://docs.livekit.io/agents/models) from top labs
- Uses the fast, open-weight Gemma 4 31B model, [hosted by LiveKit](https://docs.livekit.io/agents/models/llm/livekit/) and tuned for optimal performance in voice AI, as the default LLM
- Uses Fish Audio S2.1 Pro for TTS, which renders the inline delivery markup that expressive mode relies on
- Supports more than 50 models from OpenAI, Cartesia, Deepgram, and other providers
- Access to a wide range of other models, including [Realtime models](https://docs.livekit.io/agents/models/realtime), through extensive plugin ecosystem
- Expressive mode, enabled by default: the framework injects the TTS provider's markup guide into the LLM prompt, so the model emits inline delivery tags (emotion, pacing, non-verbal sounds) that the TTS renders and the transcript never shows
- Eval suite based on the LiveKit Agents [testing & evaluation framework](https://docs.livekit.io/agents/start/testing/)
- [LiveKit Turn Detector](https://docs.livekit.io/agents/logic/turns/turn-detector/) for contextually-aware speaker detection, with multilingual support
- [LiveKit Turn Detector](https://docs.livekit.io/agents/logic/turns/turn-detector/), an end-of-turn model that listens to the user's audio directly, combining semantic understanding with acoustic cues for state-of-the-art accuracy across 14 languages
- [Background voice cancellation](https://docs.livekit.io/transport/media/noise-cancellation/)
- Deep session insights from LiveKit [Agent Observability](https://docs.livekit.io/deploy/observability/)
- A Dockerfile ready for [production deployment to LiveKit Cloud](https://docs.livekit.io/deploy/agents/)
@@ -85,20 +89,14 @@ You can load the LiveKit environment automatically using the [LiveKit CLI](https
```bash
lk cloud auth
lk app env -w -d .env.local
lk app env --write --destination .env.local
```
</details>
## Run the agent
Before your first run, you must download certain models such as [Silero VAD](https://docs.livekit.io/agents/logic/turns/vad/) and the [LiveKit turn detector](https://docs.livekit.io/agents/logic/turns/turn-detector/):
```console
uv run python src/agent.py download-files
```
Next, run this command to speak to your agent directly in your terminal:
Run this command to speak to your agent directly in your terminal:
```console
uv run python src/agent.py console
+1 -1
View File
@@ -9,7 +9,7 @@ description = "Simple voice AI assistant built with LiveKit Agents for Python"
requires-python = ">=3.10, <3.15"
dependencies = [
"livekit-agents[silero,turn-detector]==1.5.16",
"livekit-agents>=1.6.9",
"livekit-plugins-ai-coustics~=0.2",
"python-dotenv",
]
+25 -21
View File
@@ -7,13 +7,12 @@ from livekit.agents import (
AgentServer,
AgentSession,
JobContext,
JobProcess,
TurnHandlingOptions,
cli,
inference,
room_io,
)
from livekit.plugins import ai_coustics, silero
from livekit.plugins.turn_detector.multilingual import MultilingualModel
from livekit.plugins import ai_coustics
logger = logging.getLogger("agent")
@@ -25,7 +24,7 @@ class Assistant(Agent):
super().__init__(
# A Large Language Model (LLM) is your agent's brain, processing user input and generating a response
# See all available models at https://docs.livekit.io/agents/models/llm/
llm=inference.LLM(model="openai/gpt-5.2-chat-latest"),
llm=inference.LLM(model="google/gemma-4-31b-it"),
# To use a realtime model instead of a voice pipeline, replace the LLM
# with a RealtimeModel and remove the STT/TTS from the AgentSession
# (Note: This is for the OpenAI Realtime API. For other providers, see https://docs.livekit.io/agents/models/realtime/)
@@ -92,13 +91,6 @@ class Assistant(Agent):
server = AgentServer()
def prewarm(proc: JobProcess):
proc.userdata["vad"] = silero.VAD.load()
server.setup_fnc = prewarm
@server.rtc_session(agent_name="my-agent")
async def my_agent(ctx: JobContext):
# Logging setup
@@ -107,23 +99,35 @@ async def my_agent(ctx: JobContext):
"room": ctx.room.name,
}
# Set up a voice AI pipeline using OpenAI, Cartesia, Deepgram, and the LiveKit turn detector
# Set up a voice AI pipeline using AssemblyAI, Fish Audio, and the LiveKit turn detector
session = AgentSession(
# Speech-to-text (STT) is your agent's ears, turning the user's speech into text that the LLM can understand
# See all available models at https://docs.livekit.io/agents/models/stt/
stt=inference.STT(model="deepgram/nova-3", language="multi"),
stt=inference.STT(model="assemblyai/universal-3-5-pro", language="en"),
# Text-to-speech (TTS) is your agent's voice, turning the LLM's text into speech that the user can hear
# See all available models as well as voice selections at https://docs.livekit.io/agents/models/tts/
tts=inference.TTS(
model="cartesia/sonic-3", voice="9626c31c-bec5-4cca-baa8-f8ba9e84c8bc"
model="fishaudio/s2.1-pro", voice="fa4c9eb3dccc4806b382b40d61c6b10a"
),
# VAD and turn detection are used to determine when the user is speaking and when the agent should respond
# See more at https://docs.livekit.io/agents/build/turns
turn_detection=MultilingualModel(),
vad=ctx.proc.userdata["vad"],
# allow the LLM to generate a response while waiting for the end of turn
# See more at https://docs.livekit.io/agents/build/audio/#preemptive-generation
preemptive_generation=True,
turn_handling=TurnHandlingOptions(
# The LiveKit turn detector determines when the user is done speaking and the agent should respond.
# TurnDetector is an end-of-turn model that listens to the user's audio directly, combining
# semantic understanding with acoustic cues (intonation, pitch, rhythm) for state-of-the-art accuracy.
# AgentSession supplies the required VAD automatically.
# See more at https://docs.livekit.io/agents/build/turns
turn_detection=inference.TurnDetector(),
# Adaptive interruptions use the turn detector to tell a real interruption from a
# backchannel like "mhm" or "right", so the agent keeps talking through the latter.
interruption={"mode": "adaptive"},
# allow the LLM to generate a response while waiting for the end of turn
# See more at https://docs.livekit.io/agents/build/audio/#preemptive-generation
preemptive_generation={"enabled": True},
),
# Expressive mode injects the TTS provider's markup guide into the LLM prompt, so the model
# emits inline delivery tags (emotion, pacing, non-verbal sounds) that the TTS renders and
# the transcript never shows. Requires a TTS model that supports markup, such as the Fish
# Audio model above.
expressive=True,
)
# Start the session, which initializes the voice pipeline and warms up the models
+10 -4
View File
@@ -21,6 +21,14 @@ tasks:
- task: set_agent_name_if_present
- task: help_open_sandbox_if_present
help_install_hint_if_needed:
desc: "Print the local install hint, unless the CLI already installed dependencies"
status:
# Skip when `lk agent init --install` already ran the install task.
- test -n "$LIVEKIT_DEPS_INSTALLED"
cmds:
- echo '{{ indent .INDENT "uv sync" }}'
set_agent_name_if_present:
status:
- test -z "$LIVEKIT_AGENT_NAME"
@@ -42,8 +50,7 @@ tasks:
- echo 'To try your new agent directly in your terminal:'
- echo ''
- echo '{{ indent .INDENT "cd" }} {{ .REL_PATH }}'
- echo '{{ indent .INDENT "uv sync" }}'
- echo '{{ indent .INDENT "uv run" }} {{ .PYTHON_MAIN }} download-files'
- task: help_install_hint_if_needed
- echo '{{ indent .INDENT "uv run" }} {{ .PYTHON_MAIN }} console'
help_open_web_console:
@@ -56,8 +63,7 @@ tasks:
- echo 'To try your new agent in the web console:'
- echo ''
- echo '{{ indent .INDENT "cd" }} {{ .REL_PATH }}'
- echo '{{ indent .INDENT "uv sync" }}'
- echo '{{ indent .INDENT "uv run" }} {{ .PYTHON_MAIN }} download-files'
- task: help_install_hint_if_needed
- echo '{{ indent .INDENT "uv run" }} {{ .PYTHON_MAIN }} dev'
- echo ''
- echo 'Then visit:'
Generated
+2586
View File
File diff suppressed because it is too large Load Diff