WebP images are usually a good deal smaller than the JPEG or PNG they replace, which is why people want to convert a page full of heavy photos. The honest version of this job with a governed agent is not a magic optimizer button. The agent re-encodes each image you point it at, uploads the result as a new WebP attachment, and then updates the places in your content that referenced the old file. It is deliberate and batch by batch, and you approve the swaps before any post changes.
Because this both adds to the library and edits post bodies, it earns the two-pass, wait-for-approval flow.
I want to convert [the images in these three posts] to WebP and update theposts to use them. Be clear with me about scope: I know this re-encodes andre-uploads each image and swaps the reference, it is not a server-side bulkoptimizer of my existing files.
First pass, change nothing that I have not approved: list the images in scope,tell me which are worth converting, and for each planned swap show me the oldURL and the post it appears in. Then re-encode those images to WebP and uploadeach as a new attachment.
Only after I approve a batch, run the find-and-replace on those post bodies topoint them at the new WebP, in small batches, showing me each batch before itsaves. Do not delete the original attachments. At the end, give me the newattachment ids and the list of every post you edited.Why this is safe to run
The planning is all reads and additive uploads. Listing the images and finding the posts that reference them writes nothing to your content, and uploading a new WebP adds an attachment without altering the original. So you get to see every planned reference swap before a post body changes.
The one ability that edits your content is a literal find-and-replace inside a post’s body. It never changes a post’s status, never publishes or unpublishes, and its edits are reversible through the post’s revisions. The upload ability takes base64 image data and accepts jpg, png, gif, and webp while rejecting SVG, so the agent cannot slip an unexpected file type into the library. Every ability here stays off until you enable it, each call is checked against the capability of the user you bound the agent to, and every upload and every post edit lands in the Activity Log. If a swap looks wrong, the log points you at the exact post, and the revision lets you roll it back.
Already connected? You do not have to paste this at all. Ask your agent for the “convert images to WebP and swap references” recipe, describe the set, and it runs the same approve-first flow on your own site.