abundant-hair-93057
08/30/2025, 12:10 AMtall-airline-16756
08/30/2025, 12:10 AMtall-airline-16756
08/30/2025, 12:11 AMparallel_tool_calls=True parameter when you’re initializing your LLM instance. Here’s a quick example:
from livekit.plugins import openai
session = AgentSession(
llm=openai.LLM.with_x_ai(
model="grok-2-public",
parallel_tool_calls=True # This turns on parallel execution of tool calls
),
# ... other agent components (TTS, STT, etc.)
)
This handy feature works with a bunch of LLM providers that LiveKit supports, like OpenAI, Anthropic, and more. Just a heads-up—make sure your chosen LLM provider and backend actually support parallel tool calling so everything runs smoothly.
Sources: Groq LLM integration guide | LiveKit Docs | livekit-plugins/livekit-plugins-anthropic/livekit/plugins/anthropic/llm.py | xAI LLM integration guide | LiveKit Docs | DeepSeek LLM integration guide | LiveKit Docs | Anthropic Claude LLM integration guide | LiveKit Docsabundant-hair-93057
08/30/2025, 12:11 AMtall-airline-16756
08/30/2025, 12:12 AMparallel_tool_calls parameter in LiveKit. When you set this to True, it lets the LLM make multiple tool calls at the same time instead of one after the other. It uses some cool asynchronous programming tricks like asyncio.gather() to run tasks side-by-side—think of fetching weather info for different cities all at once—which helps speed things up.
The LLM figures out which calls can run together by checking if the tasks are independent. So, if one task doesn’t rely on another’s output, they can happen simultaneously. Behind the scenes, the backend passes the parallel_tool_calls flag to the LLM provider’s API, which then takes care of running everything smoothly.
We’ve also built error handling that keeps things tidy—if one tool call hits a snag, the others can still finish okay, and any issues are caught individually. Plus, if a tool call is taking too long, it can be canceled nicely without causing a fuss.
One thing to keep in mind: whether parallel tool calls actually work depends on the LLM provider supporting this feature. LiveKit gives you the option to set it up, but the provider’s API is the one that handles the actual execution.
Sources: xAI LLM integration guide | LiveKit Docs | Fireworks AI LLM integration guide | LiveKit Docs | livekit-plugins/livekit-plugins-mistralai/livekit/plugins/mistralai/llm.py | DeepSeek LLM integration guide | LiveKit Docs | Together AI LLM integration guide | LiveKit Docs