Smolagents sandbox bug caused agents to retry valid Python code in endless loop

A developer discovered a bug in smolagents' LocalPythonExecutor sandbox where valid Python dict unpacking syntax using ** caused repeated failures with a misleading error message. The sandbox incorrectly tried to evaluate the None key used internally by Python's AST to signal a spread operation, triggering an 'InterpreterError: NoneType is not supported' message even though the model's code contained no None values. Because the error message pointed to a nonexistent problem, the AI agent could not correct its code and retried the identical valid syntax multiple times, wasting LLM calls and step budget. The root cause was that the executor walked dictionary keys blindly without checking for None spread markers before calling evaluate_ast. The fix involved processing key-value pairs together, treating a None key as an instruction to merge a mapping rather than as an expression to evaluate.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in