Skip to content

fix(deps): ship boto3 with the base SDK so bedrock works out of the box - #36568

Merged
mubashir1osmani merged 3 commits into
litellm_internal_stagingfrom
litellm_boto3_base_sdk
Aug 11, 2026
Merged

fix(deps): ship boto3 with the base SDK so bedrock works out of the box#36568
mubashir1osmani merged 3 commits into
litellm_internal_stagingfrom
litellm_boto3_base_sdk

Conversation

@mubashir1osmani

@mubashir1osmani mubashir1osmani commented Aug 11, 2026

Copy link
Copy Markdown
Collaborator

TLDR

fixes #36550

Problem this solves:

  • Base pip install litellm cannot call Bedrock at all
  • Every Bedrock call needs boto3, but only [proxy] shipped it

How it solves it:

  • Adds boto3 to core dependencies (still listed in the proxy extra)
  • Base SDK smoke check now exercises Bedrock credential resolution

User Flow

Before: a developer installs the SDK and their first Bedrock call crashes

  1. They run pip install litellm in a fresh environment
  2. They call litellm.completion(model="bedrock/us.anthropic.claude-haiku-4-5-20251001-v1:0", ...) with AWS keys set
  3. The call raises APIConnectionError: No module named 'boto3' instead of reaching AWS
  4. They search the error, find they must also run pip install boto3, and retry

After: the same install works on the first try

  1. They run pip install litellm in a fresh environment
  2. They call litellm.completion(model="bedrock/us.anthropic.claude-haiku-4-5-20251001-v1:0", ...) with AWS keys set
  3. The model responds and litellm.completion_cost(...) prices the call

Relevant issues

Linear ticket

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have added meaningful tests
  • My PR passes all CI/CD checks (e.g., lint, format, unit tests)
  • My PR's scope is as isolated as possible; it only solves 1 specific problem
  • I have received a Greptile Confidence Score of at least 4/5 before requesting a maintainer review (Greptile reviews automatically once the PR is opened; only comment @greptileai to re-request a review after pushing changes)

Delays in PR merge?

If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).

Screenshots / Proof of Fix

Before (published litellm 1.96.0, base install, no extras):

$ uv venv /tmp/litellm-before --python 3.11
$ uv pip install --python /tmp/litellm-before/bin/python litellm
$ /tmp/litellm-before/bin/python -c 'import litellm; litellm.completion(model="bedrock/us.anthropic.claude-haiku-4-5-20251001-v1:0", messages=[{"role": "user", "content": "hi"}], aws_region_name="us-east-1", max_tokens=10)'
APIConnectionError: litellm.APIConnectionError: No module named 'boto3'
  File ".../litellm/llms/bedrock/base_aws_llm.py", line 1294, in _auth_with_access_key_and_secret_key
    import boto3
ModuleNotFoundError: No module named 'boto3'

After (this branch at 0964368, base install from the repo, no extras, real Bedrock call against AWS):

$ uv venv /tmp/litellm-base-test --python 3.11
$ uv pip install --python /tmp/litellm-base-test/bin/python .
$ /tmp/litellm-base-test/bin/python -c '
import litellm
resp = litellm.completion(
    model="bedrock/us.anthropic.claude-haiku-4-5-20251001-v1:0",
    messages=[{"role": "user", "content": "In one sentence, what is Amazon Bedrock?"}],
    aws_region_name="us-east-1",
    max_tokens=100,
)
print(resp.choices[0].message.content)
print(f"cost: ${litellm.completion_cost(completion_response=resp):.6f}")'
Amazon Bedrock is a fully managed AWS service that provides access to foundation models from various AI providers through a single API, enabling developers to build generative AI applications without managing the underlying infrastructure.
cost: $0.000251

The base SDK smoke check also passes in that same venv at 0964368 and its new bedrock check fails against 1.96.0:

$ /tmp/litellm-base-test/bin/python tests/base_sdk_tests/check_base_sdk_install.py
PASS  bedrock credential resolution: bedrock credential resolution works (boto3 ships with the base SDK)
all 7 checks passed

$ /tmp/litellm-before/bin/python tests/base_sdk_tests/check_base_sdk_install.py
FAIL  bedrock credential resolution: ... ModuleNotFoundError: No module named 'boto3'

Type

🐛 Bug Fix

Caveats (if any)

  • Base install grows by roughly 80MB (boto3 plus botocore)

Final Attestation

  • The tests check the right things, including the edge cases, and regressions in the respective real-world customer use-cases are not possible after this PR

Note

Medium Risk
Adds a large transitive dependency (boto3/botocore, ~80MB) to every base install, affecting all SDK consumers even if they never use Bedrock. No auth or runtime logic changes beyond dependency availability.

Overview
Makes Bedrock usable after a plain pip install litellm by moving boto3 into core dependencies instead of only the [proxy] extra.

Also updates the base SDK smoke check: boto3 is no longer treated as extras-only, and a new check exercises BaseAWSLLM.get_credentials so missing Bedrock deps fail CI.

Reviewed by Cursor Bugbot for commit c4163e8. Bugbot is set up for automated code reviews on this repo. Configure here.

@mubashir1osmani
mubashir1osmani requested a review from a team August 11, 2026 19:42
@greptile-apps

greptile-apps Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR makes boto3 a core LiteLLM dependency so Bedrock works with a base SDK installation while retaining boto3 in the proxy extra.

  • Updates the project metadata and lockfile to install boto3 unconditionally.
  • Extends the base SDK smoke check to exercise Bedrock credential resolution with isolated, synthetic credentials.

Confidence Score: 5/5

The PR appears safe to merge, with no concrete correctness, security, or packaging failure identified.

The dependency metadata and lockfile consistently make boto3 available to base installations, and the added smoke check exercises a deterministic local credential path without contacting AWS or exposing usable credentials.

Important Files Changed

Filename Overview
pyproject.toml Adds the existing boto3 version range to core dependencies without introducing a conflicting package constraint.
tests/base_sdk_tests/check_base_sdk_install.py Updates the base-only dependency expectation and adds a local Bedrock credential-resolution smoke check using invalid synthetic credentials.
uv.lock Reflects boto3 as both an unconditional requirement and a proxy-extra declaration, with compatible transitive dependencies resolved.

Reviews (1): Last reviewed commit: "scrub ambient AWS env vars in the base S..." | Re-trigger Greptile

@mateo-berri

Copy link
Copy Markdown
Contributor

bugbot run

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit c4163e8. Configure here.

@mateo-berri mateo-berri left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks Mubashir!

@codspeed-hq

codspeed-hq Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 31 untouched benchmarks


Comparing litellm_boto3_base_sdk (c4163e8) with litellm_internal_staging (b144b15)1

Open in CodSpeed

Footnotes

  1. No successful run was found on litellm_internal_staging (e37ae03) during the generation of this report, so b144b15 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@mubashir1osmani
mubashir1osmani merged commit 19c9140 into litellm_internal_staging Aug 11, 2026
167 of 168 checks passed
@mubashir1osmani
mubashir1osmani deleted the litellm_boto3_base_sdk branch August 11, 2026 21:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: missing boto3 dependency

3 participants