From LLM Reasoning to Autonomous AI Agents: A Comprehensive Review