crewAIInc / crewAI

Framework for orchestrating role-playing, autonomous AI agents. By fostering collaborative intelligence, CrewAI empowers agents to work together seamlessly, tackling complex tasks.
https://crewai.com
MIT License
20.75k stars 2.87k forks source link

[BUG] Latest langchain-core 0.2.31 release breaks Crew execution w Agent #1191

Closed andrewpap22 closed 2 months ago

andrewpap22 commented 2 months ago

Description Provide a clear and concise description of what the bug is.

ImportError: cannot import name 'ToolsRenderer' from 'langchain_core.tools'

This specific error message means that the code is trying to import ToolsRenderer from the langchain_core.tools module, but it can't find ToolsRenderer in that module the reason is that in their latest release of 0.2.31 they removed the ToolsRendered from `libs/langchain/langchain/tools/render.py` 

Steps to Reproduce Provide a step-by-step process to reproduce the behavior:

Use Python version >= 3.11 and upgrade, crewai[tools], langchain-community, langchain-core packages to latest versions and simply run a Crew execution (you need to be importing somewhere in your app usage an Agent from Crewai --> from crewai import Agent) and you'll get:

from langchain.tools.render import render_text_description
  File "/foo/bar/buzz/venv/lib/python3.11/site-packages/langchain/tools/render.py", line 9, in <module>
    from langchain_core.tools import (
ImportError: cannot import name 'ToolsRenderer' from 'langchain_core.tools' (/Users/foo/bar/buzz/venv/lib/python3.11/site-packages/langchain_core/tools/__init__.py)

Expected behavior A clear and concise description of what you expected to happen.

Crew execution shall not break.

Screenshots/Code snippets If applicable, add screenshots or code snippets to help explain your problem.

from langchain.tools.render import render_text_description
  File "/foo/bar/buzz/venv/lib/python3.11/site-packages/langchain/tools/render.py", line 9, in <module>
    from langchain_core.tools import (
ImportError: cannot import name 'ToolsRenderer' from 'langchain_core.tools' (/Users/foo/bar/buzz/venv/lib/python3.11/site-packages/langchain_core/tools/__init__.py)

I've addressed the issue also to the corresponding PR on langchain-core πŸ‘‰πŸ» link

Environment Details:

Logs Include relevant logs or error messages if applicable.

Included above.

Possible Solution Have a solution in mind? Please suggest it here, or write "None".

Currently downgraded the langchain-core package to avoid the error.

Additional context Add any other context about the problem here.

pythonbyte commented 2 months ago

Thanks @andrewpap22 for the Bug Report. We are now understanding the issue and fixing it.

joaomdmoura commented 2 months ago
Screenshot 2024-08-14 at 21 01 59

langchain fixed it :)

andrewpap22 commented 2 months ago

Yep they were pretty quick! πŸ™πŸ» πŸ‘πŸ» --> related_fix