'Create an ``AgentLoopService`` instance.
:param reactor: The reactor to give to the service so it can schedule
timed events and make network connections.
:param AgentOptions options: The command-line options to use to
configure the loop and the loop\'s deployer.
:param context_factory: TLS context factory to pass to service.
:param NodeCredential node_credential: The node credential.
:return: The ``AgentLoopService`` instance.'

def get_service(self, reactor, options):

    configuration = get_configuration(options)
    host = configuration['control-service']['hostname']
    port = configuration['control-service']['port']
    ip = self.get_external_ip(host, port)
    tls_info = _context_factory_and_credential(options['agent-config'].parent(), host, port)
    return AgentLoopService(reactor=reactor, deployer=self.deployer_factory(node_uuid=tls_info.node_credential.uuid, hostname=ip, cluster_uuid=tls_info.node_credential.cluster_uuid), host=host, port=port, context_factory=tls_info.context_factory, era=get_era())
