better-gigabyte-88039
09/01/2025, 2:55 PMtall-airline-16756
09/01/2025, 2:55 PMtall-airline-16756
09/01/2025, 2:56 PMsession.say("Just one second") right within your tool.
• Frontend Plays: Here, you use Remote Procedure Calls (RPC) to tell the frontend to play a specific audio file or a synthesized voice message. Just a heads up, this means you'll need some custom logic on the frontend to handle the RPC and play the audio.
If you want, I’m happy to walk you through the details of either option—just let me know!
Sources: Tool definition and use | LiveKit Docs | agents/src/voice/agent_activity.ts | livekit-plugins/livekit-plugins-aws/livekit/plugins/aws/experimental/realti... | avatars/hedra/education_avatar/agent.py | Remote method calls (RPC) | LiveKit Docsbetter-gigabyte-88039
09/01/2025, 2:58 PMtall-airline-16756
09/01/2025, 2:59 PMLLMStream object doesn’t give you direct access to the session in LiveKit. It’s mainly there to handle streaming responses from the LLM and keep things running smoothly with the LLM provider.
If you want to work with the LiveKit session itself, the best way is to use the RunContext parameter in your tool functions. That’s the one that gives you clear access to the current session, so you can manage state or interact with rooms easily.
Feel free to reach out if you want me to explain anything more or help out with anything else!
Sources: livekit-plugins/livekit-plugins-aws/livekit/plugins/aws/experimental/realti... | plugins/google/src/llm.ts | Tool definition and use | LiveKit Docsbetter-gigabyte-88039
09/01/2025, 3:02 PMtall-airline-16756
09/01/2025, 3:03 PMAgentSession class and pointing it to the right plugin or OpenAI-compatible endpoint. Here are some handy examples to get you started:
• Ollama: Just use the OpenAI plugin with a custom base URL for your local Ollama server:
from livekit.agents import AgentSession
from livekit.plugins import openai
session = AgentSession(
llm=openai.LLM.with_ollama(
model="llama3.1",
base_url="http://localhost:11434/v1",
),
)
• DeepSeek: Here’s how to use the OpenAI plugin with DeepSeek:
from livekit.plugins import openai
llm = openai.LLM.with_deepseek(
model="deepseek-chat",
temperature=0.7
)
session = AgentSession(llm=llm)
• Baseten: You can also directly work with Baseten models like this:
from livekit.plugins import baseten
session = AgentSession(
llm=baseten.LLM(model="meta-llama/Llama-4-Maverick-17B-128E-Instruct"),
)
• AWS Bedrock: And if you want to use Amazon Bedrock for LLMs, here’s how:
from livekit.plugins import aws
session = AgentSession(
llm=aws.LLM(model="anthropic.claude-3-5-sonnet-20240620-v1:0"),
)
To keep track of your session and shared state, just use the RunContext parameter inside your tool functions. This makes managing state and interacting with the room super smooth. If you want me to walk you through any specific setup or have questions, just let me know—I’m here to help!
Sources: Baseten LLM integration guide | LiveKit Docs | Amazon Bedrock LLM integration guide | LiveKit Docs | rpc/rpc_agent.py | Large language model (LLM) integrations | LiveKit Docs | Ollama integration guide | LiveKit Docsbetter-gigabyte-88039
09/01/2025, 3:43 PMtall-airline-16756
09/01/2025, 3:44 PM*args and **kwargs) behind the scenes to make things run smoothly. But this is more of a behind-the-scenes detail and not really meant for user-defined tools to handle truly dynamic or varying numbers of arguments like you might expect in regular Python.
When you define your tools, the @function_tool decorator creates a formal JSON schema based on your function's type hints and docstring. This helps ensure the LLM sends arguments that fit the structure you’ve set, and the framework takes care of mapping those to your tool’s parameters using *args and **kwargs under the hood.
If you want, I’m here to help clarify anything or assist you with setting up your tool’s parameters—just let me know!
Sources: livekit-agents/livekit/agents/voice/agent_activity.pybetter-gigabyte-88039
09/01/2025, 3:45 PMtall-airline-16756
09/01/2025, 3:45 PM*args or **kwargs, but don’t worry—you can still get that same kind of flexibility using raw function tools with the raw_arguments parameter.
Here’s a simple way to do it:
1. Define a raw schema: Set up a JSON schema that lets you handle dynamic inputs, for example by using additionalProperties to allow open-ended dictionaries.
2. Use `raw_arguments`: Create your function tool to accept raw_arguments: dict[str, object], which will include all the arguments the LLM passes in.
Check out this example:
from livekit.agents import function_tool\n\n@function_tool(raw_schema={\n \"type\": \"function\",\n \"parameters\": {\n \"type\": \"object\",\n \"additionalProperties\": { \"type\": \"object\" }\n }\n})\nasync def dynamic_tool(raw_arguments: dict[str, object]):\n # Process dynamic arguments\n return raw_arguments
This way, you can handle a flexible set of arguments on the fly. If you want me to walk you through it more or share some extra examples, just let me know—I’m here to help!
Sources: livekit-plugins/livekit-plugins-aws/livekit/plugins/aws/llm.py | Tool definition and use | LiveKit Docs