fix: stop leaking parent kwargs to managed agents in from_dict#2318
Open
sharziki wants to merge 1 commit into
Open
fix: stop leaking parent kwargs to managed agents in from_dict#2318sharziki wants to merge 1 commit into
sharziki wants to merge 1 commit into
Conversation
`MultiStepAgent.from_dict()` forwarded the caller's `**kwargs` to every managed agent's `from_dict()`. This caused parent-level overrides (e.g. `max_steps=30`) to silently replace the child's serialized values, breaking round-trip fidelity. Remove `**kwargs` from the recursive `from_dict()` call so each managed agent reconstructs itself from its own serialized config only. Closes huggingface#1849
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #1849
MultiStepAgent.from_dict()forwarded the caller's**kwargsto every managed agent'sfrom_dict(). This caused parent-level overrides (e.g.max_steps=30) to silently replace the child's serialized values, breaking round-trip fidelity.Changes
src/smolagents/agents.py: Remove**kwargsfrom the recursivefrom_dict()call at line 1043, so each managed agent reconstructs itself from its own serialized config onlytests/test_agents.py: Addtest_from_dict_does_not_leak_parent_kwargs_to_managed_agents— verifies childmax_stepsstays at 5 when parent is overridden to 30