feat: add Amazon Bedrock as inference provider#8832
Conversation
Add Amazon Bedrock as a first-class inference provider using the Converse API via boto3. Supports three authentication methods: Bedrock API keys (Bearer tokens), AWS profiles (~/.aws/credentials), and AWS access key pairs. - agent/bedrock_adapter.py — Converse API adapter (message conversion, tool schema translation, response normalization) - hermes_cli/auth.py — ProviderConfig, _resolve_bedrock_base_url(), region-aware endpoint construction, provider aliases - hermes_cli/providers.py — HermesOverlay with bedrock_converse transport, aliases, labels - hermes_cli/models.py — Curated model list with global/eu/us inference profile IDs and bare model IDs - hermes_cli/config.py — AWS_BEARER_TOKEN_BEDROCK and AWS_BEDROCK_REGION env vars - hermes_cli/runtime_provider.py — bedrock_converse in valid API modes - agent/models_dev.py — PROVIDER_TO_MODELS_DEV mapping - New api_mode 'bedrock_converse' with full lifecycle support: init, switch_model, _build_api_kwargs, _interruptible_api_call, response validation, finish_reason extraction, response normalization - Safe vars() call in error logging (handles dict responses from boto3) - Dedicated _model_flow_bedrock() with interactive setup: - Auth picker: existing API key, new API key, AWS profile, access keys - Region selector with common regions + custom input - Model selection from curated list - Persists api_mode=bedrock_converse in config.yaml - Added boto3 to pyproject.toml Bedrock models use cross-region inference profile prefixes: - global. — works from any region - eu. — EU cross-region routing - us. — US cross-region routing - bare — single-region direct access
|
Thanks for working on Bedrock support — this is a much-needed feature. I've been working on an alternative implementation and wanted to share some observations that might be useful. Core concern: Converse API vs Anthropic SDKThis PR uses the boto3 Converse API (
For an agent framework where Claude is the primary model, losing streaming alone is a significant UX regression — users see nothing until the entire response is generated. Alternative approachThe Anthropic Python SDK already ships with For bearer token auth (Bedrock API keys), This reduces the implementation from ~1,078 lines / 13 files to ~190 lines / 8 files (no new adapter file needed), with no new Specific items
SuggestionConsider switching the underlying transport from Happy to discuss further or share code from the alternative implementation. |
|
Closing as superseded by #13814. Triage notes (high confidence): Thanks for the contribution — the underlying problem this PR addresses has been resolved by the linked PR on current main. If you believe this was closed in error, please comment and we'll reopen. (Bulk-closed during a CLI PR triage sweep.) |
Add Amazon Bedrock as a first-class inference provider using the Converse API via boto3. Supports three authentication methods: Bedrock API keys (Bearer tokens), AWS profiles (~/.aws/credentials), and AWS access key pairs.
agent/bedrock_adapter.py — Converse API adapter (message conversion, tool schema translation, response normalization)
hermes_cli/auth.py — ProviderConfig, _resolve_bedrock_base_url(), region-aware endpoint construction, provider aliases
hermes_cli/providers.py — HermesOverlay with bedrock_converse transport, aliases, labels
hermes_cli/models.py — Curated model list with global/eu/us inference profile IDs and bare model IDs
hermes_cli/config.py — AWS_BEARER_TOKEN_BEDROCK and AWS_BEDROCK_REGION env vars
hermes_cli/runtime_provider.py — bedrock_converse in valid API modes
agent/models_dev.py — PROVIDER_TO_MODELS_DEV mapping
New api_mode 'bedrock_converse' with full lifecycle support: init, switch_model, _build_api_kwargs, _interruptible_api_call, response validation, finish_reason extraction, response normalization
Safe vars() call in error logging (handles dict responses from boto3)
Dedicated _model_flow_bedrock() with interactive setup:
Persists api_mode=bedrock_converse in config.yaml
Added boto3 to pyproject.toml
Bedrock models use cross-region inference profile prefixes:
What does this PR do?
Related Issue
Fixes #
Adds Amazon Bedrock support as an inference provider using boto3 client.
Type of Change
Feature enhancement adding additional provider.
Changes Made
agent/bedrock_adapter.py — Converse API adapter (message conversion, tool schema translation, response normalization)
hermes_cli/auth.py — ProviderConfig, _resolve_bedrock_base_url(), region-aware endpoint construction, provider aliases
hermes_cli/providers.py — HermesOverlay with bedrock_converse transport, aliases, labels
hermes_cli/models.py — Curated model list with global/eu/us inference profile IDs and bare model IDs
hermes_cli/config.py — AWS_BEARER_TOKEN_BEDROCK and AWS_BEDROCK_REGION env vars
hermes_cli/runtime_provider.py — bedrock_converse in valid API modes
agent/models_dev.py — PROVIDER_TO_MODELS_DEV mapping
How to Test
Current: global.anthropic.claude-opus-4-6-v1 on Amazon Bedrock
Amazon Bedrock [--provider bedrock] (current):
global.anthropic.claude-opus-4-6-v1, global.anthropic.claude-sonnet-4-6, global.anthropic.claude-haiku-4-5-20251001-v1:0, anthropic.claude-opus-4-6-v1, anthropic.claude-sonnet-4-6, anthropic.claude-haiku-4-5-20251001-v1:0 (+4 more)
Checklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings) — or N/Acli-config.yaml.exampleif I added/changed config keys — or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — or N/AFor New Skills
hermes --toolsets skills -q "Use the X skill to do Y"Screenshots / Logs