Edit Artifact Files
artifact-editChange the files of an EXISTING artifact and commit them, without git or a shell. Never creates a new artifact — the sessionId keeps pointing at the same one, and its playground URL does not change. If a Canvas draft exists, this refuses unless acknowledgeCanvasDraftRevision matches the draft you reviewed and the user explicitly chose to edit committed files. It does not edit, promote or discard the draft. All the changes you pass land as ONE commit: either every operation applies or none does. Read the files first with artifact-explore and pass the revision it returned as baseRevision; if someone else changed the artifact meanwhile the edit is rejected with REVISION_CONFLICT, which lists what changed so you can re-read those files and retry. Prefer op "str_replace" for edits to existing files (send the exact snippet), "write" to create a file or replace one wholesale, "delete", and "move" to rename. move does NOT rewrite imports — neither in the files that import the moved module, nor the relative imports INSIDE the moved file, which now resolve from its new folder, so read it first and add the str_replace operations that fix them. The live preview updates from the new commit immediately. To rename an artifact or change its visibility use artifact-update_metadata; for very large repositories or full git workflows (branches, history rewriting) use artifact-get_git_token.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| changes | Yes | Up to 20 operations, applied IN ORDER and committed together as one commit. Each path resolves against the result of the operations before it, so a str_replace listed after a move of the same file must use the new path. | |
| sessionId | Yes | The artifact session id — the last path segment of the artifact URL (e.g. "mr25vsjppVtbMx" from https://app.agentgrid.io/artifacts/mr25vsjppVtbMx), or the id from artifact-create. | |
| baseRevision | Yes | The full commit id from your most recent artifact-explore response — exact, not "HEAD" or an abbreviation, since it is what the edit is checked against. If the artifact has changed since, the edit is rejected with REVISION_CONFLICT instead of overwriting the other change. | |
| commitMessage | Yes | Commit message describing the change, e.g. "Change pill color to blue". Keep the first line short. Plain text only: do not add attribution trailers (Co-Authored-By, Agent-Id, Anima-Actor-*) — the server stamps those itself and rejects the edit if the message contains them. | |
| acknowledgeCanvasDraftRevision | No | Only after explicitly choosing to edit committed files despite a Canvas draft: pass the draft revision reported by artifact-explore. A draft based on the previous head is superseded by this commit. This does not edit or promote it. |