Skip to content

LiteLLM sends parallel_tool_calls without tools to Azure OpenAI #4326

Closed

Description

@nnnniiiikkkkqqq

Please read this first

  • Have you read the docs? Yes.
  • Have you searched for related issues? Yes; I did not find a report for this request-shape error.

Describe the bug

LitellmModel forwards parallel_tool_calls=False to litellm.acompletion even when the final request has no tools or handoffs.

Azure OpenAI rejects that request before generation:

BadRequestError: Invalid value for 'parallel_tool_calls':
'parallel_tool_calls' is only allowed when 'tools' are specified.

The adapter already suppresses parallel_tool_calls=True when tools is empty, but the False branch does not apply the same tool-presence check.

This was independently encountered through Strix and is also tracked by usestrix/strix#951.

Debug information

  • Agents SDK version: 0.19.4
  • Related library versions: LiteLLM 1.96.0, OpenAI Python 2.53.0
  • Python version: 3.14
  • Operating system: macOS
  • Model and model provider: Azure OpenAI through LiteLLM
  • Does the issue reproduce with the latest Agents SDK release? Yes
  • Does the issue occur consistently or intermittently? Consistently

Repro steps

Configure an Azure OpenAI LiteLLM route, then make a tool-less model request with parallel tool calls explicitly disabled:

from agents.extensions.models.litellm_model import LitellmModel
from agents.model_settings import ModelSettings
from agents.models.interface import ModelTracing

model = LitellmModel(model="azure/<deployment>")

await model.get_response(
    system_instructions="You are a helpful assistant.",
    input="Reply with OK.",
    model_settings=ModelSettings(parallel_tool_calls=False),
    tools=[],
    output_schema=None,
    handoffs=[],
    tracing=ModelTracing.DISABLED,
)

The adapter calls LiteLLM with both tools=None and parallel_tool_calls=False, and Azure returns HTTP 400.

Expected behavior

When the final converted tool list is empty, the adapter should pass parallel_tool_calls=None so LiteLLM omits the field from the provider request. Explicit True or False values should remain unchanged when tools or handoffs are present.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions