Background processing for a rule-based system (and sideboxing)

Pointers:

IMO either use an embedded script engine (like GitHub - rvirding/luerl: Lua in Erlang · GitHub), or have a separate small machine to which you delegate possibly unsafe external code.

Somebody used a pretty cheap setup to achieve something similar: How to setup an Elixir sandbox for a nerves project in 2 simple steps with Nanobox