Skip to content

[Bug]: Bedrock first-call fails with manual-install message — _require_boto3 never calls lazy_deps.ensure #24967

@ChyuWei

Description

@ChyuWei

Bug Description

Fresh install via install.sh (uv sync --extra all --locked) leaves boto3 uninstalled, as expected per the 2026-05-12 supply-chain-hardening policy that moved boto3 from the [all] extra into LAZY_DEPS["provider.bedrock"].

On the first Bedrock API call, however, Hermes does NOT trigger the lazy install. It prints the manual-install fallback instead, meaning every fresh install is broken for Bedrock users until they manually pip install boto3 — even with security.allow_lazy_installs left at the default (true).

Steps to Reproduce

  1. On a clean box with no boto3 installed, run install.sh.
  2. Configure the Bedrock provider (hermes setup → pick bedrock).
  3. Start a chat and send any message.
  4. Observe the manual-install ImportError message in the retry loop.

Expected Behavior

Per the policy comment in pyproject.toml above the [all] extra:

"Anything an opt-in backend ... MUST live exclusively in LAZY_DEPS
 and resolve at first use"

the first Bedrock call should route through tools.lazy_deps.ensure("provider.bedrock"), which auto-installs boto3==1.42.89 into the active venv, and the chat should proceed normally.

Actual Behavior

API call failed (attempt 1/3): ImportError
Provider: bedrock Model: arn:aws:bedrock:us-west-2::application-inference-profile/
Endpoint: https://bedrock-runtime.us-east-1.amazonaws.com
Error: The 'boto3' package is required for the AWS Bedrock provider.
Install it with: pip install boto3
Or install Hermes with Bedrock support: pip install -e '.[bedrock]'
Retrying in 2.2s (attempt 1/3)...

Affected Component

CLI (interactive chat), Configuration (config.yaml, .env, hermes setup)

Messaging Platform (if gateway-related)

No response

Debug Report

