Fixed tests and refactor for remote agents concept