PRIMS: Secure Python Code Execution for LLM Agents