============================================================
  FULL agent.log
  ============================================================

  [hermes debug share: log content redacted at upload time. run with --no-redact to disable]
  --- hermes dump ---
  version:          0.13.0 (2026.5.7) [942adf61]
  os:               Darwin 25.2.0 arm64
  python:           3.11.15
  openai_sdk:       2.24.0
  profile:          default
  hermes_home:      ~/.hermes
  model:            arn:aws:bedrock:us-west-2:<REDACTED_ACCOUNT>:application-inference-profile/<REDACTED_PROFILE>
  provider:         bedrock
  terminal:         local

  api_keys:
    openrouter           not set
    openai               not set
    anthropic            not set
    anthropic_token      not set
    nous                 not set
    google/gemini        not set
    gemini               not set
    glm/zai              not set
    zai                  not set
    kimi                 not set
    minimax              not set
    deepseek             not set
    dashscope            not set
    huggingface          not set
    nvidia               not set
    ai_gateway           not set
    opencode_zen         not set
    opencode_go          not set
    kilocode             not set
    firecrawl            not set
    tavily               not set
    browserbase          not set
    fal                  not set
    elevenlabs           not set
    github               not set

  features:
    toolsets:           hermes-cli
    mcp_servers:        0
    memory_provider:    built-in
    gateway:            stopped (launchd)
    platforms:          none
    cron_jobs:          0
    skills:             87

  config_overrides:
    display.streaming: True
  --- end dump ---


  --- full agent.log ---
  2026-05-13 16:46:45,564 WARNING agent.bedrock_adapter: Failed to create Bedrock client for model discovery: The 'boto3' package is required for the AWS Bedrock provider. Install it with: pip install boto3
  Or install Hermes with Bedrock support: pip install -e '.[bedrock]'
  2026-05-13 16:47:19,613 INFO hermes_cli.plugins: Plugin 'openai' registered image_gen provider: openai
  2026-05-13 16:47:19,615 INFO hermes_cli.plugins: Plugin 'openai-codex' registered image_gen provider: openai-codex
  2026-05-13 16:47:19,616 INFO hermes_cli.plugins: Plugin 'xai' registered image_gen provider: xai
  2026-05-13 16:47:21,458 INFO hermes_cli.plugins: Plugin discovery complete: 12 found, 8 enabled
  2026-05-13 16:47:23,748 INFO hermes_cli.plugins: Plugin 'openai' registered image_gen provider: openai
  2026-05-13 16:47:23,748 INFO hermes_cli.plugins: Plugin 'openai-codex' registered image_gen provider: openai-codex
  2026-05-13 16:47:23,748 INFO hermes_cli.plugins: Plugin 'xai' registered image_gen provider: xai
  2026-05-13 16:47:23,861 INFO hermes_cli.plugins: Plugin discovery complete: 12 found, 8 enabled
  2026-05-13 16:47:26,170 INFO run_agent: Loaded environment variables from /Users/<USER>/.hermes/.env
  2026-05-13 16:47:26,974 INFO tools.lazy_deps: Lazy-installing edge-tts==7.2.7 for feature 'tts.edge'
  2026-05-13 16:47:29,296 INFO tools.lazy_deps: Lazy install complete for feature 'tts.edge'
  2026-05-13 16:47:29,515 INFO tools.tirith_security: tirith not found — downloading latest release for aarch64-apple-darwin...
  2026-05-13 16:47:41,035 INFO hermes_cli.plugins: Plugin 'openai' registered image_gen provider: openai
  2026-05-13 16:47:41,035 INFO hermes_cli.plugins: Plugin 'openai-codex' registered image_gen provider: openai-codex
  2026-05-13 16:47:41,036 INFO hermes_cli.plugins: Plugin 'xai' registered image_gen provider: xai
  2026-05-13 16:47:41,153 INFO hermes_cli.plugins: Plugin discovery complete: 12 found, 8 enabled
  2026-05-13 16:47:41,906 INFO run_agent: Loaded environment variables from /Users/<USER>/.hermes/.env
  2026-05-13 16:47:42,391 INFO tools.tirith_security: tirith not found — downloading latest release for aarch64-apple-darwin...
  2026-05-13 16:47:44,362 WARNING agent.auxiliary_client: Auxiliary auto-detect: no provider available (tried: openrouter, nous, local/custom, api-key). Compression, summarization, and memory flush will not work. Set OPENROUTER_API_KEY or configure a local model in config.yaml.
  2026-05-13 16:47:44,363 WARNING run_agent: No auxiliary LLM provider for compression — summaries will be unavailable.
  2026-05-13 16:47:44,366 INFO [20260513_164742_218501] run_agent: conversation turn: session=20260513_164742_218501 model=arn:aws:bedrock:us-west-2:<REDACTED_ACCOUNT>:application-inference-profile/<REDACTED_PROFILE> provider=bedrock platform=cli history=0 msg='hi'
  2026-05-13 16:47:44,488 WARNING [20260513_164742_218501] run_agent: API call failed (attempt 1/3) error_type=ImportError thread=Thread-5 (run_agent):6183759872 provider=bedrock base_url=https://bedrock-runtime.us-east-1.amazonaws.com
  model=arn:aws:bedrock:us-west-2:<REDACTED_ACCOUNT>:application-inference-profile/<REDACTED_PROFILE> summary=The 'boto3' package is required for the AWS Bedrock provider. Install it with: pip install boto3
  Or install Hermes with Bedrock support: pip install -e '.[bedrock]'
  2026-05-13 16:47:44,488 WARNING [20260513_164742_218501] run_agent: Retrying API call in 2.444734520593183s (attempt 1/3) thread=Thread-5 (run_agent):6183759872 provider=bedrock base_url=https://bedrock-runtime.us-east-1.amazonaws.com
  model=arn:aws:bedrock:us-west-2:<REDACTED_ACCOUNT>:application-inference-profile/<REDACTED_PROFILE> error=The 'boto3' package is required for the AWS Bedrock provider. Install it with: pip install boto3
  Or install Hermes with Bedrock support: pip install -e '.[bedrock]'
  2026-05-13 16:47:47,121 WARNING [20260513_164742_218501] run_agent: API call failed (attempt 2/3) error_type=ImportError thread=Thread-5 (run_agent):6183759872 provider=bedrock base_url=https://bedrock-runtime.us-east-1.amazonaws.com
  model=arn:aws:bedrock:us-west-2:<REDACTED_ACCOUNT>:application-inference-profile/<REDACTED_PROFILE> summary=The 'boto3' package is required for the AWS Bedrock provider. Install it with: pip install boto3
  Or install Hermes with Bedrock support: pip install -e '.[bedrock]'
  2026-05-13 16:47:47,122 WARNING [20260513_164742_218501] run_agent: Retrying API call in 4.2524777061747905s (attempt 2/3) thread=Thread-5 (run_agent):6183759872 provider=bedrock base_url=https://bedrock-runtime.us-east-1.amazonaws.com
  model=arn:aws:bedrock:us-west-2:<REDACTED_ACCOUNT>:application-inference-profile/<REDACTED_PROFILE> error=The 'boto3' package is required for the AWS Bedrock provider. Install it with: pip install boto3
  Or install Hermes with Bedrock support: pip install -e '.[bedrock]'
  2026-05-13 16:47:49,348 WARNING agent.auxiliary_client: Auxiliary auto-detect: no provider available (tried: openrouter, nous, local/custom, api-key). Compression, summarization, and memory flush will not work. Set OPENROUTER_API_KEY or configure a local model in config.yaml.
  2026-05-13 16:47:49,348 INFO agent.auxiliary_client: Auxiliary title_generation: provider auto unavailable, trying auto-detection chain
  2026-05-13 16:49:20,872 INFO hermes_cli.plugins: Plugin 'openai' registered image_gen provider: openai
  2026-05-13 16:49:20,873 INFO hermes_cli.plugins: Plugin 'openai-codex' registered image_gen provider: openai-codex
  2026-05-13 16:49:20,873 INFO hermes_cli.plugins: Plugin 'xai' registered image_gen provider: xai
  2026-05-13 16:49:21,029 INFO hermes_cli.plugins: Plugin discovery complete: 12 found, 8 enabled
  2026-05-13 16:49:21,805 INFO run_agent: Loaded environment variables from /Users/<USER>/.hermes/.env
  2026-05-13 16:49:22,289 INFO tools.tirith_security: tirith not found — downloading latest release for aarch64-apple-darwin...
  2026-05-13 16:49:23,456 WARNING agent.auxiliary_client: Auxiliary auto-detect: no provider available (tried: openrouter, nous, local/custom, api-key). Compression, summarization, and memory flush will not work. Set OPENROUTER_API_KEY or configure a local model in config.yaml.
  2026-05-13 16:49:23,457 WARNING run_agent: No auxiliary LLM provider for compression — summaries will be unavailable.
  2026-05-13 16:49:23,460 INFO [20260513_164922_96c02f] run_agent: conversation turn: session=20260513_164922_96c02f model=arn:aws:bedrock:us-west-2:<REDACTED_ACCOUNT>:application-inference-profile/<REDACTED_PROFILE> provider=bedrock platform=cli history=0 msg='hi'
  2026-05-13 16:49:23,559 WARNING [20260513_164922_96c02f] run_agent: API call failed (attempt 1/3) error_type=ImportError thread=Thread-5 (run_agent):6249885696 provider=bedrock base_url=https://bedrock-runtime.us-east-1.amazonaws.com
  model=arn:aws:bedrock:us-west-2:<REDACTED_ACCOUNT>:application-inference-profile/<REDACTED_PROFILE> summary=The 'boto3' package is required for the AWS Bedrock provider. Install it with: pip install boto3
  Or install Hermes with Bedrock support: pip install -e '.[bedrock]'
  2026-05-13 16:49:23,561 WARNING [20260513_164922_96c02f] run_agent: Retrying API call in 2.940416728740643s (attempt 1/3) thread=Thread-5 (run_agent):6249885696 provider=bedrock base_url=https://bedrock-runtime.us-east-1.amazonaws.com
  model=arn:aws:bedrock:us-west-2:<REDACTED_ACCOUNT>:application-inference-profile/<REDACTED_PROFILE> error=The 'boto3' package is required for the AWS Bedrock provider. Install it with: pip install boto3
  Or install Hermes with Bedrock support: pip install -e '.[bedrock]'
  2026-05-13 16:49:25,317 WARNING agent.auxiliary_client: Auxiliary auto-detect: no provider available (tried: openrouter, nous, local/custom, api-key). Compression, summarization, and memory flush will not work. Set OPENROUTER_API_KEY or configure a local model in config.yaml.
  2026-05-13 16:49:25,317 INFO agent.auxiliary_client: Auxiliary title_generation: provider auto unavailable, trying auto-detection chain
  2026-05-13 16:49:25,402 WARNING agent.auxiliary_client: Auxiliary auto-detect: no provider available (tried: openrouter, nous, local/custom, api-key). Compression, summarization, and memory flush will not work. Set OPENROUTER_API_KEY or configure a local model in config.yaml.
  2026-05-13 16:49:25,402 WARNING agent.title_generator: Title generation failed: No LLM provider configured for task=title_generation provider=auto. Run: hermes setup
  2026-05-13 18:29:01,728 WARNING agent.bedrock_adapter: Failed to create Bedrock client for model discovery: The 'boto3' package is required for the AWS Bedrock provider. Install it with: pip install boto3
  Or install Hermes with Bedrock support: pip install -e '.[bedrock]'
  2026-05-13 18:29:18,268 INFO hermes_cli.plugins: Plugin 'openai' registered image_gen provider: openai
  2026-05-13 18:29:18,269 INFO hermes_cli.plugins: Plugin 'openai-codex' registered image_gen provider: openai-codex
  2026-05-13 18:29:18,270 INFO hermes_cli.plugins: Plugin 'xai' registered image_gen provider: xai
  2026-05-13 18:29:20,292 INFO hermes_cli.plugins: Plugin discovery complete: 12 found, 8 enabled
  2026-05-13 18:30:17,775 INFO hermes_cli.plugins: Plugin 'openai' registered image_gen provider: openai
  2026-05-13 18:30:17,776 INFO hermes_cli.plugins: Plugin 'openai-codex' registered image_gen provider: openai-codex
  2026-05-13 18:30:17,776 INFO hermes_cli.plugins: Plugin 'xai' registered image_gen provider: xai
  2026-05-13 18:30:17,879 INFO hermes_cli.plugins: Plugin discovery complete: 12 found, 8 enabled
  2026-05-13 18:30:20,283 INFO run_agent: Loaded environment variables from /Users/<USER>/.hermes/.env
  2026-05-13 18:30:20,926 INFO tools.lazy_deps: Lazy-installing edge-tts==7.2.7 for feature 'tts.edge'
  2026-05-13 18:30:22,838 INFO tools.lazy_deps: Lazy install complete for feature 'tts.edge'
  2026-05-13 18:30:23,024 INFO tools.tirith_security: tirith not found — downloading latest release for aarch64-apple-darwin...
  2026-05-13 18:30:29,912 INFO tools.tirith_security: cosign not on PATH — installing tirith with SHA-256 verification only (install cosign for full supply chain verification)
  2026-05-13 18:30:29,998 INFO tools.tirith_security: tirith installed to /Users/<USER>/.hermes/bin/tirith (SHA-256 only)
  2026-05-13 18:30:30,564 WARNING agent.auxiliary_client: Auxiliary auto-detect: no provider available (tried: openrouter, nous, local/custom, api-key). Compression, summarization, and memory flush will not work. Set OPENROUTER_API_KEY or configure a local model in config.yaml.
  2026-05-13 18:30:30,565 WARNING run_agent: No auxiliary LLM provider for compression — summaries will be unavailable.
  2026-05-13 18:30:30,568 INFO [20260513_183020_9d619a] run_agent: conversation turn: session=20260513_183020_9d619a model=arn:aws:bedrock:us-west-2:<REDACTED_ACCOUNT>:application-inference-profile/<REDACTED_PROFILE> provider=bedrock platform=cli history=0 msg='hi'
  2026-05-13 18:30:30,626 WARNING [20260513_183020_9d619a] run_agent: API call failed (attempt 1/3) error_type=ImportError thread=Thread-5 (run_agent):6186905600 provider=bedrock base_url=https://bedrock-runtime.us-east-1.amazonaws.com
  model=arn:aws:bedrock:us-west-2:<REDACTED_ACCOUNT>:application-inference-profile/<REDACTED_PROFILE> summary=The 'boto3' package is required for the AWS Bedrock provider. Install it with: pip install boto3
  Or install Hermes with Bedrock support: pip install -e '.[bedrock]'
  2026-05-13 18:30:30,628 WARNING [20260513_183020_9d619a] run_agent: Retrying API call in 2.1583524975424067s (attempt 1/3) thread=Thread-5 (run_agent):6186905600 provider=bedrock base_url=https://bedrock-runtime.us-east-1.amazonaws.com
  model=arn:aws:bedrock:us-west-2:<REDACTED_ACCOUNT>:application-inference-profile/<REDACTED_PROFILE> error=The 'boto3' package is required for the AWS Bedrock provider. Install it with: pip install boto3
  Or install Hermes with Bedrock support: pip install -e '.[bedrock]'
  2026-05-13 18:30:32,872 WARNING [20260513_183020_9d619a] run_agent: API call failed (attempt 2/3) error_type=ImportError thread=Thread-5 (run_agent):6186905600 provider=bedrock base_url=https://bedrock-runtime.us-east-1.amazonaws.com
  model=arn:aws:bedrock:us-west-2:<REDACTED_ACCOUNT>:application-inference-profile/<REDACTED_PROFILE> summary=The 'boto3' package is required for the AWS Bedrock provider. Install it with: pip install boto3
  Or install Hermes with Bedrock support: pip install -e '.[bedrock]'
  2026-05-13 18:30:32,873 WARNING [20260513_183020_9d619a] run_agent: Retrying API call in 4.044737095593005s (attempt 2/3) thread=Thread-5 (run_agent):6186905600 provider=bedrock base_url=https://bedrock-runtime.us-east-1.amazonaws.com
  model=arn:aws:bedrock:us-west-2:<REDACTED_ACCOUNT>:application-inference-profile/<REDACTED_PROFILE> error=The 'boto3' package is required for the AWS Bedrock provider. Install it with: pip install boto3
  Or install Hermes with Bedrock support: pip install -e '.[bedrock]'
  2026-05-13 18:30:36,950 WARNING [20260513_183020_9d619a] run_agent: API call failed (attempt 3/3) error_type=ImportError thread=Thread-5 (run_agent):6186905600 provider=bedrock base_url=https://bedrock-runtime.us-east-1.amazonaws.com
  model=arn:aws:bedrock:us-west-2:<REDACTED_ACCOUNT>:application-inference-profile/<REDACTED_PROFILE> summary=The 'boto3' package is required for the AWS Bedrock provider. Install it with: pip install boto3
  Or install Hermes with Bedrock support: pip install -e '.[bedrock]'
  2026-05-13 18:30:36,952 ERROR [20260513_183020_9d619a] root: API call failed after 3 retries. The 'boto3' package is required for the AWS Bedrock provider. Install it with: pip install boto3
  Or install Hermes with Bedrock support: pip install -e '.[bedrock]' | provider=bedrock model=arn:aws:bedrock:us-west-2:<REDACTED_ACCOUNT>:application-inference-profile/<REDACTED_PROFILE> msgs=2 tokens=~3,658
  2026-05-13 18:50:00,737 INFO hermes_cli.debug: hermes debug share: applied force-mode redaction to log snapshots before upload

