fix(bedrock): install boto3 on first use via lazy_deps#26294
Closed
hawknewton wants to merge 1 commit into
Closed
Conversation
agent/bedrock_adapter.py now calls lazy_deps to install boto3 and botocore on first import, mirroring how other optional provider adapters defer their heavy AWS dependencies until actually used. Keeps the base install slim for users who don't run on Bedrock.
Collaborator
teknium1
added a commit
that referenced
this pull request
May 17, 2026
…tors Adds release-note attribution mappings for the contributors from group 5: - @haran2001 (PR #27070, #27068) - @ms-alan (PR #26443) - @godlin-gh (PR #26118) - @wesleysimplicio (PR #25777, ext-email form) - @Carry00 (PR #26851) - @alaamohanad169-ship-it (PR #26036) - @hawknewton (PR #26294) (YanzhongSu PR #25879 and flamiinngo PR #27231 already mapped.)
Contributor
|
Merged via PR #27382 — your commit was cherry-picked onto current |
gweeteve
pushed a commit
to gweeteve/hermes-agent
that referenced
this pull request
Jun 2, 2026
…tors Adds release-note attribution mappings for the contributors from group 5: - @haran2001 (PR NousResearch#27070, NousResearch#27068) - @ms-alan (PR NousResearch#26443) - @godlin-gh (PR NousResearch#26118) - @wesleysimplicio (PR NousResearch#25777, ext-email form) - @Carry00 (PR NousResearch#26851) - @alaamohanad169-ship-it (PR NousResearch#26036) - @hawknewton (PR NousResearch#26294) (YanzhongSu PR NousResearch#25879 and flamiinngo PR NousResearch#27231 already mapped.)
1 task
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.
What does this PR do?
agent/bedrock_adapter.pyalready defersimport boto3until the provider is actually used, but on a base install (no[all]extras) that deferred import just raisesModuleNotFoundError— there's nothing that actually installs boto3.tools/lazy_deps.pyalready registers aprovider.bedrockentry pointing atboto3==1.42.89. This PR wires the adapter to calllazy_deps.ensure("provider.bedrock")at module load, so the first import of the Bedrock adapter triggers the install.The
ensure()call is wrapped intry / except Exception: passso that:lazy_depsisn't importable (test stubs, etc.) don't breakImportErrorfrom the existing lazy import block, not a confusing lazy_deps stackAfter #24220 / #24515 removed
boto3from the[all]extras, users on a base install hitModuleNotFoundError: No module named 'boto3'the first time the Bedrock provider is touched, even though the lazy_deps registration was already in place to handle exactly this case.Related Issue
No open issue — surfaced as a regression after the boto3-from-extras removal in #24220 / #24515.
Type of Change
Changes Made
agent/bedrock_adapter.py— 13-linetry / exceptblock at the top of the module that callslazy_deps.ensure("provider.bedrock", prompt=False)so boto3 is installed on first import. Pinned version (boto3==1.42.89) comes from the existingtools/lazy_deps.pyregistration — not changed here.How to Test
On a clean venv with
pip install hermes-agent(no extras):main:Checklist
Code
chore(deps):)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings) — N/A (internal bootstrap shim; user-visible behavior is unchanged)cli-config.yaml.exampleif I added/changed config keys — N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — N/Alazy_depsis the existing cross-platform install path; no new platform-specific code