def python_repl_tool(
        code: Annotated[
            str, "The python code to execute to generate your chart."
        ],
    ):
        """Use this to execute python code. If you want to see the output of a value,
        you should print it out with `print(...)`. This is visible to the user."""

        import matplotlib.pyplot as plt
        import uuid
        import os
        plot_path = None
        try:
            result = repl.run(code)
            # Try to save the current matplotlib figure if one exists
            fig = plt.gcf()
            if fig.get_axes():
                images_dir = "images"
                os.makedirs(images_dir, exist_ok=True)
                plot_path = os.path.join(images_dir, f"chart_{uuid.uuid4().hex}.png")
                fig.savefig(plot_path)
                plt.close(fig)
        except BaseException as e:
            return f"Failed to execute. Error: {repr(e)}"
        result_str = (
            f"Successfully executed:\n```python\n{code}\n```\nStdout: {result}"
        )
        return (
            result_str
            + "\n\nIf you have completed all tasks, respond with FINAL ANSWER."
        )
Use this to execute python code. If you want to see the output of a value,
        you should print it out with `print(...)`. This is visible to the user.
examples/expositional/use_cases/snowflake-ai-stack-agentic-eval/src/graph.py