agents split in separate files, common code

Getting rid of the big agents.coffee file and moved shared code with socket_channels into separate file.