Issue #2316757: Function to load agents by type is totally broken