Fix Langfuse dependency incompatibility and upgrade to Python SDK v4
Author: hassiebpCreated Jul 15, 2026Updated Jul 21, 2026
Labelsbugarea: backend
Hi Quivr team — I'm Hassieb from the Langfuse team.
I noticed Quivr declares langfuse>=2.57.0 without an upper bound while core/quivr_core/rag/utils.py imports CallbackHandler from the removed langfuse.callback path. A fresh install can therefore resolve v4 and fail at import time today.
The concrete fix looks like:
- First add a safe upper bound, then migrate to
langfuse>=4.7,<5. - Import
CallbackHandlerfromlangfuse.langchain. - Keep the handler connected to both the synchronous
invokeand asynchronous/streaming code paths. - Carry user/session/trace correlation through the v4-supported LangChain metadata or
propagate_attributes()path. - Add a clean-environment import test plus one sync and one streaming trace test.
The migration guides are v2→v3 and v3→v4.
If you need support with the migration, we're happy to jump on a call or help review a PR.
Source: QuivrHQ/quivr