Skip to content

fix(anthropic): fall back to auto tool_choice for Opus 5.5, Sonnet 5.5, Fable 5.1 and Mythos 5.1 - #2753

Merged
davidzhao merged 2 commits into
mainfrom
plaguing-sleeks-town
Oct 17, 2026
Merged

davidzhao merged 2 commits into
mainfrom
plaguing-sleeks-town

Conversation

@rosetta-livekit-bot

@rosetta-livekit-bot rosetta-livekit-bot Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Port livekit/agents#7511 to fall back from forced Anthropic tool choices to auto for Claude Opus 5.5, Sonnet 5.5, Fable 5.1, and Mythos 5.1. Preserve disable_parallel_tool_use when configured and warn once per LLM instance.

Source diff coverage

Source diff coverage
  • Adapted: livekit-plugins/livekit-plugins-anthropic/livekit/plugins/anthropic/llm.py -> plugins/anthropic/src/llm.ts. Ported all unsupported-model prefixes, the per-instance warning guard, forced any/named-tool fallback to auto, preservation of disable_parallel_tool_use, and model logging metadata using the target Pino API.
  • Adapted: tests/test_plugin_anthropic_request.py -> plugins/anthropic/src/llm.test.ts. Ported both request-level tests into the existing Vitest counterpart with a mocked Anthropic client. Test fixtures explicitly unset the JS-specific default parallelToolCalls: true where the Python source tests exercise the omitted-option case; the explicit false case remains covered.
  • Not applicable: none. Every source file has a target counterpart and was ported. No supporting infrastructure is missing.

Authoritative source: livekit/agents#7511

Validation

  • pnpm test plugins/anthropic (17 passed)
  • pnpm --filter @livekit/agents-plugin-anthropic build
  • pnpm --filter @livekit/agents-plugin-anthropic lint
  • pnpm exec prettier --check plugins/anthropic/src/llm.ts plugins/anthropic/src/llm.test.ts .changeset/anthropic-auto-tool-choice.md
  • pnpm build (42 workspace tasks passed)
  • pnpm lint (fails on 307 pre-existing findings in unrelated files; the Anthropic package lint passes)

Ported from livekit/agents#7511

Original PR description

Problem

LLM.chat() translates a forced tool_choice the same way for every model: "required" becomes {"type": "any"} and a named function becomes {"type": "tool", "name": ...}. Claude Opus 5.5, Sonnet 5.5, Fable 5.1 and Mythos 5.1 don't support forced tool use (Opus 5.5, Sonnet 5.5, Fable 5.1 and Mythos 5.1 migration guides), so on these models every such request fails with a 400: tool_choice: type "tool" and "any" are not supported for this model. AMD and keyterm detection force "required" on their own, so they fail on these models even when the app never sets a tool choice.

Changes

For these four models a forced choice is now sent as {"type": "auto"}, keeping disable_parallel_tool_use when it's set, and the plugin logs a warning once per LLM instance. Requests for all other models are unchanged. These models have no forced mode, so the model may now answer without calling a tool, or call a different tool than the one named.

@rosetta-livekit-bot
rosetta-livekit-bot Bot requested a review from a team as a code owner October 17, 2026 06:17
@changeset-bot

changeset-bot Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 10d0f8b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 41 packages
Name Type
@livekit/agents-plugin-anthropic Patch
@livekit/agents Patch
@livekit/agents-plugin-anam Patch
@livekit/agents-plugin-assemblyai Patch
@livekit/agents-plugin-azure Patch
@livekit/agents-plugin-baseten Patch
@livekit/agents-plugin-bey Patch
@livekit/agents-plugin-cartesia Patch
@livekit/agents-plugin-cerebras Patch
@livekit/agents-plugin-deepgram Patch
@livekit/agents-plugin-did Patch
@livekit/agents-plugin-elevenlabs Patch
@livekit/agents-plugin-fishaudio Patch
@livekit/agents-plugin-google Patch
@livekit/agents-plugin-hume Patch
@livekit/agents-plugin-inworld Patch
@livekit/agents-plugin-krisp Patch
@livekit/agents-plugin-lemonslice Patch
@livekit/agents-plugin-liveavatar Patch
@livekit/agents-plugin-livekit Patch
@livekit/agents-plugin-meta Patch
@livekit/agents-plugin-minimax Patch
@livekit/agents-plugin-mistral Patch
@livekit/agents-plugin-mistralai Patch
@livekit/agents-plugin-neuphonic Patch
@livekit/agents-plugin-openai Patch
@livekit/agents-plugin-perplexity Patch
@livekit/agents-plugin-phonic Patch
@livekit/agents-plugin-protoface Patch
@livekit/agents-plugin-resemble Patch
@livekit/agents-plugin-rime Patch
@livekit/agents-plugin-runway Patch
@livekit/agents-plugin-sarvam Patch
@livekit/agents-plugin-silero Patch
@livekit/agents-plugin-soniox Patch
@livekit/agents-plugin-speechify Patch
@livekit/agents-plugin-synthesia Patch
@livekit/agents-plugin-tavus Patch
@livekit/agents-plugins-test Patch
@livekit/agents-plugin-trugen Patch
@livekit/agents-plugin-xai Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

devin-ai-integration[bot]

This comment was marked as resolved.

@davidzhao
davidzhao merged commit 8f936ae into main Oct 17, 2026
7 checks passed
@davidzhao
davidzhao deleted the plaguing-sleeks-town branch October 17, 2026 07:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant