Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 27, 2026

Langfuse 3.3.0+ restructured its module exports, removing langfuse.callback in favor of langfuse.langchain. The old import paths caused startup crashes with ModuleNotFoundError: No module named 'langfuse.callback'.

Changes

Updated imports across 5 files:

# Before
from langfuse.callback import CallbackHandler as LangfuseCallbackHandler
from langfuse.callback.langchain import LangchainCallbackHandler

# After
from langfuse.langchain import CallbackHandler as LangfuseCallbackHandler
from langfuse.langchain.CallbackHandler import LangchainCallbackHandler

Modified files:

  • services/observability/observabilty_service.py
  • services/langchain/factories/langchain_factory.py
  • services/langchain/factories/callback_handlers/langfuse_callback_handler_factory.py
  • services/langchain/factories/callback_handlers/callback_handlers_factory.py
  • services/langchain/rag_chain.py

Note: CallbackHandler and LangchainCallbackHandler reference the same class; the latter is used where type annotations explicitly require the concrete class name.

Original prompt

This section details on the original issue you should resolve

<issue_title>[GenAI orchestrator] Container gen-ai-orchestrator-server Crash at startup with error No module named 'langfuse.callback'</issue_title>
<issue_description>On kubernetes, the version 25.10.3 of gen-ai-orchestrator-server container (docker.io/tock/gen-ai-orchestrator-server:25.10.3) crash with the following error No module named 'langfuse.callback' at startup.

logs tockocloud-genai-orchestrator-74c49d659b-s5m85 | more                                                                                                                      15:46:42 
Traceback (most recent call last):
  File "/usr/local/bin/uvicorn", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1161, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1082, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1443, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/click/core.py", line 788, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/uvicorn/main.py", line 412, in main
    run(
  File "/usr/local/lib/python3.11/site-packages/uvicorn/main.py", line 579, in run
    server.run()
  File "/usr/local/lib/python3.11/site-packages/uvicorn/server.py", line 66, in run
    return asyncio.run(self.serve(sockets=sockets))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/asyncio/runners.py", line 190, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/asyncio/base_events.py", line 654, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/uvicorn/server.py", line 70, in serve
    await self._serve(sockets)
  File "/usr/local/lib/python3.11/site-packages/uvicorn/server.py", line 77, in _serve
    config.load()
  File "/usr/local/lib/python3.11/site-packages/uvicorn/config.py", line 435, in load
    self.loaded_app = import_from_string(self.app)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/uvicorn/importer.py", line 22, in import_from_string
    raise exc from None
  File "/usr/local/lib/python3.11/site-packages/uvicorn/importer.py", line 19, in import_from_string
    module = importlib.import_module(module_str)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/gen_ai_orchestrator/main.py", line 32, in <module>
    from gen_ai_orchestrator.routers.completion_router import completion_router
  File "/gen_ai_orchestrator/routers/completion_router.py", line 39, in <module>
    from gen_ai_orchestrator.services.completion.completion_service import (
  File "/gen_ai_orchestrator/services/completion/completion_service.py", line 37, in <module>
    from gen_ai_orchestrator.services.langchain.factories.langchain_factory import (
  File "/gen_ai_orchestrator/services/langchain/factories/langchain_factory.py", line 29, in <module>
    from langfuse.callback import CallbackHandler as LangfuseCallbackHandler
ModuleNotFoundError: No module named 'langfuse.callback'

I had an issue in the validation process of tock helm chart 0.60 (for 25.10.3). In the test deployment, the gen-ai-orchestrator-server parameters are the same as those used for 25.3.10 version.</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI changed the title [WIP] Fix gen-ai-orchestrator-server crash on startup Fix langfuse import paths for version 3.3.0+ Jan 27, 2026
Copilot AI requested a review from vsct-jburet January 27, 2026 07:03
@assouktim
Copy link
Contributor

@vsct-jburet This is deeply rooted in #1954
Because it's not just a problem with importing, but also with using the callback itself, and Langfuse V3 API

@vsct-jburet
Copy link
Contributor

@vsct-jburet This is deeply rooted in #1954 Because it's not just a problem with importing, but also with using the callback itself, and Langfuse V3 API

@assouktim It seems that this PR fixes the issue - at least for the pod startup :). What do you think ? Is it a good idea to merge it right now, or do we need to wait #1954 ?

@assouktim
Copy link
Contributor

ok i agree

@vsct-jburet vsct-jburet marked this pull request as ready for review January 27, 2026 16:00
@vsct-jburet vsct-jburet merged commit b34bbfa into master Jan 27, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[GenAI orchestrator] Container gen-ai-orchestrator-server Crash at startup with error No module named 'langfuse.callback'

3 participants