The agent specifies what function, class, method etc to replace, along with its full source. It's more costly, but I believe it leads to fewer hallucinations as it is generating a coherent piece of code.
But it requires parsing AST and language specific instructions. And things like metaprogramming or macros could cause some hairy confusion.
All of these factors don't hurt my use case.