Bedrock converse_stream boto3 version compatibility guard
NousResearch/hermes-agent · cluster 46592
Data as of
Nothing open on GitHub. Fix merged in #46633. Check it covers your case.
The short answer
0open issues
0open PRs
4items grouped
- Known?
- Yes. 4 related items grouped here, 2 issues already closed.
- Fix event
- A fix was merged to main in PR #46633. Check it covers your case. No release data is tracked.
- Tracker
- The maintainers' tracker marks this
partially resolved, deciding PR #46633. That is separate from the fix event. - Still open
- Nothing open on GitHub.
These issues and PRs address an AttributeError raised when using converse_stream with a boto3 version older than 1.34.59, and add a version check to guard against it.
Open issues0
Open PRs0
Fixes on record
-
#46633 fix(bedrock): check boto3 version before Converse streaming
files:
agent/bedrock_adapter.py,tests/agent/test_bedrock_adapter.pyShow the diff
-
agent/bedrock_adapter.py@@ -58,17 +58,34 @@ _bedrock_control_client_cache: Dict[str, Any] = {} +_MIN_BOTO3_VERSION = (1, 34, 59) + + def _require_boto3(): - """Import boto3, raising a clear error if not installed.""" + """Import boto3, raising a clear error if not installed or too old.""" try: import boto3 - return boto3 except ImportError: raise ImportError( "The 'boto3' package is required for the AWS Bedrock provider. " "Install it with: pip install boto3\n" "Or install Hermes with Bedrock support: pip install -e '.[bedrock]'" ) + # converse() / converse_stream() were added in boto3 1.34.59. + # When Hermes is installed editable into system Python, the system boto3 + # (e.g. Ubuntu 24.04 ships 1.34.46) may take precedence over the venv + # version pinned in pyproject.toml. + try: + version = tuple(int(x) for x in boto3.__version__.split(".")[:3]) + except (AttributeError, ValueError): + return boto3 # can't parse — don't block on version check + if version < _MIN_BOTO3_VERSION: + raise RuntimeError( + f"boto3 {boto3.__version__} does not support converse_stream " + f"(minimum 1.34.59 required). Upgrade with: " + f"pip install --upgrade boto3" + ) + return boto3 def _get_bedrock_runtime_client(region: str): -
tests/agent/test_bedrock_adapter.py@@ -1663,3 +1663,52 @@ def test_falls_back_to_converse_on_streaming_denial(self): assert result.choices[0].message.content == "hi" # Not a stale connection — client stays cached. assert _bedrock_runtime_client_cache.get("us-east-1") is client + + +# --------------------------------------------------------------------------- +# boto3 version check +# --------------------------------------------------------------------------- + + +class TestRequireBoto3VersionCheck: + """Test that _require_boto3() rejects boto3 versions older than 1.34.59.""" + + def test_raises_runtime_error_when_boto3_too_old(self): + """boto3 < 1.34.59 should raise RuntimeError with upgrade instructions.""" + from agent.bedrock_adapter import _require_boto3 + + fake_boto3 = MagicMock() + fake_boto3.__version__ = "1.34.46" + with patch.dict("sys.modules", {"boto3": fake_boto3}): + with pytest.raises(RuntimeError, match="does not support converse_stream"): + _require_boto3() + + def test_accepts_boto3_at_minimum_version(self): + """boto3 == 1.34.59 should be accepted.""" + from agent.bedrock_adapter import _require_boto3 + + fake_boto3 = MagicMock() + fake_boto3.__version__ = "1.34.59" + with patch.dict("sys.modules", {"boto3": fake_boto3}): + result = _require_boto3() + assert result is fake_boto3 + + def test_accepts_newer_boto3(self): + """boto3 > 1.34.59 should be accepted.""" + from agent.bedrock_adapter import _require_boto3 + + fake_boto3 = MagicMock() + fake_boto3.__version__ = "1.42.89" + with patch.dict("sys.modules", {"boto3": fake_boto3}): + result = _require_boto3() + assert result is fake_boto3 + + def test_accepts_boto3_with_unparseable_version(self): + """If version string can't be parsed, don't block on version check.""" + from agent.bedrock_adapter import _require_boto3 + + fake_boto3 = MagicMock() + fake_boto3.__version__ = "dev" + with patch.dict("sys.modules", {"boto3": fake_boto3}): + result = _require_boto3() + assert result is fake_boto3
-
1 PR closed without merging
From the close comments: merged via another change 1
-
#46608 fix(bedrock): check boto3 version >= 1.34.59 before using converse_stream · merged via another change →
#46633
Closed issues · 2
How this cluster was grouped
-
Link evidence (
partly structural links): some members are connected by structural evidence (shared changed files, or a closing/superseded reference); the rest are joined by an automated relevance judgement over their text. - Members outside that structural core may belong to a different underlying problem.
-
Pairwise link density
0.39: the share of item pairs that carry a link, counting a structural link in full and a relevance-only link at 0.36.1.00means every pair is linked.
Pick up a Lab task
Check whether a fix covers the open issues here, with your own agent. Bring back evidence for maintainers.
Open the LabAt a glance
- Merged PRs
- #46633
- Closed issues
- 2
- Attempts
- 1 PR closed without merging
- Fix link checked
- 15 Jun 2026