livekit.agents - WARNING - maximum number of funct...
# ask-ai
s
livekit.agents - WARNING - maximum number of function calls steps reached
t
Thanks for reaching out, Youssef. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
The warning
livekit.agents - WARNING - maximum number of function calls steps reached
means your agent has exceeded the allowed number of consecutive tool/function calls in a single turn. By default, this limit (
max_tool_steps
) is set to 3. When the agent tries to execute more than this, further tool calls are halted for that turn as a safety measure. How to resolve: • Increase the limit: If your workflow requires more tool calls, you can raise the
max_tool_steps
parameter when creating your
AgentSession
(e.g.,
max_tool_steps=5
). • Review your tool logic: Check for possible infinite loops or circular dependencies between tools. Consolidate tool calls where possible to avoid unnecessary chaining. • Understand the safety mechanism: This limit prevents runaway execution and resource exhaustion. The agent will continue to function in subsequent turns, but the current turn's tool execution is stopped when the limit is reached. This warning is informational and helps you optimize your agent's tool usage patterns. Sources: livekit-agents/livekit/agents/worker.py