calm-apple-14806
09/12/2025, 7:56 PMtall-airline-16756
09/12/2025, 7:56 PMtall-airline-16756
09/12/2025, 7:57 PMRealtimeModel
plugins for providers like OpenAI, AWS Bedrock, Google Gemini, and Ultravox. This wonderful feature lets voice agents perform helpful actions such as retrieving data or booking appointments seamlessly during live audio conversations.
To get started with configuring tools, you can define functions using the @function_tool
decorator and then pass them to the Agent
instance. Here’s a simple example to guide you:
from livekit.agents import function_tool, Agent, AgentSession
from livekit.plugins.ultravox.realtime import RealtimeModel
@function_tool
async def get_weather(location: str) -> str:
return f"The weather in {location} is sunny and 72°F"
session: AgentSession = AgentSession(
allow_interruptions=True,
llm=RealtimeModel(model_id="fixie-ai/ultravox"),
)
await session.start(
agent=Agent(
instructions="You are a helpful assistant with access to weather tools.",
tools=[get_weather],
),
)
Also, if you ever need to update tools dynamically during a session, you can easily do so using the update_tools()
method. If you’d like, I’m here to help with any further details or walk you through the implementation—just let me know!
Sources: Realtime model integrations | LiveKit Docs | livekit-agents/livekit/agents/voice/agent.py | plugins/google/src/beta/realtime/realtime_api.ts