from smolagents import tool @tool def python(code: str) -> str: """ Evaluates a math expression using sandboxed eval. Args: code (str): A simple Python expression to evaluate. Returns: str: The result of the evaluation or error message. """ try: result = str(eval(code, {"__builtins__": {}})) return f"Answer: {result}" except Exception as e: return f"Error: {str(e)}"