Closed joaomorossini closed 3 weeks ago
Hi, Thanks a lot for reporting the issue in detail here. As discussed, in the latest release all the apis should be performing a lot better and the issue should not be coming anymore. Feel free to close it once you confirm 👍
Description
I am encountering an issue using the ComposioToolSet, from the
composio_langchain
library, when trying to execute any action in ClickUp that takes as input either ateam_id
orlist_id
. Below is an example using a customMyAgent
class (code available below), which basically does the following:create_tool_calling_agent
(from LangChain)invoke
method that can be called with a simple stringhandle_tool_error
andhandle_validation_error
both set to True.MyAgent code
```python class MyAgent: def __init__(self, tools, custom_prompt: str = None): self.llm = ChatOpenAI( model="gpt-4o", api_key=os.getenv("OPENAI_API_KEY"), ) self.tools = tools self.agent_memory = ConversationBufferMemory(memory_key="chat_history", return_messages=True) self.agent = create_tool_calling_agent( llm=self.llm, tools=self.enhance_agent_tools(tools), prompt=ChatPromptTemplate.from_messages([ ("system", custom_prompt if custom_prompt else "You are an experienced assistant. You are able to perform any task asked by the user through all the tools you have access to. Your goal is to complete the user's task by using the tools you have access to. This is a core instruction: ALWAYS ALWAYS ALWAYS USE A STRING AS ID"), ("placeholder", "{chat_history}"), ("human", "{input}"), ("placeholder", "{agent_scratchpad}"), ]), ) self.executor = AgentExecutor(agent=self.agent, tools=self.tools, memory=self.agent_memory, verbose=True) def myinvoke(self, input: str): result = self.executor.invoke({"input": input}) print(result) print("\n==================================================") print("--> Agent Response:") print(result['output']) print("\n==================================================") def try_except_tool(self, func): try: return func except ToolException as e: print(f"Error: {e}") def enhance_agent_tools(self, agent_tools: List): enhanced_agent_tools = [ StructuredTool( name=tool.name, description=tool.description, args_schema=tool.args_schema, func=self.try_except_tool(tool.func), handle_tool_error=True, handle_validation_error=True ) for tool in agent_tools ] return enhanced_agent_tools ```
Steps to Reproduce
Configured the ComposioToolSet with the API key. Attempted to execute the following action:
Expected Result
The action should return details about the Spaces in the ClickUp Workspace
Actual Result
Environments
Env 1
Python version: 3.12.4 composio_langchain version: 0.3.28 Operating System: macOS Sonoma 14.5
Env 2
Python version: 3.11.7 composio_langchain version: 0.3.28 Operating System: Windows 11
Additional information
It seems that although the argument is being passed correctly by the agent, somewhere along the way the id is being read as a
float
, when it should be aninteger
. I actually checked that the function associated with the tool indeed takes afloat
as its input, but that doesn't seem to be the correct data type for making the call to the ClickUp API.Code
Output
I appreciate any help or guidance on how to resolve this issue.