Python: consume Anthropic beta flags - #5772
Conversation
There was a problem hiding this comment.
Pull request overview
Fixes an Anthropic client integration issue where per-run additional_beta_flags were being forwarded as a raw request kwarg (causing Anthropic SDK TypeErrors) instead of being consumed into the betas set used for the request.
Changes:
- Remove
additional_beta_flagsfrom the finalrun_optionsafter it has been merged intobetas. - Add a regression test ensuring
additional_beta_flagsis consumed intobetasand not forwarded.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| python/packages/anthropic/agent_framework_anthropic/_chat_client.py | Pops additional_beta_flags from run_options after preparing betas to prevent forwarding unsupported kwargs. |
| python/packages/anthropic/tests/test_anthropic_client.py | Adds a regression test to verify additional_beta_flags is consumed into betas and removed from run_options. |
Python Test Coverage Report •
Python Unit Test Overview
|
||||||||||||||||||||||||||||||
7f38137 to
8ce9ff6
Compare
|
Yufeng He (@he-yufeng) please check the failing tests. |
|
Please re-open the PR when CI/CD checks (unit tests) are green. |
Pull request was closed
|
I rebased this branch onto current Validation on the new head: I tried to reopen the PR, but GitHub rejected the reopen request from my side. Could you reopen it so the fresh checks can run? |
Summary
additional_beta_flagsinto the Anthropic beta set without forwarding it as a raw request kwarg_prepare_options(...)Fixes #5764.
To verify
uv run pytest tests/test_anthropic_client.py -quv run ruff check agent_framework_anthropic tests/test_anthropic_client.pyuv run ruff format --check agent_framework_anthropic tests/test_anthropic_client.pyuv run pyrightuv run mypy --config-file pyproject.toml agent_framework_anthropicpython -m py_compile agent_framework_anthropic\_chat_client.py tests\test_anthropic_client.py