|
14 | 14 | Use this SDK to add realtime video, audio and data features to your Android/Kotlin app. By connecting to <a href="https://livekit.io/">LiveKit</a> Cloud or a self-hosted server, you can quickly build applications such as multi-modal AI, live streaming, or video calls with just a few lines of code. |
15 | 15 | <!--END_DESCRIPTION--> |
16 | 16 |
|
| 17 | +<!--BEGIN_AGENTS_INFO--> |
| 18 | +> [!IMPORTANT] |
| 19 | +> If you're building Voice AI, [LiveKit Agents](https://github.com/livekit/agents) is the SDK for code-first realtime voice agents. STT, LLM, TTS, turn detection, [expressive speech](https://docs.livekit.io/agents/models/tts/expressive/), [keyterm accuracy](https://docs.livekit.io/agents/models/stt/keyterms/), tool usage, and telephony all come bundled in the framework. It's available in both [Python](https://github.com/livekit/agents) and [Node.js](https://github.com/livekit/agents-js). |
| 20 | +> |
| 21 | +> ```python |
| 22 | +> # agent.py |
| 23 | +> from livekit import agents |
| 24 | +> from livekit.agents import Agent, AgentServer, AgentSession, STTContextOptions, TurnHandlingOptions, inference |
| 25 | +> |
| 26 | +> server = AgentServer() |
| 27 | +> |
| 28 | +> |
| 29 | +> @server.rtc_session(agent_name="my-agent") |
| 30 | +> async def my_agent(ctx: agents.JobContext): |
| 31 | +> session = AgentSession( |
| 32 | +> stt=inference.STT(model="deepgram/nova-3", language="multi"), |
| 33 | +> llm=inference.LLM(model="google/gemma-4-31b-it"), |
| 34 | +> tts=inference.TTS(model="inworld/inworld-tts-2", voice="Ashley"), |
| 35 | +> turn_handling=TurnHandlingOptions(turn_detection=inference.TurnDetector()), |
| 36 | +> stt_context_options=STTContextOptions(keyterms=["LiveKit", "Acme Corp"]), |
| 37 | +> expressive=True, |
| 38 | +> ) |
| 39 | +> await session.start(room=ctx.room, agent=Agent(instructions="You are a helpful voice AI assistant.")) |
| 40 | +> await session.generate_reply(instructions="Greet the user and offer your assistance.") |
| 41 | +> |
| 42 | +> |
| 43 | +> if __name__ == "__main__": |
| 44 | +> agents.cli.run_app(server) |
| 45 | +> ``` |
| 46 | +> |
| 47 | +> Models come from [LiveKit Inference](https://docs.livekit.io/agents/models/) with no per-provider API keys, and LiveKit Cloud handles [deployment](https://docs.livekit.io/deploy/agents/) and [observability](https://docs.livekit.io/deploy/observability/). Visit the docs for more info at [docs.livekit.io/agents](https://docs.livekit.io/agents/). |
| 48 | +> |
| 49 | +> Using a coding agent? Install the LiveKit skill with `npx skills add livekit/agent-skills` and add the docs MCP at `https://docs.livekit.io/mcp/` (see [coding agent support](https://docs.livekit.io/intro/coding-agents/)). |
| 50 | +<!--END_AGENTS_INFO--> |
| 51 | +
|
17 | 52 | # Table of Contents |
18 | 53 |
|
19 | 54 | - [Docs](#docs) |
|
0 commit comments