Skip to content

[Feat][Router] Support Redis as Response API storage backend #804

@Xunzhuo

Description

@Xunzhuo

Summary

Add Redis as a storage backend for the Response API to enable fast, distributed conversation storage.

Background

PR #802 introduced Response API support with a pluggable storage interface. Currently, only the in-memory store is implemented. Redis would provide:

  • Persistence: Survive router restarts with RDB/AOF
  • Distribution: Share state across multiple router instances
  • Native TTL: Built-in expiration for conversation cleanup
  • High performance: Sub-millisecond read/write latency

Implementation Tasks

  • Implement RedisStore in pkg/responsestore/redis_store.go
  • Design Redis key schema for responses and conversations
  • Implement CRUD operations with Redis commands
  • Add connection pooling and cluster support
  • Leverage Redis TTL for automatic expiration
  • Add configuration options in RedisStoreConfig
  • Add unit tests for Redis store
  • Add integration tests with Redis
  • Update documentation

Configuration Example

response_api:
  enabled: true
  store_backend: "redis"
  ttl_seconds: 86400
  redis:
    address: "localhost:6379"
    password: ""
    db: 0
    key_prefix: "sr:response:"

Key Schema Design

sr:response:{response_id}     -> JSON blob of StoredResponse
sr:conversation:{conv_id}     -> JSON blob of StoredConversation
sr:chain:{response_id}        -> List of response IDs in chain

Related

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Backlog

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions