Error calling custom tool - smolagents library
Created a custom tool using smolagents library:# Create custom tool 
@tool
def check_model_exists(model_name: str) -> str:
    """
    Tool to check if specific model exists in repository

    Args:
        model_name: The model to be searched for in the local repository
    """
    
    return "Model exists" #dummy returnWhen invoking this tool using agent.run(query), I get the error message:Error in tool call execution: check_model_exists() got an unexpected keyword argument ‘sanitize_inputs_outputs’You should only use this tool with a correct input.As a reminder, this tool’s description is the following:check_model_exists: Tool to check if specific model exists in ollama repositoryTakes inputs: {‘model_name’: {‘type’: ‘string’, ‘description’: ‘The model to be searched for in the local ollamarepository’}}Returns an output of type: stringHow can I resolve this? The library seems to be inserting ‘sanitize_inputs_outputs’ automatically
2025-01-06T01:25:17Z
Did you end up figuring this out? My previously working app has started throwing this error on delegation :\Error in calling team member: MultiStepAgent.run() got an unexpected keyword argument 'sanitize_inputs_outputs'
You should only ask this team member with a correct request.
As a reminder, this team member's description is the following:
<smolagents.agents.ManagedAgent object at 0x140350d90>
2025-01-06T02:47:40Z
No, it’s still giving this error, so I’ve left the library alone until it’s fixed
2025-01-06T03:16:26Z
It looks like there are no issues, so I wonder if it’s a problem with the code or a problem specific to the environment…GitHubIssues · huggingface/smolagents🤗 smolagents: a barebones library for agents. Agents write python code to call tools and orchestrate other agents. - Issues · huggingface/smolagents
2025-01-06T17:10:28Z
Added a pull request which addresses the issue:Don't pass sanitize_inputs_outputs=True to managed agents by grrowl · Pull Request #85 · huggingface/smolagents · GitHub
2025-01-06T17:41:22Z
@aamanlambdacould you provide more detail on your error?I tried:from smolagents import tool
@tool
def check_model_exists(model_name: str) -> str:
    """
    Tool to check if specific model exists in repository

    Args:
        model_name: The model to be searched for in the local repository
    """
    
    return "Model exists" #dummy return

from smolagents import tool, CodeAgent, HfApiModel
agent = CodeAgent(tools=[check_model_exists], model=HfApiModel(), add_base_tools=True)
agent.run("Does the model 'a' exist in repository?")it worked fine!
2025-01-16T03:39:37Z
i am having the same issue. i logged it and i am sending and receiving string so idk what the issue is. the function works inside my agent since it receives the stuff but smolagents acts like it failed so it doesnt execute the output from the function in my agent.