In the search backend, is needed to send the object of the acp module to execute certain actions, so the search backend depends on the acp module that executes it. This makes they cannot be reused in other things like execute it as a command without having to hardcode things.
I think the solution would be something like to make the search backend methods to return the current status of the action as an array or something each time they are executed, so who executes it handles how to act (continue or not), instead of the search backend.
I think the result of the solution could be something like this:
And from the command line