Repository navigation
feat(anthropic): add typed speed option to AnthropicConfig - #3495
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests.
... and 13 files with indirect coverage changes 🚀 New features to boost your workflow:
|
vvlrff
approved these changes
Oct 25, 2026
vvlrff
approved these changes
Oct 25, 2026
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.
Why are these changes needed?
Right now the only way to use Anthropic's fast mode in AG2 is to put
speedinsideextra_body, which isn't typed or validated. This PR adds a properspeedoption ("standard"or"fast") toAnthropicConfig, its copy overrides andCreateOptions. When it's set, the value is sent with both streaming and non-streaming requests. When it's left unset, nothing changes andspeedisn't added to the request.Some models need the
fast-mode-2026-02-01beta header. I didn't add that header automatically, so the caller stays in control of it. The docs now show how to pass it throughdefault_headers, and there are tests checking it works alongside AG2's existing MCP beta header.Other notes:
speedargument.uv.lockis updated to match.Usageunchanged. It only adds up token counts, so a per-request speed label doesn't really fit there.Tested on Python 3.12 with Anthropic SDK 1.15.0:
just test: 4,382 passed, 103 skipped, 329 deselected, 2 xfailed. This is the non-LLM run, not the full CI matrix.speed.Related issue number
Closes #3489
Checks
AI assistance
I used AI assistance for parts of the implementation, the tests and this description.