Failure based on keyword in output

I don’t really see a good, or simple way, of determining an action as a failure based on output keywords. Our current platform we use that StackStorm is replacing has the ability to scan the output for a keyword.

The closest thing I could think of is something in a workflow like when: <% 'keyword' in result().stdout %> or something similar.