Skip to content

[BUG]: Cannot import name AsyncCallbackManager from langchain_core.callbacks #14590

@ramundomario

Description

@ramundomario

Tracer Version(s)

3.14.0

Python Version(s)

3.12.11

Pip Version(s)

25.0.1

Bug Report

After updating ddtrace from 3.13.0 to 3.14.0 and langchain-openai from 0.3.32 to 0.3.33, we are experiencing the following error at the start of the application:

failed to enable ddtrace support for langchain: cannot import name 'AsyncCallbackManager' from 'langchain_core.callbacks' (/usr/local/lib/python3.12/site-packages/langchain_core/callbacks/__init__.py)

Reproduction Code

Automatic instrumentation just wraps the execution of the app with ddtrace-run

Error Logs

cannot import name 'AsyncCallbackManager' from 'langchain_core.callbacks' (/usr/local/lib/python3.12/site-packages/langchain_core/callbacks/__init__.py)
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/ddtrace/_monkey.py", line 276, in on_import
    imported_module.patch()
  File "/usr/local/lib/python3.12/site-packages/ddtrace/contrib/internal/langchain/patch.py", line 716, in patch
    from langchain.chains.base import Chain  # noqa:F401
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/langchain/chains/base.py", line 15, in <module>
    from langchain_core.callbacks import (
ImportError: cannot import name 'AsyncCallbackManager' from 'langchain_core.callbacks' (/usr/local/lib/python3.12/site-packages/langchain_core/callbacks/__init__.py)

Libraries in Use

langchain==0.3.27
langchain-openai==0.3.33
langgraph==0.6.7
openai==1.107.2

Operating System

Docker python:3.12.11-slim-bookworm base image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions