Serialize Agent tasks

It would be good for these to actually return errors now (transitively from unitmanager)