Streaming Failures When Using Shared Custom Redis Instances

Last updated: November 20, 2025

When multiple LangSmith deployments share the same custom Redis instance without separate database numbers, streaming requests may fail silently—returning only heartbeats without any data.

This occurs because deployments without explicit database isolation can consume each other's streaming output from the shared Redis instance, causing data to be lost or routed to the wrong deployment.

Root Cause

When you configure REDIS_URI_CUSTOM without specifying a database number (e.g., redis://hostname:port instead of redis://hostname:port/1), all deployments default to Redis database 0. Shared use of the same Redis database causes:

  • Deployments to intercept each other's streamed messages

  • Cache key collisions between deployment instances

  • Undefined behavior in message routing and state management

  • Silent failures where streaming appears to work but no data flows back

How to Fix

Assign each deployment its own Redis database number by specifying the database index in your REDIS_URI_CUSTOM URI:

Deployment A:
REDIS_URI_CUSTOM=redis://hostname:port/1

Deployment B:
REDIS_URI_CUSTOM=redis://hostname:port/2

Deployment C:
REDIS_URI_CUSTOM=redis://hostname:port/3

The number after the final / is the Redis database number. Multiple deployments can share the same Redis instance (same hostname and port), but each must use a different database number (0-15 are typically available, though this depends on your Redis configuration).

Verification Steps

  1. Confirm your REDIS_URI_CUSTOM includes a unique database number for each deployment

  2. Restart all affected deployments after updating the environment variable

  3. Test streaming with POST /runs/stream to verify data flows correctly

Important Note About Other Shared Infrastructure

The same isolation principle applies to custom PostgreSQL instances (POSTGRES_URI_CUSTOM):

Deployment A:
POSTGRES_URI_CUSTOM=postgresql://user:password@hostname/deployment_a

Deployment B:
POSTGRES_URI_CUSTOM=postgresql://user:password@hostname/deployment_b

Each deployment must have its own database schema. You can share the same PostgreSQL instance (server), but not the same database.

For Redis, separate database numbers are preferred over sharing a single database with key prefixes. For PostgreSQL, you must use separate databases.

Related Resources