Agent deletes existing code while making small edits

When I ask the agent to make a small change in an existing file, it sometimes deletes unrelated parts of the file instead of applying a minimal edit. This seems to happen mostly in Python files.

For example, I may ask it to add a few lines or update a single function, but the generated diff shows large sections of existing code being removed. This happens even when the requested change is very small.

Expected behavior is that the agent should preserve the existing file content and only modify the relevant part. It should not delete unrelated code unless I explicitly ask for that.

Actual behavior is that the agent sometimes rewrites or removes large blocks of code, especially in Python files, which makes the diff unsafe to accept and risks losing working code.

This issue makes file editing unreliable because even simple changes can result in unexpected deletions

Which model(s) are you using when this happens?

Hi @erdem_inaga ,

Thank you for reporting the issue.
To help us investigate, could you please share the below details:

  • Which Antigravity version you’re using?
  • Which model/agent you selected?
  • An example of the prompt you used
  • The before/after diff (or screenshot) showing the unexpected deletions