Operating System

macOS 15

Python Version

3.11.15

Hermes Version

v0.13.0

Additional Logs / Traceback (optional)

Root Cause Analysis (optional)

agent/bedrock_adapter.py:48-58 — _require_boto3() is the single gateway for all boto3 access in the adapter, but it does a bare try: import boto3 / except ImportError: raise ImportError(...manual install...) and never calls tools.lazy_deps.ensure("provider.bedrock").

This call site was missed in the 2026-05-12 refactor that relocated boto3 from the [all] extra to LAZY_DEPS. Compare with agent/anthropic_adapter.py:34-51 _get_anthropic_sdk(), which correctly calls _lazy_ensure("provider.anthropic", prompt=False) before the import.

Proposed Fix (optional)

Mirror the _get_anthropic_sdk pattern in _require_boto3: call tools.lazy_deps.ensure("provider.bedrock", prompt=False) inside a try/except (tolerating ImportError if lazy_deps is unavailable and generic Exception for FeatureUnavailable when lazy installs are opted-out/offline) before the import boto3 attempt, preserving the existing ImportError message as the final fallback.

Are you willing to submit a PR for this?

  • I'd like to fix this myself and submit a PR

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium — degraded but workaround existscomp/agentCore agent loop, run_agent.py, prompt builderprovider/bedrockAWS Bedrock (boto3, IAM)sweeper:implemented-on-mainSweeper: behavior already present on current maintype/bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions