Skip to content

Add Valkey as an alternative distributed cache backend #2239

Description

@edlng

First and foremost, Valkey is the open-source alternative to Redis that is currently being very actively developed and backed by AWS and many other companies. Originally, it was forked from Redis right before the transition to their new source available licenses. https://valkey.io/ https://github.com/valkey-io/valkey

Is your feature request related to a problem? Please describe.
Currently, this project uses a filesystem-based local cache which has its limitations with caching (e.g., TTL expiration, shared caching across distributed instances, and efficient key lookups at scale). If teams are running Stagehand across multiple environments or CI pipelines, cached actions cannot be shared which causes redundant LLM calls and increased costs.

Describe the solution you'd like
We can implement a Valkey-backed CacheStorage provider that works with the current existing cache architecture. It will support the same cache key generation logic, provide configurable TTL for cache entries, and allow for distributed cache sharing. We can do both NodeJS and Python implementations. In more technical terms: create a pluggable backend interface that abstracts the existing readJson/writeJson contract in CacheStorage, then add a Valkey provider. It would support configurable TTL for cache entries, distributed cache sharing, and remain backward-compatible with the existing default filesystem.

Describe alternatives you've considered
Redis was considered but Valkey avoids the licensing concerns while maintaining full protocol compatibility. Valkey has been proven from time to time to be an extremely efficient cache for agentic tooling and in this case can provide many benefits to Stagehand.

Are you willing to contribute to implementing this feature or fix?

  • Yes, I can submit a PR
  • Yes, but I need guidance
  • No, I cannot contribute at this time

happily available to work on both Python and JS implementations :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions