deepagents icon indicating copy to clipboard operation
deepagents copied to clipboard

Deepagent import error

Open Crispae opened this issue 1 month ago • 7 comments

ImportError: cannot import name 'ToolCallRequest' from 'langchain.agents.middleware.types'

Python:3.12.6

Image

Crispae avatar Nov 03 '25 22:11 Crispae

what version of langchain are you on?

eyurtsev avatar Nov 04 '25 18:11 eyurtsev

I Encountered the Same Issue

I'm facing the exact same problem as described. ImportError: cannot import name 'ToolCallRequest' from 'langchain.agents.middleware.types' Please refer to the attached image for details.

Image

My Package Versions

Below are the versions of the relevant packages in my environment for reference.

Image

Acknowledgement

Thank you very much for your time and assistance in looking into this issue.

550W-hub avatar Nov 05 '25 01:11 550W-hub

That’s because langchain_anthropic incorrectly imports ToolCallRequest. The correct import path should be:

from langchain.tools.tool_node import ToolCallRequest

However, langchain version 1.0.3 happens to import that class under langchain.agents.middleware.types. So as a temporary fix, you can simply upgrade langchain to 1.0.3.

flingjie avatar Nov 05 '25 08:11 flingjie

Quick and effective solution—thanks!

550W-hub avatar Nov 06 '25 00:11 550W-hub

Updating the LangChain version to 1.0.3 resolved the DeepAgent-related issue, but introduced other problems. ImportError: cannot import name 'InputTokenDetails' from 'langchain_core.messages' Please refer to the attached image for details. Image How can I fix this issue? Thank you.

550W-hub avatar Nov 06 '25 04:11 550W-hub

update langchain-core to 1.0.3

flingjie avatar Nov 06 '25 05:11 flingjie

Problem solved, thanks!

550W-hub avatar Nov 06 '25 06:11 550W-hub