I'm leaning toward Jason Grout's view that this should be changed to also return a hash and the question needs
to manually extract $result->{stdout} to get its answer.  That way askSage would always returns a hash
regardless of the contents of its input and the has would always have keys   webwork, success and stdout  

This version currently works with both old and new questions as long as they provide accepted_tos=>'true'.  The error warning that you have not accepted TOS is not perfect because it comes at the bottom of the page -- but that is part of a larger issue in handling exceptions in PG.  I think that needs to be handled later.