LiveKit Agents Adapter
Bridge any external AI agent framework to the LiveKit Agent runtime.
Overview
This package provides AgentAdapter, a livekit.agents.voice.Agent subclass that delegates
LLM inference to an external framework (LangChain, LangGraph, Strands, ADK, custom code, etc.)
via a pluggable Translator interface.
The adapter is a pure pass-through:
- Converts LiveKit's
ChatContextto the external framework's native format - Forwards text and tool calls streamed from the external framework into LiveKit's
llm_node - Syncs conversation history back to the LiveKit
ChatContextafter each turn
Tool calls are handled entirely within the external framework. The adapter does not
execute tools. When the external framework streams a ToolCall, it is forwarded to
LiveKit's ChatContext for transcript/logging purposes only. The external framework
decides when and how to stream its final text response.
Quick Start
from livekit_agents_adapter import AgentAdapter, AgentAdapterConfig, Translator, TextChunk, Done
class MyTranslator(Translator):
async def invoke(self, chat_ctx, tools):
yield TextChunk(content="Hello!", is_final=True)
yield Done(metadata={})
# ... implement to_external_chat_ctx, to_external_tools, sync_back_messages
agent = AgentAdapter(
config=AgentAdapterConfig(translator=MyTranslator(my_agent)),
instructions="You are a helpful voice assistant.",
)
# Use like any LiveKit Agent in AgentSession...
await session.start(agent=agent, room=room)
Writing a Translator
Subclass Translator (an abc.ABC) and implement four required methods:
from livekit_agents_adapter import Translator, TextChunk, ToolCall, Done
class MyTranslator(Translator):
async def to_external_chat_ctx(self, chat_ctx):
# Convert LiveKit ChatContext → your framework's format
return my_framework_messages
async def to_external_tools(self, tools):
# Convert LiveKit llm.Tool → your framework's tool format
return my_framework_tools
async def invoke(self, chat_ctx, tools):
# Stream responses from your framework.
# The adapter forwards TextChunk to TTS, ToolCall to ChatContext.
# Yield Done to signal end of turn.
async for chunk in my_framework_stream(chat_ctx, tools):
yield TextChunk(content=chunk) # or ToolCall(...)
yield Done(metadata={})
async def sync_back_messages(self, chat_ctx):
# Return new ChatItems for the adapter to insert into ChatContext.
from livekit_agents_adapter.translators.chat_context import sync_from_list_to_items
return sync_from_list_to_items(self._messages[self._last_synced_count :])
Installation
# Core package
pip install livekit-agents-adapter
# With LangChain support
pip install livekit-agents-adapter-langchain
More
- Source: https://github.com/guttume/livekit_agents_adapter
- Examples: see the
examples/directory in the source repo
Metadata
Release files for livekit-agents-adapter 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| livekit_agents_adapter-0.1.1.tar.gz | 9.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| livekit_agents_adapter-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 21.6 kB
Release files / livekit_agents_adapter-0.1.1.tar.gz
| Download URL | livekit_agents_adapter-0.1.1.tar.gz |
|---|---|
| Size | 9.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0801528b22bc4ce113a59d82f9b9065d6a8b37a2601ee71c715a1eaeefc508ca
|
|
BLAKE2b-256 checksum How to use checksums |
226d4683882051561b07881825e4e8df7a68d636aa4cfcf8a02fa350e5b0137d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.5.29
|
Release files / livekit_agents_adapter-0.1.1-py3-none-any.whl
| Download URL | livekit_agents_adapter-0.1.1-py3-none-any.whl |
|---|---|
| Size | 12.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fa535276c0588d9be47860205efeb675835eecc7268a54d8a7539d89666a5ec3
|
|
BLAKE2b-256 checksum How to use checksums |
db0c7a5765c0dfdb171625c1f0e1148aa35796c4bc4919e62e363e8e969d4c2e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.5.29
|