Computational Logic Foundations of KGP Agents