Skip to content

Commit f412f8c

Browse files
committed
Cleanup'
1 parent 19889bb commit f412f8c

File tree

3 files changed

+54
-21
lines changed

3 files changed

+54
-21
lines changed

README.md

Lines changed: 46 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,21 @@
22
<img src="./.github/assets/livekit-mark.png" alt="LiveKit logo" width="100" height="100">
33
</a>
44

5-
# Voice AI Assistant with LiveKit Agents
5+
# LiveKit Agents Starter - Python
66

7-
<p>
8-
<a href="https://cloud.livekit.io/projects/p_/sandbox"><strong>Deploy a sandbox app</strong></a>
9-
10-
<a href="https://docs.livekit.io/agents/">LiveKit Agents Docs</a>
11-
12-
<a href="https://livekit.io/cloud">LiveKit Cloud</a>
13-
14-
<a href="https://blog.livekit.io/">Blog</a>
15-
</p>
7+
A complete starter project for building voice AI apps with [LiveKit Agents for Python](https://github.com/livekit/agents).
168

17-
A simple voice AI assistant built with [LiveKit Agents for Python](https://github.com/livekit/agents).
9+
The starter project includes:
10+
11+
- A simple voice AI assistant based on the [Voice AI quickstart](https://docs.livekit.io/agents/start/voice-ai/)
12+
- Voice AI pipeline based on [OpenAI](https://docs.livekit.io/agents/integrations/llm/openai/), [Cartesia](https://docs.livekit.io/agents/integrations/tts/cartesia/), and [Deepgram](https://docs.livekit.io/agents/integrations/llm/deepgram/)
13+
- Easily integrate your preferred [LLM](https://docs.livekit.io/agents/integrations/llm/), [STT](https://docs.livekit.io/agents/integrations/stt/), and [TTS](https://docs.livekit.io/agents/integrations/tts/) instead, or swap to a realtime model like the [OpenAI Realtime API](https://docs.livekit.io/agents/integrations/realtime/openai)
14+
- Eval suite based on the LiveKit Agents [testing & evaluation framework](https://docs.livekit.io/agents/testing/)
15+
- [LiveKit Turn Detector](https://docs.livekit.io/agents/build/turns/turn-detector/) for contextually-aware speaker detection, with multilingual support
16+
- [LiveKit Cloud enhanced noise cancellation](https://docs.livekit.io/home/cloud/noise-cancellation/)
17+
- Integrated [metrics and logging](https://docs.livekit.io/agents/build/metrics/)
18+
19+
This starter app is compatible with [SIP-based telephony](https://docs.livekit.io/agents/start/telephony/) or any [custom web/mobile frontend](https://docs.livekit.io/agents/start/frontend/).
1820

1921
## Dev Setup
2022

@@ -27,30 +29,55 @@ uv sync
2729

2830
Set up the environment by copying `.env.example` to `.env` and filling in the required values:
2931

30-
- `LIVEKIT_URL`
32+
- `LIVEKIT_URL`: Use [LiveKit Cloud](https://cloud.livekit.io/) or [run your own](https://docs.livekit.io/home/self-hosting/)
3133
- `LIVEKIT_API_KEY`
3234
- `LIVEKIT_API_SECRET`
33-
- `OPENAI_API_KEY`
34-
- `DEEPGRAM_API_KEY`
35+
- `OPENAI_API_KEY`: [Get a key](https://platform.openai.com/api-keys) or use your [preferred LLM provider](https://docs.livekit.io/agents/integrations/llm/)
36+
- `DEEPGRAM_API_KEY`: [Get a key](https://console.deepgram.com/) or use your [preferred STT provider](https://docs.livekit.io/agents/integrations/stt/)
37+
- `CARTESIA_API_KEY`: [Get a key](https://play.cartesia.ai/keys) or use your [preferred TTS provider](https://docs.livekit.io/agents/integrations/tts/)
3538

36-
You can also do this automatically using the LiveKit CLI:
39+
You can load the LiveKit environment automatically using the [LiveKit CLI](https://docs.livekit.io/home/cli/cli-setup):
3740

3841
```bash
3942
lk app env -w .env
4043
```
4144

42-
Run the agent in console mode:
45+
## Run the agent
46+
47+
Run this command to speak to your agent directly in your terminal:
4348

4449
```console
4550
uv run python src/agent.py console
4651
```
4752

53+
To run the agent for use with a frontend or telephony, use the `dev` command:
54+
55+
```console
56+
uv run python src/agent.py dev
57+
```
58+
59+
In production, use the `start` command:
60+
61+
```console
62+
uv run python src/agent.py start
63+
```
64+
65+
## Web and mobile frontends
66+
67+
To use a prebuilt frontend or build your own, see the [agents frontend guide](https://docs.livekit.io/agents/start/frontend/).
4868

49-
This agent requires a frontend application to communicate with. Use a [starter app](https://docs.livekit.io/agents/start/frontend/#starter-apps), our hosted [Sandbox](https://cloud.livekit.io/projects/p_/sandbox) frontends, or the [LiveKit Agents Playground](https://agents-playground.livekit.io/).
69+
## Telephony
5070

71+
To add a phone number, see the [agents telephony guide](https://docs.livekit.io/agents/start/telephony/).
5172

52-
Run evals
73+
## Tests and evals
74+
75+
This project includes a complete suite of evals, based on the LiveKit Agents [testing & evaluation framework](https://docs.livekit.io/agents/testing/). To run them, use `pytest`.
5376

5477
```console
5578
uv run pytest evals
56-
```
79+
```
80+
81+
## License
82+
83+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "agent-starter-python"
7-
version = "0.1.0"
7+
version = "1.0.0"
88
description = "Simple voice AI assistant built with LiveKit Agents for Python"
99
requires-python = ">=3.9"
1010

src/agent.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,21 @@ async def entrypoint(ctx: JobContext):
6666
"room": ctx.room.name,
6767
}
6868

69+
# Set up a voice AI pipeline using OpenAI, Cartesia, Deepgram, and the LiveKit turn detector
6970
session = AgentSession(
70-
vad=ctx.proc.userdata["vad"],
7171
# any combination of STT, LLM, TTS, or realtime API can be used
7272
llm=openai.LLM(model="gpt-4o-mini"),
7373
stt=deepgram.STT(model="nova-3", language="multi"),
7474
tts=cartesia.TTS(),
7575
# use LiveKit's turn detection model
7676
turn_detection=MultilingualModel(),
77+
vad=ctx.proc.userdata["vad"],
7778
)
79+
80+
# To use the OpenAI Realtime API, use the following session setup instead:
81+
# session = AgentSession(
82+
# llm=openai.realtime.RealtimeModel()
83+
# )
7884

7985
# log metrics as they are emitted, and total usage after session is over
8086
usage_collector = metrics.UsageCollector()

0 commit comments

Comments
 (0)