AgentPool API
Imports
python
from openrtc import AgentConfig, AgentPoolAgentConfig
python
@dataclass(slots=True)
class AgentConfig:
name: str
agent_cls: type[Agent]
stt: Any = None
llm: Any = None
tts: Any = None
greeting: str | None = NoneAgentConfig is returned from AgentPool.add() and represents a registered LiveKit agent configuration.
AgentPool()
Create a pool that manages multiple LiveKit agents in one worker process.
python
pool = AgentPool()add()
python
pool.add(
name,
agent_cls,
*,
stt=None,
llm=None,
tts=None,
greeting=None,
)Registers a named LiveKit Agent subclass.
Validation rules
namemust be a non-empty string after trimming whitespace- names must be unique
agent_clsmust be a subclass oflivekit.agents.Agent
Returns
An AgentConfig instance for the registration.
Raises
ValueErrorfor an empty or duplicate nameTypeErrorifagent_clsis not a LiveKitAgentsubclass
list_agents()
python
pool.list_agents()Returns registered agent names in registration order.
run()
python
pool.run()Starts the LiveKit worker application.
Raises
RuntimeError if called before any agents are registered.
Example
python
from examples.agents.restaurant import RestaurantAgent
from openrtc import AgentPool
pool = AgentPool()
pool.add(
"restaurant",
RestaurantAgent,
stt="deepgram/nova-3:multi",
llm="openai/gpt-5-mini",
tts="cartesia/sonic-3",
)
pool.run()