L6 -- langchain.agents.agent_toolkits, the "agent_toolkits" is not a subpath

error is occurring in:

from langchain.agents.agent_toolkits import create_python_agent

looks like “create_python_agent” is not part of langchain.agents.agent_toolkit

1 Like

to clarify: I am trying to run these notebooks in a local VSCode environment.

I have langchain version 0.1.16

I notice that the online (course) notebook is using an ancient version of langchain:

import langchain
langchain.version
‘0.0.179’

I had to use the experimental library instead like:

from langchain_experimental.tools.python.tool import PythonREPLTool
from langchain_experimental.agents.agent_toolkits import create_python_agent

then the notebook ran without errors

3 Likes
from langchain_experimental.tools.python.tool import PythonREPLTool
from langchain_experimental.agents.agent_toolkits import create_python_agent
from langchain_experimental.utilities import PythonREPL

using the langchain_experimental experimental fixed the issue