Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] MultiStepAgent silently overwrites parameter-provided FinalAnswerTool #759

Closed
crcdng opened this issue Feb 23, 2025 · 2 comments · Fixed by #783
Closed

[BUG] MultiStepAgent silently overwrites parameter-provided FinalAnswerTool #759

crcdng opened this issue Feb 23, 2025 · 2 comments · Fixed by #783
Assignees
Labels
bug Something isn't working

Comments

@crcdng
Copy link

crcdng commented Feb 23, 2025

Describe the bug
MultiStepAgent silently overwrites the parameter-provided FinalAnswerTool.

The agent receives a list of tools trough its constructor, which may include a 'FinalAnswerTool' that terminates the Thought-Action-Observation cycle of the agent.

However agent.py, in line 255 silently overrides a user-provided FinalAnswerTool by instantiating the default implementation.

self.tools["final_answer"] = FinalAnswerTool()

This behavior violates the Principle of Least Surprise and can lead to hard to track bugs. It also creates a hard dependency on the library-povided FinalAnswerTool class and makes it impossible to provide a modified FinalAnswerTool by a user of the API.

Release v. 1.9.2

Additional context
Originally reported by user Julien in the huggingface Discord.

@crcdng crcdng added the bug Something isn't working label Feb 23, 2025
@Knight7561
Copy link

I guess #769 would fix this?

@albertvillanova
Copy link
Member

Thanks for raising this issue, @crcdng.

And thanks @Knight7561 for pointing to #769 PR.

I guess that PR partially solves the issue, because it allows to customize "final_answer" after instantiation. Maybe we should also support customize "final_answer" at instantiation, as we already do with the rest of the tools.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants