🐛 Bug Report: LangChain: TraceloopCallbackHandler raises AttributeError at every LangGraph interrupt() and resume

Open
#4,636 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@lakshya-dhariwal is already working on this.

Since Oct 18, 2026.

  • #4638 by @lakshya-dhariwal — open

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
python
Domain
observability

Research direction

Start by reading the LangChain instrumentation’s TraceloopCallbackHandler and the BaseCallbackManager wrapper described in the issue. Reproduce the interrupt and resume callbacks using the provided LangGraph example, then inspect the existing instrumentation tests for callback coverage. Done means the reproduction logs no callback errors and both graph events are represented in the trace; pull request #4638 is already open against this issue.

Written by the indexing model from the issue text.

Description

Which component is this bug for?

Langchain Instrumentation

📜 Description

With the LangChain instrumentation active, every LangGraph interrupt() and every Command(resume=...) makes LangChain log Error in TraceloopCallbackHandler.on_interrupt callback: AttributeError(...), and the same for on_resume. The BaseCallbackManager.__init__ wrapper adds the handler to every callback manager, including LangGraph's graph callback manager, which calls on_interrupt / on_resume on its handlers, and TraceloopCallbackHandler does not implement them. The run itself works, but each pause and resume produces an error in the logs and is missing from the trace.

👟 Reproduction steps
# LangGraph: at every interrupt() and every resume, LangChain logs an exception raised by TraceloopCallbackHandler
# (on_interrupt / on_resume).
import json, logging, sys
from importlib.metadata import version
from typing import Annotated
from typing_extensions import TypedDict
try:
    import httpx2 as httpx                         # openai >= 3
except ImportError:
    import httpx
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.instrumentation.langchain import LangchainInstrumentor
LangchainInstrumentor().instrument(tracer_provider=TracerProvider())

from langchain_core.messages import HumanMessage
from langchain_openai import ChatOpenAI
from langgraph.checkpoint.memory import InMemorySaver
from langgraph.graph import END, START, StateGraph
from langgraph.graph.message import add_messages
from langgraph.types import Command, interrupt

class Errors(logging.Handler):                     # LangChain logs a callback's exception as "Error in X callback: ..."
    seen = []
    def emit(self, record):
        if record.getMessage().startswith("Error in "):
            Errors.seen.append(record.getMessage()[:160])
logging.getLogger("langchain_core.callbacks.manager").addHandler(Errors())

def reply(request):                                # a local stand-in for the OpenAI API
    return httpx.Response(200, json={"id": "c-1", "object": "chat.completion", "created": 0, "model": "gpt-4o-mini",
        "choices": [{"index": 0, "message": {"role": "assistant", "content": "Paris."}, "finish_reason": "stop"}],
        "usage": {"prompt_tokens": 3, "completion_tokens": 1, "total_tokens": 4}})
llm = ChatOpenAI(model="gpt-4o-mini", api_key="x", base_url="http://mock/v1", max_retries=0,
                 http_client=httpx.Client(transport=httpx.MockTransport(reply)))

class State(TypedDict):
    messages: Annotated[list, add_messages]

def agent(state):
    return {"messages": [llm.invoke(state["messages"])]}
def approve(state):                                # human in the loop: pause until the app resumes the run
    return {"messages": [HumanMessage(f"approved: {interrupt('approve?')}")]}

g = StateGraph(State)
g.add_node("agent", agent); g.add_node("approve", approve)
g.add_edge(START, "agent"); g.add_edge("agent", "approve"); g.add_edge("approve", END)
graph = g.compile(checkpointer=InMemorySaver())

print(f"opentelemetry-instrumentation-langchain {version('opentelemetry-instrumentation-langchain')} | "
      f"langgraph {version('langgraph')} | langchain-core {version('langchain-core')} | python {sys.version.split()[0]}")
config = {"configurable": {"thread_id": "t1"}}
out = graph.invoke({"messages": [("user", "Capital of France?")]}, config)
print("paused at interrupt:", "__interrupt__" in out)
out = graph.invoke(Command(resume="yes"), config)
print("after resume:", out["messages"][-1].content)
print("errors LangChain logged:")
for e in Errors.seen:
    print("  ", e)
👍 Expected behavior

No errors at the interrupt and the resume; the handler either handles these graph events or is not added to the graph callback manager.

👎 Actual Behavior with Screenshots
opentelemetry-instrumentation-langchain 0.62.4 | langgraph 1.2.16 | langchain-core 1.6.12 | python 3.13.7
paused at interrupt: True
after resume: approved: yes
errors LangChain logged:
   Error in TraceloopCallbackHandler.on_interrupt callback: AttributeError("'TraceloopCallbackHandler' object has no attribute 'on_interrupt'")
   Error in TraceloopCallbackHandler.on_resume callback: AttributeError("'TraceloopCallbackHandler' object has no attribute 'on_resume'")
🤖 Python Version

3.13 (also seen with 3.12)

📃 Provide any additional context for the Bug.

opentelemetry-instrumentation-langchain 0.62.4 (the latest release; main has no changes to this package since), langgraph 1.2.16, langchain-core 1.6.12, langchain-openai 1.7.2 (also langgraph 1.2.14 / langchain-core 1.6.9).

👀 Have you spent some time to check if this bug has been raised before?
  • I checked and didn't find similar issue
Are you willing to submit PR?

None

Dominant language
Python
Stars
7.5k
Forks
1.2k
Avg merge
2d 6h
Merged PRs (30d)
2

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from traceloop/openllmetry

All issues in traceloop/openllmetry

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.