-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Python: fix(ag-ui, core): fix Anthropic client with ag-ui and mcp arg issue #3294
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this 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_OPTIONSconstant to define options not supported by Anthropic API - Updated
_prepare_optionsmethod to filter out unsupported options before making API calls - Added
conversation_idtoAnthropicChatOptionsTypedDict'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 |
python/packages/anthropic/agent_framework_anthropic/_chat_client.py
Outdated
Show resolved
Hide resolved
|
I am working on a refactor of some AG-UI code... incoming soon. |
|
Closing. Superseded by #3322. |
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=Truewhen 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_optionsbefore passing to the Anthropic API.These options were already documented as unsupported in
AnthropicChatOptionsviaNonetype annotations, but weren't being filtered at runtime.Description
Contribution Checklist