agentic retry logic