The difference, the one that is not working, is when the AI is not including the “sandbox:” type URL in its markdown link.
You could further instruct on using python in the way that it needs to be used, including making some examples of providing links for the unreasonable AI.