All agents I know of have a hook system that can call arbitrary scripts.