can we force that an agent can call one and only o...
# ask-ai
s
can we force that an agent can call one and only one tool at a time?
t
Thanks for reaching out, Marc. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Thanks — I’m responding to your question about forcing an agent to call one and only one tool at a time. Yes — you can enforce sequential (one-at-a-time) tool calls by disabling parallel tool calls. Set the LLM configuration parameter
parallel_tool_calls
to
False
. When
parallel_tool_calls
is disabled, the agent makes tool calls sequentially rather than concurrently. Example (Python):
Copy code
session = AgentSession(
    llm=anthropic.LLM(
        model="claude-3-5-sonnet-20241022",
        parallel_tool_calls=False,  # Ensures one tool call at a time
    ),
    # ... other options
)
By default,
parallel_tool_calls
is not enabled, so unless you explicitly set it to
True
, agents will typically call tools one at a time. If you’d like, tell me which LLM provider or SDK you’re using and I can give a tailored code snippet or confirm the exact setting name for that provider. Sources: Anthropic Claude LLM plugin guide | LiveKit Documentation | Fireworks AI LLM plugin guide | LiveKit Documentation | DeepSeek LLM | LiveKit Documentation | Telnyx LLM plugin guide | LiveKit Documentation | Cerebras LLM plugin guide | LiveKit Documentation