aws / aws/bedrock-agentcore-sdk-python
[Bug] 1.11.0 fails to import on fresh install: bedrock_agentcore.evaluation triggers ModuleNotFoundError: No module named 'requests'
- Dominant language
- Python
- Stars
- 761
- Forks
- 147
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 7
Description
# [Bug] 1.11.0 fails to import on fresh install: `bedrock_agentcore.evaluation` triggers `ModuleNotFoundError: No module named 'requests'`
## Summary
After installing `bedrock-agentcore==1.11.0` from PyPI into a clean virtual environment, importing anything from `bedrock_agentcore.evaluation` fails with `ModuleNotFoundError: No module named 'requests'`. The new file `src/bedrock_agentcore/evaluation/runner/dataset_providers.py` (added in #491) does `import requests` at module load, but `requests` is not declared in the package's runtime dependencies — only in `[dependency-groups.dev]`.
The runtime path (`bedrock_agentcore.runtime`) is unaffected, so the issue is scoped to the evaluation submodule.
## Reproduction
```bash
python3.12 -m venv /tmp/repro && source /tmp/repro/bin/activate
pip install bedrock-agentcore==1.11.0
python -c "from bedrock_agentcore.evaluation import EvaluatorInput"
```
Output:
```
Traceback (most recent call last):
File "", line 1, in
File ".../site-packages/bedrock_agentcore/evaluation/__init__.py", line 10, in
from bedrock_agentcore.evaluation.runner.batch.batch_evaluation_models import (
File ".../site-packages/bedrock_agentcore/evaluation/runner/__init__.py", line 3, in
from .dataset_providers import DatasetProvider, FileDatasetProvider
File ".../site-packages/bedrock_agentcore/evaluation/runner/dataset_providers.py", line 7, in
import requests
ModuleNotFoundError: No module named 'requests'
```
## Root cause
In `pyproject.toml` at `v1.11.0`, `requests` only appears in the dev-tools group:
```toml
[project]
dependencies = [
"boto3>=1.43.0",
"botocore>=1.43.0",
"pydantic>=2.0.0,<2.41.3",
"urllib3>=1.26.0",
"starlette>=0.46.2",
"typing-extensions>=4.13.2,<5.0.0",
"uvicorn>=0.34.2",
"websockets>=12.0",
] # ← no `requests` here
[dependency-groups]
dev = [
"httpx>=0.28.1",
"moto>=5.1.6", # transitively pulls in requests in dev environments
...
]
```
But `src/bedrock_agentcore/evaluation/runner/dataset_providers.py` line 7 imports it at the top of the module:
```python
"""Dataset provider implementations for loading evaluation datasets."""
import json
from abc import ABC, abstractmethod
from typing import Any, Dict, List, Optional
import requests # ← runs on module load; runtime dep not declared
from bedrock_agentcore.evaluation.dataset_client import DatasetClient
...
```
Because `evaluation/runner/__init__.py` eagerly imports `dataset_providers`, and `evaluation/__init__.py` eagerly imports the runner, the failure surfaces on any first-touch of `bedrock_agentcore.evaluation.*`.
This was masked in CI / local development because `moto` (a dev-group dep) transitively installs `requests`, so it's already on the path inside the project's own venv.
## Suggested fix
Either of:
**Option A — declare the runtime dep**
```toml
dependencies = [
...,
"requests>=2.31",
]
```
**Option B — make the import lazy** (consistent with `bedrock_agentcore/identity/auth.py:155`, where `import requests` is already inside a function body)
```python
class FileDatasetProvider(DatasetProvider):
def fetch(self, url: str) -> ...:
import requests
return requests.get(url)
```
Option B is cleaner if `requests` is only used by `FileDatasetProvider`-like loaders — users who never load datasets from a remote URL wouldn't pay the dependency cost.
## Environment
- `bedrock-agentcore==1.11.0` (from PyPI, fresh install, no other packages)
- Python 3.12.12
- macOS 25.4 / `uv` 0.11.6 (also reproduces with `pip` per the steps above)
- Released 2026-05-22 ~15:27 UTC, no fix on `main` as of 2026-05-24
## Workaround for downstream consumers
Until 1.11.1 ships, downstreams need to either pin `bedrock-agentcore<1.11` or declare `requests` as a direct dep in their own package. We've taken the pin route in our internal eval wheel since we don't yet use any of the new `DatasetClient` / `DatasetManagementServiceProvider` symbols added in 1.11.0.
## Related
- PR #491 (the change that introduced the eager top-level `import requests`)
Contributor guide
Assessment
This issue has not been assessed yet.