Move executor type validation to python executor creation by Lrakotoson · Pull Request #1800 · huggingface/smolagents (original) (raw)

Fix proposition for #1799

Moves the executor type validation logic from the CodeAgent.__init__ method to the create_python_executor method.
This small refactor enables users to subclass CodeAgent, implement custom executors without triggering a ValueError during initialization and keeps backward compatibility and existing validation logic for built-in executors.

If appropriate please feel free to make changes directly.

Tested with local, docker and 2 other custom remote executor.