Lots of changes around agent configuration and uploading agent code