Skip to content

Incorrect Schema being provided to Anthropic models with LiteLLM extension #1644

@aditya-silna

Description

@aditya-silna

Please read this first

  • Have you read the docs?Agents SDK docs yes
  • Have you searched for related issues? Others may have faced similar issues. yes

Describe the bug

A clear and concise description of what the bug is.
What happened?
OpenAI Agents with LiteLLM does not properly provide the schema to Claude 4.1 Opus when attempting a tool call. This does not occur on LiteLLM version 1.74.2 and only in 1.75.0.

Debug information

  • Agents SDK version: (e.g. v0.0.3)0.2.4
  • Python version (e.g. Python 3.10) 3.11

Repro steps

Ideally provide a minimal python script that can be run to reproduce the bug.
What happened?

Construct a required schema like the following as the required arg for a @function_tool

class ActionType(StrEnum):
    FILL = "fill"
    PRESS = "press"
    CLICK = "click"
    SCROLL = "scroll"

class Instruction(BaseModel):
    action: ActionType
    instruction: str

Relevant log output

Model providing:

{
  "instruction": "Click the \"Portal Login\" button in the top right corner of the page"
}

omitting the ActionType entirely.

Expected behavior

A clear and concise description of what you expected to happen.
The expected behavior is it should be providing the ActionType as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions