Split agent stuffs

@ekohl @Dominic proposal to split out agent stuffs from main and start refactoring.