agentic loop example