Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ dist
repl_state
.kiro
uv.lock
.idea
7 changes: 6 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ sagemaker = [
"openai>=1.68.0,<2.0.0", # SageMaker uses OpenAI-compatible interface
]
otel = ["opentelemetry-exporter-otlp-proto-http>=1.30.0,<2.0.0"]
dapr = ["dapr>=1.16.0", "grpcio>=1.60.0"]
docs = [
"sphinx>=5.0.0,<9.0.0",
"sphinx-rtd-theme>=1.0.0,<2.0.0",
Expand All @@ -69,7 +70,7 @@ a2a = [
"fastapi>=0.115.12,<1.0.0",
"starlette>=0.46.2,<1.0.0",
]
all = ["strands-agents[a2a,anthropic,docs,gemini,litellm,llamaapi,mistral,ollama,openai,writer,sagemaker,otel]"]
all = ["strands-agents[a2a,anthropic,dapr,docs,gemini,litellm,llamaapi,mistral,ollama,openai,writer,sagemaker,otel]"]

dev = [
"commitizen>=4.4.0,<5.0.0",
Expand All @@ -82,6 +83,7 @@ dev = [
"pytest-asyncio>=1.0.0,<1.3.0",
"pytest-xdist>=3.0.0,<4.0.0",
"ruff>=0.13.0,<0.14.0",
"testcontainers[redis]>=4.0.0",
]

[project.urls]
Expand Down Expand Up @@ -135,6 +137,9 @@ dependencies = [
"pytest-asyncio>=1.0.0,<1.3.0",
"pytest-xdist>=3.0.0,<4.0.0",
"moto>=5.1.0,<6.0.0",
"dapr>=1.16.0",
"grpcio>=1.60.0",
"testcontainers[redis]>=4.0.0",
]

[[tool.hatch.envs.hatch-test.matrix]]
Expand Down
40 changes: 40 additions & 0 deletions src/strands/session/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,56 @@
This module provides session management functionality.
"""

from typing import Any

from .file_session_manager import FileSessionManager
from .repository_session_manager import RepositorySessionManager
from .s3_session_manager import S3SessionManager
from .session_manager import SessionManager
from .session_repository import SessionRepository

__all__ = [
"DAPR_CONSISTENCY_EVENTUAL",
"DAPR_CONSISTENCY_STRONG",
"DaprSessionManager",
"FileSessionManager",
"RepositorySessionManager",
"S3SessionManager",
"SessionManager",
"SessionRepository",
]


def __getattr__(name: str) -> Any:
"""Lazy import for optional dependencies."""
if name == "DaprSessionManager":
try:
from .dapr_session_manager import DaprSessionManager

return DaprSessionManager
except ModuleNotFoundError as e:
raise ImportError(
"DaprSessionManager requires the 'dapr' extra. Install it with: pip install strands-agents[dapr]"
) from e

if name == "DAPR_CONSISTENCY_EVENTUAL":
try:
from .dapr_session_manager import DAPR_CONSISTENCY_EVENTUAL

return DAPR_CONSISTENCY_EVENTUAL
except ModuleNotFoundError as e:
raise ImportError(
"DAPR_CONSISTENCY_EVENTUAL requires the 'dapr' extra. Install it with: pip install strands-agents[dapr]"
) from e

if name == "DAPR_CONSISTENCY_STRONG":
try:
from .dapr_session_manager import DAPR_CONSISTENCY_STRONG

return DAPR_CONSISTENCY_STRONG
except ModuleNotFoundError as e:
raise ImportError(
"DAPR_CONSISTENCY_STRONG requires the 'dapr' extra. Install it with: pip install strands-agents[dapr]"
) from e

raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
Loading