An Empirical Study on LLM-based Agents for Automated Bug Fixing