Open
Description
Describe the bug
When running the agents SDK with tool calling and a thinking model through LITELLM (e.g. sonnet 4) getting this error
litellm.exceptions.BadRequestError: litellm.BadRequestError: AnthropicException - {"type":"error","error":{"type":"invalid_request_error","message":"messages.1.content.0.type: Expected `thinking` or `redacted_thinking`, but found `text`. When `thinking` is enabled, a final `assistant` message must start with a thinking block (preceeding the lastmost set of `tool_use` and `tool_result` blocks). We recommend you include thinking blocks from previous turns. To avoid this requirement, disable `thinking`. Please consult our documentation at https://docs.anthropic.com/en/docs/build-with-claude/extended-thinking"}}
Debug information
- Agents SDK version: 0.0.16
- Python version 3.13
Repro steps
- Run the agents sdk with sonnet 4
- Produce a scenario that requires 2 tool calls or more
- Get the failure above
Expected behavior
Everything works :)