Tool Methods in Python Class Missing self Argument When Used in Custom Agents #29004
Replies: 1 comment 10 replies
-
The error you're encountering is due to the way the To resolve this issue, you need to ensure that the
By using To continue talking to Dosu, mention @dosu. Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other |
Beta Was this translation helpful? Give feedback.
-
I am working on a custom implementation of AI agents using Python, where the agents rely on langchain tools (methods) for interacting with a PostgreSQL database. The ToolWithConnection class initializes a database connection and defines tools like list_tables, tables_schema, check_sql, and execute_sql_to_df. These tools are later used by CrewAI agents to perform various tasks.
Here’s the relevant part of the code:
When I run the CrewAIWrapper with the agents and tools, I get the following error for the list_tables tool:
Question:
Why is the self argument missing when calling list_tables?
How can I properly pass instance methods (like list_tables) from a class to agents without encountering this error?
Beta Was this translation helpful? Give feedback.
All reactions