agentic ai refactoring