Skip to main content

Examples

The examples/ directory contains a multi-agent setup that runs two specialized agents in a single AgentPool. Both share the same worker process and prewarmed runtime resources (VAD, turn detector).

Multi-agent worker

examples/main.py registers two agents (restaurant and dental) with per-agent instructions and tools:

Routing between agents

With both agents registered, OpenRTC routes each call by room or job metadata. Route by job metadata (pass as JSON string when dispatching):
Route by room name prefix (no metadata needed):
See Routing for the full priority chain.

Running the example

Or run in discovery mode if each agent lives in its own file under examples/agents/:

What the example demonstrates

  • Two livekit.agents.Agent subclasses registered in one AgentPool: no OpenRTC base class required.
  • Shared prewarm: VAD and turn detector load once for both agents.
  • Routing by room prefix (restaurant-*, dental-*) or metadata key ({"agent": "dental"}).
  • Per-agent greeting: only RestaurantAgent sends a greeting on connect.
  • Tool calls: each agent exposes function tools relevant to its domain.