useStream + caching fails #271

Closed
opened 2026-02-15 18:15:22 -05:00 by yindo · 2 comments
Owner

Originally created by @brettshollenberger on GitHub (May 28, 2025).

Backend:

import { Redis } from "ioredis";
import { RedisCache } from "@langchain/community/caches/ioredis";
import { ChatAnthropic } from "@langchain/anthropic"; 

const client = new Redis(process.env.REDIS_URI!);
cache = new RedisCache(client);
llm = new ChatAnthropic({
  cache,
  apiKey: anthropicApiKey,
  model: config.model,
  temperature: config.temperature,
});

// setup graph state

Frontend:

import { useStream } from '@langchain/langgraph-sdk/react';
stream = useStream() // configure to hit backend

When posting a message that is in the cache, the messages state does not stream.

Originally created by @brettshollenberger on GitHub (May 28, 2025). Backend: ```typescript import { Redis } from "ioredis"; import { RedisCache } from "@langchain/community/caches/ioredis"; import { ChatAnthropic } from "@langchain/anthropic"; const client = new Redis(process.env.REDIS_URI!); cache = new RedisCache(client); llm = new ChatAnthropic({ cache, apiKey: anthropicApiKey, model: config.model, temperature: config.temperature, }); // setup graph state ``` Frontend: ```typescript import { useStream } from '@langchain/langgraph-sdk/react'; stream = useStream() // configure to hit backend ``` When posting a message that is in the cache, the messages state does not stream.
yindo added the bug label 2026-02-15 18:15:22 -05:00
yindo closed this issue 2026-02-15 18:15:22 -05:00
Author
Owner

@brettshollenberger commented on GitHub (May 28, 2025):

I think this actually has to do with tags. My frontend filters out any messages not containing the tag: notify, and loading from cache / database doesn't preserve the tags.

@brettshollenberger commented on GitHub (May 28, 2025): I think this actually has to do with tags. My frontend filters out any messages not containing the tag: `notify`, and loading from cache / database doesn't preserve the tags.
Author
Owner

@dqbd commented on GitHub (Aug 8, 2025):

Hello! Can't seem to repro. I think it is expected that the messages themselves won't stream token-by-token if they are retrieved from the Redis cache.

Feel free to create a new issue if there are any issues with preserving message metadata etc.

@dqbd commented on GitHub (Aug 8, 2025): Hello! Can't seem to repro. I think it is expected that the messages themselves won't stream token-by-token if they are retrieved from the Redis cache. Feel free to create a new issue if there are any issues with preserving message metadata etc.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/langgraphjs#271