How do you handle situations where an autonomous agent gets stuck in a loop or hallucinates a tool input in a CORAS agent workflow?