agent and debug agent modif to seek proper agent behavior