How to debug a PEngines instance?

I’m using: SWI-Prolog version 8.0.2 on UBuntu Linux 18.04.

I want to debug the code I pass to my PEngines instance via the src_text parameter. To that end I included these directives at the bottom of the code I pass via the src_textparameter:

:- gtrace.
:- trace.
:- tspy(pengine_execute_single_user_action/3).

After a long delay of 10 to 20 seconds of not getting a response from my PEngines instance (usually the response is immediate), I got a series of response box indicating that every one of those directives triggered a sandbox permission error.

How can I debug my code running in a PEngines instance? I usually load the code into the console, outside of PEngines, and just debug there. But I am finally getting an error that only occurs when the code is running in PEngines and I don’t get the error when running in the console.