fix agents error when no tasks planned

fixes #2366