from livekit.agents import Agent, function_tool
from livekit.plugins import openai
from openrtc import AgentPool
class RestaurantAgent(Agent):
def __init__(self) -> None:
super().__init__(
instructions=(
"You are a helpful restaurant reservation assistant. "
"Use the tools to check availability, make reservations, and describe the menu."
)
)
@function_tool
async def check_availability(self, date: str, party_size: int) -> str:
"""Check table availability for a given date and party size."""
return f"Tables are available for {party_size} on {date}."
@function_tool
async def make_reservation(self, name: str, date: str, party_size: int) -> str:
"""Make a reservation."""
return f"Reservation confirmed for {name}, party of {party_size} on {date}."
class DentalAgent(Agent):
def __init__(self) -> None:
super().__init__(
instructions=(
"You are a helpful dental office assistant. "
"Use the tools to schedule appointments and share pre-visit information."
)
)
@function_tool
async def schedule_cleaning(self, name: str, date: str) -> str:
"""Schedule a dental cleaning appointment."""
return f"Cleaning appointment confirmed for {name} on {date}."
@function_tool
async def pre_visit_instructions(self) -> str:
"""Provide pre-visit instructions."""
return "Brush and floss before your appointment. Arrive 10 minutes early."
pool = AgentPool(
default_stt=openai.STT(model="gpt-4o-mini-transcribe"),
default_llm=openai.responses.LLM(model="gpt-4.1-mini"),
default_tts=openai.TTS(model="gpt-4o-mini-tts"),
)
pool.add("restaurant", RestaurantAgent, greeting="Welcome to our restaurant. How can I help?")
pool.add("dental", DentalAgent)
pool.run()