Which component is this bug for?
Langchain Instrumentation
📜 Description
opentelemetry-instrumentation-langchain v0.53.x crashes when langgraph-supervisor's create_supervisor() passes a ToolNode object to
create_react_agent. The instrumentation's monkey-patch in patch.py (line 489) assumes tools is always an iterable list, but ToolNode is not
iterable.
Environment:
- opentelemetry-instrumentation-langchain: 0.53.3
- langgraph-prebuilt: 1.0.8
- langgraph-supervisor: latest
- Python: 3.13
👟 Reproduction steps
- Install opentelemetry-instrumentation-langchain==0.53.3 with langgraph-supervisor
- Create a supervisor using create_supervisor() which internally calls create_react_agent with a ToolNode object
- Application crashes on startup
Error:
File "/usr/local/lib/python3.13/site-packages/opentelemetry/instrumentation/langchain/patch.py", line 489, in wrapper
for tool in tools:
^^^^^
TypeError: 'ToolNode' object is not iterable
👍 Expected behavior
Should work
👎 Actual Behavior with Screenshots
NA
🤖 Python Version
3.13
📃 Provide any additional context for the Bug.
Root Cause:
In patch.py lines 484-492:
python
tools = kwargs.get("tools")
if tools is None and len(args) > 1:
tools = args[1]
if tools:
tool_definitions = []
for tool in tools: # <-- ToolNode is not iterable
tool_def = _extract_tool_definition(tool)
ToolNode is a LangGraph class that wraps tools but is not itself iterable. It exposes tools via tools_by_name attribute.
Suggested Fix:
python
if tools:
tool_definitions = []
_tools_iter = tools.tools_by_name.values() if hasattr(tools, 'tools_by_name') else tools
for tool in _tools_iter:
Workaround: Pin to opentelemetry-instrumentation-langchain==0.52.6
👀 Have you spent some time to check if this bug has been raised before?
Are you willing to submit PR?
None
Which component is this bug for?
Langchain Instrumentation
📜 Description
opentelemetry-instrumentation-langchain v0.53.x crashes when langgraph-supervisor's create_supervisor() passes a ToolNode object to
create_react_agent. The instrumentation's monkey-patch in patch.py (line 489) assumes tools is always an iterable list, but ToolNode is not
iterable.
Environment:
👟 Reproduction steps
Error:
File "/usr/local/lib/python3.13/site-packages/opentelemetry/instrumentation/langchain/patch.py", line 489, in wrapper
for tool in tools:
^^^^^
TypeError: 'ToolNode' object is not iterable
👍 Expected behavior
Should work
👎 Actual Behavior with Screenshots
NA
🤖 Python Version
3.13
📃 Provide any additional context for the Bug.
Root Cause:
In patch.py lines 484-492:
python
tools = kwargs.get("tools")
if tools is None and len(args) > 1:
tools = args[1]
if tools:
tool_definitions = []
for tool in tools: # <-- ToolNode is not iterable
tool_def = _extract_tool_definition(tool)
ToolNode is a LangGraph class that wraps tools but is not itself iterable. It exposes tools via tools_by_name attribute.
Suggested Fix:
python
if tools:
tool_definitions = []
_tools_iter = tools.tools_by_name.values() if hasattr(tools, 'tools_by_name') else tools
for tool in _tools_iter:
Workaround: Pin to opentelemetry-instrumentation-langchain==0.52.6
👀 Have you spent some time to check if this bug has been raised before?
Are you willing to submit PR?
None