Dev.to
7/20/2026

The smolagents bug that made my agent retry the same valid code three times
Short summary
A developer fuzzed smolagents' LocalPythonExecutor sandbox and found that dict unpacking syntax ({**dict}) caused a misleading 'NoneType is not supported' error because the AST uses None as a spread marker, not an expression. The agent would retry identical valid code up to three times, burning LLM calls and step budget. The fix evaluates dict entries pairwise, treating None keys as merge signals, matching CPython semantics exactly.
- •smolagents sandbox rejected valid dict unpacking syntax with a misleading NoneType error
- •The bug caused agents to retry identical code in a loop, wasting LLM calls and steps
- •Fix evaluates AST dict keys pairwise, treating None as a spread marker for merging
Generated with AI, which can make mistakes.
Is this a good recommendation for you?


