Added broker to agent communication

Added broker to agent communication. Agents now register with the
broker in a process that checks whether both upstream and downstream is
working successfully.