add Qwen model support and Bedrock API Keys authentication#307
Open
pamaldi wants to merge 1 commit intoopenagents-org:developfrom
Open
add Qwen model support and Bedrock API Keys authentication#307pamaldi wants to merge 1 commit intoopenagents-org:developfrom
pamaldi wants to merge 1 commit intoopenagents-org:developfrom
Conversation
- Enable Qwen models on Bedrock (add routing in chat_completion) - Add AWS_BEARER_TOKEN_BEDROCK env var for bearer token authentication - Implement Converse API for bearer token auth (works with Claude and Qwen) - Handle tool calls and tool results in Converse API format - Fall back to boto3/aioboto3 when bearer token is not set
|
Someone is attempting to deploy a commit to the Raphael's projects Team on Vercel. A member of the Team first needs to authorize it. |
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.
Summary
This PR adds support for AWS Bedrock API Keys (bearer token authentication) as an alternative to traditional IAM credentials (boto3/aioboto3), and enables Qwen model routing which was previously missing from the
BedrockProvider.Problem
Authentication: The
BedrockProvideronly supported IAM credentials viaaioboto3.Session(). AWS recently introduced Bedrock API Keys (prefixed withABSK), which provide a simpler authentication method using bearer tokens. These are especially useful for developers who want to quickly test Bedrock models without configuring full IAM credentials.Qwen models: The
chat_completion()method inBedrockProvideronly routed to_claude_bedrock_completion()for Claude models. Qwen models (e.g.,qwen.qwen3-32b-v1:0) were not routed despite having a_qwen_bedrock_completion()method already implemented, resulting in a"Model not yet supported in Bedrock provider"error.Changes
src/openagents/lms/providers.pyBearer Token Authentication
AWS_BEARER_TOKEN_BEDROCKenvironment variable support inBedrockProvider.__init__()aiohttp) instead ofaioboto3aioboto3flow (no breaking changes)aioboto3import is now conditional — only required when bearer token is not configuredNew method:
_claude_bedrock_bearer()systemparameter (separate from messages)toolrole messages by converting them touserrole withtoolResultcontent blocks (Converse API requirement)assistantmessages withtool_callsby converting totoolUsecontent blocksinputSchemastructure required by Converse APIQwen Model Routing
elif "qwen" in self.model_name.lower()branch inchat_completion()to route Qwen models to_qwen_bedrock_completion()_qwen_bedrock_completion()— when bearer token is available, Qwen models also use the Converse API pathConfiguration
Using Bedrock API Keys (new)
Agent YAML configuration
Using IAM credentials (existing, unchanged)
How to Test
export AWS_BEARER_TOKEN_BEDROCK="your-key"provider: "bedrock"and a supported model (Claude or Qwen)openagents network start network.yamlopenagents agent start agents/charlie.yamlQuick API test (without OpenAgents)
Backward Compatibility
AWS_BEARER_TOKEN_BEDROCKis set.aioboto3dependency is only required when using IAM credentials (not needed for bearer token auth).