Skip to main content

Redis implementation of the Store interface for ai-agentswarm.

Project description

agentswarm-redis-store

Redis implementation of the Store interface for ai-agentswarm.

Security Configuration

This project focuses on secure Redis connections. It supports:

  • SSL/TLS: For encrypted communication.
  • ACL/Passwords: For authenticated access.
  • Safe Serialization: Uses JSON by default for structured data.

Installation

pip install agentswarm-redis-store

Local Development

If you are working on the source code:

# Clone the repository
cd agentswarm-redis-store

# Create and activate virtual environment
python3 -m venv venv
source venv/bin/activate

# Install in editable mode
pip install -e .

Security Focus

The RedisStore is designed with security as a primary concern:

  • SSL/TLS: Mandatory for production environments to prevent eavesdropping.
  • Authentication: Supports both legacy password and modern Redis 6+ username/password ACLs.
  • Secure Reconstruction: to_dict() returns a minimal configuration that triggers reconstruction from environment variables on the remote side, ensuring sensitive credentials are never serialized or transmitted.
  • Client Injection: Allows passing a pre-configured redis.Redis client for advanced use cases (e.g., custom pooling, sentinel).

Configuration Environment Variables

When using RedisStore.from_env() or remote reconstruction, the following environment variables are supported:

Variable Description Default
REDIS_HOST Redis server hostname localhost
REDIS_PORT Redis server port 6379
REDIS_DB Redis database number 0
REDIS_USERNAME Username for ACL authentication None
REDIS_PASSWORD Password for authentication None
REDIS_SSL Enable SSL/TLS connection (true/false) false

Usage

Environmental Configuration (Recommended)

Set REDIS_HOST, REDIS_PASSWORD, etc., in your environment and use:

from agentswarm.redis.store import RedisStore
store = RedisStore.from_env()

Direct Client Injection

import redis
from agentswarm.redis.store import RedisStore

client = redis.Redis(host="localhost", db=0)
store = RedisStore(redis_client=client)

Remote Reconstruction

store = RedisStore.from_env()
config = store.to_dict() # Returns {"recreate_from_env": True}

# On a remote machine (with its own REDIS_HOST env var)
remote_store = RedisStore.recreate(config)

Integration with Agentswarm

You can use the RedisStore as the backend for the agentswarm.Context:

from agentswarm.redis.store import RedisStore
from agentswarm.datamodels.context import Context

# 1. Initialize the store (e.g., from environment)
store = RedisStore.from_env()

# 2. Inject into the Context
context = Context(
    trace_id="my-unique-trace",
    messages=[],
    store=store,
    tracing=my_tracing_instance
)

# 3. Use as usual
context.store.set("key", "value")

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

agentswarm_redis_store-0.1.0.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

agentswarm_redis_store-0.1.0-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file agentswarm_redis_store-0.1.0.tar.gz.

File metadata

  • Download URL: agentswarm_redis_store-0.1.0.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for agentswarm_redis_store-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ed2e155cf325bd3141735c804fcc947272b01be65ee3607deb8ca141b14895c1
MD5 9aba6170842c8941b43f776babb48bde
BLAKE2b-256 108fc1bfc37b6a06a2052f0eaef18ef8114132c0b7a47c59642f33cb4dbb86d4

See more details on using hashes here.

Provenance

The following attestation bundles were made for agentswarm_redis_store-0.1.0.tar.gz:

Publisher: publish.yml on ai-agentswarm/agentswarm-redis-store

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file agentswarm_redis_store-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for agentswarm_redis_store-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 51c8799a76f720ae8bf35eca65fbf1f2877798e671927f300eb8be0d7d67881d
MD5 405b84588acd3b8099791adfef2eb4bd
BLAKE2b-256 8792ba66e6acf6760c9361fa575462a056e149c03c6721fe79e87d0d32fe0e2f

See more details on using hashes here.

Provenance

The following attestation bundles were made for agentswarm_redis_store-0.1.0-py3-none-any.whl:

Publisher: publish.yml on ai-agentswarm/agentswarm-redis-store

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page