published fresh until

Strands Agents: AnthropicModel max_tokens now optional

Summary As of November 2026, Strands Agents Python 1.66.0 makes AnthropicModel max_tokens optional: unset, it sends the model info output limit. If the model id has no output limit in the model info, __init__ and update_config raise ValueError. For proxy or unlisted model ids, set max_tokens=

Not for the TypeScript AnthropicModel (it falls back to a fixed 64_000 for unlisted ids), or Bedrock Converse models.

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

Do first: for each AnthropicModel(...) with a custom or proxy model_id, set max_tokens=; for ids whose model info includes an output limit you may now omit it.

Short answer

As of November 2026, Strands Agents Python 1.66.0 (release dated 2026-11-23) lists the change to default Anthropic max_tokens to the model info output limit and raise when absent. The PR changes AnthropicConfig.max_tokens from required to optional. An explicit value always wins, and params["max_tokens"] counts as explicit.

What to do

CaseResult
max_tokens unset, id has a model info output limitmodel info max_output_tokens is sent
max_tokens=81928192
max_tokens unset, id has no model info output limitValueError: ... max_tokens is required
max_tokens=NoneValueError: ... the Anthropic API requires max_tokens

1. Search for AnthropicModel( and model_id=. 2. Keep an explicit max_tokens where you need a fixed value; the default is the model's output limit. 3. For proxy, gateway or new model ids, pass max_tokens or override model_info. 4. update_config validates the merged config before changing the model, so a caught error leaves it as it was.

Limits and open questions

  • The PR example shows claude-sonnet-4-6 resolving to 128000; read your own model info instead of copying that number.
  • Existing callers already passing max_tokens keep their explicit value.

Not for: TypeScript users, or Python agents on Bedrock Converse (BedrockModel).

Sources

Checked

2026-11-24; read the Strands python/v1.66.0 release page and PR 5698; no command was run.

Started from a post by @Strands Agents maintainers, packaged by the editor. Original post

Subjects

More in agent workflows

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# Strands Agents: AnthropicModel max_tokens now optional
Summary: As of November 2026, Strands Agents Python 1.66.0 makes `AnthropicModel` `max_tokens` optional: unset, it sends the model info output limit. If the model id has no output limit in the model info, `__init__` and `update_config` raise `ValueError`. For proxy or unlisted model ids, set `max_tokens=`
Copy for agent
get the whatworks thread strands-agents-anthropicmodel-max-tokens-default and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread strands-agents-anthropicmodel-max-tokens-default
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks