Skip to content

Conversation

@XXSg559
Copy link

@XXSg559 XXSg559 commented Nov 7, 2025

Description

Fixes #1849

This PR implements a whitelist mechanism to prevent parent agent parameters from overriding child agent configurations during deserialization.

Changes

  • Added SHARED_PARAMS whitelist containing only truly shared resources: model, verbosity_level, logger, executor_type, executor_kwargs
  • Modified MultiStepAgent.from_dict() to filter kwargs before passing to child agents
  • Agent-specific configs (like additional_authorized_imports, max_steps, etc.) now stay independent

Testing

Verified that child agents retain their custom additional_authorized_imports after from_dict().

Related Issue

None

@aymeric-roucher
Copy link
Collaborator

Thank you! Could you add regression tests for the added logic?

Verify that from_dict correctly propagates shared runtime parameters
(model, logger, executor_kwargs) from parent to child agents while
preserving child-specific configurations (authorized_imports, tools).

This test ensures the fix for issue huggingface#1849 works correctly.
@XXSg559
Copy link
Author

XXSg559 commented Nov 19, 2025

Thanks for reviewing!

This test verifies that the fix works correctly. It passes on my branch but fails on the main branch (as expected), confirming that the bug exists and the fix resolves it.

Test behavior:

  • On my branch: assert "sympy" in child_agent.authorized_imports passes
  • On main branch: This assertion would fail because child agents lose their authorized_imports during deserialization

@XXSg559
Copy link
Author

XXSg559 commented Nov 24, 2025

Sorry, my code has some gaps and doesn't cover every scenario.😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: MultiStepAgent.from_dict() passes **kwargs to managed agents, causing child agent configurations to be overridden

2 participants