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 realistic 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, read each post as raw block markup and replacethe image block that uses the old URL with one that uses the new WebP URL andattachment id, sending exactly one block and passing its path and core/image as theexpected block name. Work in small batches and show me each batch with the oldimage block beside the new one before it saves. List any image that is not ina block, or whose block is not core/image, as skipped. 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 Replace block, which swaps a single image block in a post’s body and checks the block name at that path before it writes. The prompt asks for the old image block with each batch, so a swap can be put back. The post edits are recorded in the Changes tab and can be reverted there until a post is edited again. The uploads are not recorded, so a bad conversion leaves the new files in your library until you delete them yourself. 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 old block markup in the chat lets you put 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.