Refactoring agent services.