Skip to content

Conversation

@moonbox3
Copy link
Contributor

Motivation and Context

When using the Anthropic client with AG-UI integration, requests fail with:

TypeError: AsyncMessages.create() got an unexpected keyword argument 'store'

The AG-UI orchestrator passes store=True when metadata is present, but Anthropic's API doesn't support this parameter.

The fix is to filter out unsupported options (store, logit_bias, seed, frequency_penalty, presence_penalty, conversation_id) in _prepare_options before passing to the Anthropic API.

These options were already documented as unsupported in AnthropicChatOptions via None type annotations, but weren't being filtered at runtime.

Description

Contribution Checklist

  • The code builds clean without any errors or warnings
  • The PR follows the Contribution Guidelines
  • All unit tests pass, and I have added new tests where possible
  • Is this a breaking change? If yes, add "[BREAKING]" prefix to the title of the PR.

@moonbox3 moonbox3 self-assigned this Jan 20, 2026
@moonbox3 moonbox3 added agents Issues related to single agents ag-ui labels Jan 20, 2026
Copilot AI review requested due to automatic review settings January 20, 2026 02:58
@moonbox3 moonbox3 moved this to In Review in Agent Framework Jan 20, 2026
@markwallace-microsoft
Copy link
Member

markwallace-microsoft commented Jan 20, 2026

Python Test Coverage

Python Test Coverage Report •
FileStmtsMissCoverMissing
packages/ag-ui/agent_framework_ag_ui
   _orchestrators.py4214689%113, 122, 229, 497, 557–559, 566–567, 575, 577–579, 583, 592, 625, 627–629, 631–634, 636, 638–639, 641, 643–648, 756–758, 762–767, 818–820, 823
packages/anthropic/agent_framework_anthropic
   _chat_client.py34313760%51, 360, 383, 385, 398, 420–423, 473–474, 483, 485–486, 491, 508–509, 551, 566, 570–571, 587, 596, 598, 602–603, 644–646, 648, 661–662, 669–671, 675–677, 681–684, 695, 697, 719, 729, 751–757, 764–765, 773–774, 782–785, 792–793, 799–800, 806–807, 813, 821–823, 827, 834–835, 841–842, 848–849, 855, 863–866, 873–874, 893, 900–901, 920, 942, 944, 953–954, 960, 982–983, 989–990, 999–1009, 1016–1022, 1029–1035, 1042–1051, 1058–1061
packages/core/agent_framework
   _mcp.py3885785%112, 174, 183, 246, 254, 275, 365, 432, 467, 469, 473–474, 476–477, 480–481, 484–485, 531, 546, 564, 605, 711, 724–729, 751, 770, 773–775, 790–791, 797–799, 818, 827, 830–832, 847–848, 852–856, 873–877, 1017
   _tools.py7587490%226, 272, 323, 325, 353, 523, 555–556, 658, 660, 680, 698, 712, 724, 729, 731, 738, 771, 827–829, 870, 895–904, 910–919, 955, 965, 1206, 1543, 1630–1634, 1759, 1761, 1827, 1919, 1925, 1967–1968, 1981–1982, 2025, 2109, 2147–2148, 2176–2178, 2216–2217, 2227, 2284–2285, 2292–2293
TOTAL17452270084% 

Python Unit Test Overview

Tests Skipped Failures Errors Time
3187 213 💤 0 ❌ 0 🔥 1m 8s ⏱️

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a bug where the Anthropic client fails with TypeError: AsyncMessages.create() got an unexpected keyword argument 'store' when AG-UI integration passes unsupported options. The fix filters out six options (store, logit_bias, seed, frequency_penalty, presence_penalty, conversation_id) that are not supported by Anthropic's API but may be passed by OpenAI-compatible orchestrators.

Changes:

  • Added UNSUPPORTED_OPTIONS constant to define options not supported by Anthropic API
  • Updated _prepare_options method to filter out unsupported options before making API calls
  • Added conversation_id to AnthropicChatOptions TypedDict's unsupported options list
  • Added comprehensive test to verify unsupported options are filtered while supported options remain

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 Added UNSUPPORTED_OPTIONS constant and filtering logic in _prepare_options; added conversation_id to unsupported options in TypedDict
python/packages/anthropic/tests/test_anthropic_client.py Added comprehensive test verifying all six unsupported options are filtered out

@moonbox3 moonbox3 changed the title Python: fix(anthropic): fix Anthropic client failing with unsupported options like 'store' Python: fix(ag-ui): fix Anthropic client with ag-ui and mcp arg issue Jan 20, 2026
@moonbox3 moonbox3 changed the title Python: fix(ag-ui): fix Anthropic client with ag-ui and mcp arg issue Python: fix(ag-ui, core): fix Anthropic client with ag-ui and mcp arg issue Jan 20, 2026
@moonbox3
Copy link
Contributor Author

I am working on a refactor of some AG-UI code... incoming soon.

@moonbox3
Copy link
Contributor Author

Closing. Superseded by #3322.

@moonbox3 moonbox3 closed this Jan 21, 2026
@github-project-automation github-project-automation bot moved this from In Review to Done in Agent Framework Jan 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ag-ui agents Issues related to single agents python

Projects

Status: Done

4 participants