Skip to main content

strands-redis-session-manager

Redis-based session management for persisting and managing agent sessions in the Strands Agents SDK.

Description

A community package for Amazon Strands Agents that provides Redis-based session persistence and management. This package allows you to store and retrieve agent conversation history and state using Redis as the backend, enabling stateful conversations across multiple interactions.

Features

  • 🔄 Session persistence with Redis
  • 💾 Store and retrieve agent conversation history
  • 🚀 Simple integration with Strands Agents SDK
  • 🔧 Configurable
  • 🐍 Python 3.12+ support

Requirements

  • Python 3.12+
  • Strands Agents SDK 1.16.0+
  • Redis 7.0.1+

Installation

pip install strands-agents strands-redis-session-manager

Quick Start

from redis_session_manager import RedisSessionManager
from strands import Agent

# Initialize Redis session manager
session_manager = RedisSessionManager(
    session_id='<session_id>',
    redis_client=get_redis_client(),
    ttl_seconds=600, # Optional[int]
    ...
)

# Create your agent with session management
agent = Agent(
  agent_id='my-agent',
  model=your_model,
  session_manager=session_manager,
  ...
)

# Use session manager to persist conversations
# (See examples/ directory for detailed usage)

Running Locally

Prerequisites

  1. Clone the repository:
git clone https://github.com/lekhnath/strands-redis-session-manager.git
cd strands-redis-session-manager
  1. Set up Python environment (Python 3.12+):
python -m venv .venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate
  1. Install dependencies:
pip install -e ".[dev]"
# or using uv
uv pip install -e .
  1. Start Redis (using Docker):
docker compose -f compose.redis.yml up -d
  1. Copy environment variables:
cp .env-example .env
# Edit .env with your configuration

Running Tests

Tests use fakeredis for in-memory testing, so no Redis server is required.

Run integration tests:

make test-integration
# or directly with pytest
pytest tests/integration/ -v

Run all tests:

make test
# or directly with pytest
pytest tests/ -v

Run tests with coverage:

make test-cov
# or directly with pytest
pytest tests/ --cov=redis_session_manager --cov-report=term-missing

Run tests with HTML coverage report:

make test-cov-html
# Opens coverage report in htmlcov/index.html

Additional Make Commands

make install        # Install dependencies
make lint           # Run linter
make format         # Format code
make help           # Show all available commands

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

This project is licensed under the MIT License.

Links

Acknowledgments

Thanks to the Strands Agents team for creating an excellent SDK for building AI agents.

Metadata

Release files for strands-redis-session-manager 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for strands-redis-session-manager 0.1.0
File Size Uploaded Provenance
strands_redis_session_manager-0.1.0.tar.gz 7.9 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for strands-redis-session-manager 0.1.0
File Interpreter ABI Platform
strands_redis_session_manager-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 15.0 kB

Release files / strands_redis_session_manager-0.1.0.tar.gz

Download URL strands_redis_session_manager-0.1.0.tar.gz
Size 7.9 kB
Tags Source
SHA-256 checksum
How to use checksums
55c63890da3001b9c1c5571770f911e93c07cad1e903fc3c64692881f51cfa74
BLAKE2b-256 checksum
How to use checksums
da9d28e0fbda62455a04907903bb95ac4a010fcd7885d29abe78512c49cad7ea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.9 {"installer":{"name":"uv","version":"0.9.9"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / strands_redis_session_manager-0.1.0-py3-none-any.whl

Download URL strands_redis_session_manager-0.1.0-py3-none-any.whl
Size 7.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3608fd0700cb36de1a0bfa84fe586382451b2032e31df1b35f8e34556a203261
BLAKE2b-256 checksum
How to use checksums
7c7c926e63e39202d43cdbcec6e7549d6085c4fa6e847ef284dcad80c6213498
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.9 {"installer":{"name":"uv","version":"0.9.9"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for strands-redis-session-manager 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page