Repository navigation
Agno: send Claude a temperature without a top_p - #1776
Merged
Merged
Conversation
Agno sends temperature 0.7 and top_p 1.0 on every request, and Claude Haiku 4.5, Opus 4.5, Opus 4.6, Sonnet 4.5 and Sonnet 4.6 refuse a request that names both. On Anthropic the Agno Bot now leaves top_p out: 1.0 keeps every token, which is what the API does without one, so the temperature it has always run at is unchanged. Other providers are sent what they were before. The test's Anthropic stand-in now refuses both, as the real API does for these models.
davidmckayv
requested review from
MikeRyanDev,
dustywusty,
guidovizoso,
mxmzb,
samjulien and
tylerslaton
as code owners
November 17, 2026 21:17
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
The Agno Bot failed every run on five Claude models the picker lists: Claude Haiku 4.5, Opus 4.5, Opus 4.6, Sonnet 4.5 and Sonnet 4.6. Anthropic answered
400: temperature and top_p cannot both be specified for this model, which the model compatibility check (#1775) found.Agno's
LiteLLMmodel sendstemperature=0.7andtop_p=1.0on every request. These Claude models take one of the two, never both. LiteLLM passes both through, because its model map only says whether a model takes sampling parameters at all (supports_sampling_params), not that it takes just one, sodrop_paramsdoesn't help here.On Anthropic, the Agno Bot now leaves
top_pout and keeps the temperature. Atop_pof 1.0 keeps every token, which is what Anthropic's API does when none is sent, so the Bot samples exactly as it did before. Claude models that take no sampling parameters at all (Opus 4.7 and later) still lose the temperature throughdrop_params, as before. OpenAI and OpenAI-compatible endpoints are sent what they were sent before. The AG-UI side is unchanged.The rule follows the provider's API, not a list of model names, so a new Claude model needs no change here.
Upgrading doesn't fix it: Agno 3.2.1, the latest release and what the image already installs, still defaults to
temperature=0.7andtop_p=1.0and sends both. Agno's own LiteLLM example setstop_p=Nonefor Claude for this reason.Sources
temperatureortop_p, not both. https://docs.claude.com/en/docs/about-claude/models/migrating-to-claude-4LiteLLMdefaults (temperature: float = 0.7,top_p: float = 1.0), on main: https://github.com/agno-agi/agno/blob/main/libs/agno/agno/models/litellm/chat.pyTests
The test's Anthropic stand-in now refuses a request that names both, word for word as Anthropic does for these models. A new test runs an AG-UI run on each of the five models and checks the request carries the temperature and no
top_p.python -m pytest agent-agno/tests -q:claude-sonnet-4-5).The probe, against the real API
scripts/model-compat.tsfrom #1775, run as--harness agent-agno --provider anthropicon a throwaway Linux box with the dev Anthropic key, one AG-UI run per model the picker lists, each carrying one tool. Before is the published image (latest) and the image built frommainat c6c94e1. After is the image built from this branch at 28ea243.latestmainEvery failure was Anthropic's
400 invalid_request_error: "temperatureandtop_pcannot both be specified for this model." Every pass replied OK.