Run an Image Action
An Image Action is an exact raster change that Gavana computes itself, with no AI model involved: resize, crop, remove a flat background, change the aspect ratio, put two images side by side, add text, overlay a logo, colour-grade, or rotate. The source image is never changed. The result appears as a new image node on the same canvas.
What it costs. Every Action an agent can run reports deterministic: true and chargedCost: 0. Nothing goes to an AI provider and no credits are spent, so the current-turn approval rule for paid work does not apply.
What it still does. It writes to the canvas, adding a node, an asset, and reference connections, so run it only because the user asked for this change. While it is queued or running it also counts toward the account’s limit on active image and Action jobs, which is four by default.
The hosted MCP server (https://app.gavana.ai/mcp) does not offer Actions. action_list, action_get, and action_run exist only on the local MCP server, and actions is not a toolset a hosted connection can select. Run Actions through the local MCP server, the CLI, or the API. A hosted connection with job:manage can still see Action Runs started elsewhere through list_image_runs.
Scopes. Listing and reading Actions: canvas:read. Running one: canvas:read, canvas:write, asset:read. No generation scope is needed. Add job:manage to wait for the result, which is the default. Add image:generate or video:generate only when an input is a local file, stdin, or the clipboard, because that input is uploaded first.
The Actions
These are the nine Actions an agent token can see. Treat this table as a map. action get is the authoritative schema, so read it before every run.
| Action | Inputs, in order | Parameters (required) |
|---|---|---|
action:resize | image | width, height (1–8192 px), fit (cover · contain · fill · inside · outside), background |
action:crop | image | x, y (default 0), width, height |
action:remove-background | image | tolerance (0–255, default 32) |
action:change-aspect-ratio | image | ratio (1:1 · 4:5 · 3:4 · 16:9 · 9:16), mode (crop · pad), background |
action:side-by-side-composite | first, second | direction (horizontal · vertical), gap (0–512), background |
action:add-text-to-image | image | text (up to 500 characters), fontSize, position (top · center · bottom · custom), align, offsetX, offsetY, color, background, padding |
action:overlay-image | base, overlay | position (top-left · top-right · center · bottom-left · bottom-right), scale (0.05–1 of the base width), opacity, margin |
action:color-grade | image | brightness, saturation, hue (−180 to 180), contrast |
action:rotate | image | angle (90 · 180 · 270, clockwise), background |
Colour parameters take transparent, #RRGGBB, or #RRGGBBAA. Every optional parameter has a default, and action get shows it. print-size and the AI upscale are canvas-only: agent tokens never see them, and asking for one returns “Image Action was not found.”
Call sequence
canvas get → action list → action get → action run → (run wait) → report node: and asset: handlesOn the local MCP server the same sequence is canvas_get → action_list → action_get → action_run. action_run waits by default, so you need run_wait only if you queued with wait: false.
Steps
Find the Action
gavana action list --jq '.actions[].id' -r
gavana action list textThe optional query matches the slug, title, and summary. --limit is 1–100; continue with --cursor from page.nextCursor. Local MCP: action_list with optional query, limit, and cursor.
Check. You have one exact action: id. If the user’s wording fits two Actions (crop or change aspect ratio, say), ask which one they mean.
Read its schema
gavana action get action:add-text-to-image --prettyLocal MCP: action_get with actionId: "action:add-text-to-image".
Check three things:
inputs. How many images the Action takes, and in what order.side-by-side-compositeplacesfirstand thensecond;overlay-imagetakes thebaseand then theoverlay. Order is meaning.parameters. Eachid, itstype(number,select,text, orcolor),required,default,min/max/step, andoptions. A required parameter with no default must be supplied.chargedCost: 0anddeterministic: true. This confirms the Action spends nothing.
Choose the input images
Read the destination canvas first, and take input handles from what that read returned:
| Input value | What it is | Extra scope |
|---|---|---|
node:<id> | An image node already on the canvas | None |
asset:<id>, or asset:<ownerUid>:<id> for a shared asset | An uploaded image, or an earlier result | None |
A local path, - for stdin, or clipboard on macOS | CLI only. Uploaded privately into the destination canvas, then used by its new asset: handle | image:generate or video:generate |
Local files must be PNG, JPEG, WebP, or GIF, at most 50 MB each. The CLI checks the file’s bytes, not its extension. The server also refuses inputs that add up to more than 80 MB.
Local MCP action_run accepts only node: and asset: handles. To use a file the user gave you, upload it first with asset_upload (filePath, plus canvasId to store it in the task canvas) and pass the asset: handle it returns. That upload needs the same generation scope.
Check. No input is the node you expect the result in. An Action never overwrites its inputs.
Run it once
gavana action run action:resize \
--input node:HERO_IMAGE \
--destination canvas:OWNER_UID:CANVAS_ID \
--width 1080 --height 1350 --fit contain \
--idempotency-key resize-hero-1080x1350-a \
--progressEach declared parameter becomes a kebab-case flag: fontSize becomes --font-size and offsetX becomes --offset-x. You can also pass --param NAME=VALUE, repeated as needed. Give one --input per declared input, in order. The CLI checks the count before sending anything.
gavana action run action:overlay-image \
--input node:PRODUCT_SHOT \
--input asset:LOGO_ASSET \
--destination "$TASK_CANVAS" \
--param position=bottom-right --param scale=0.2 \
--idempotency-key logo-on-product-aAlways pass --idempotency-key (8–200 characters). If you leave it out, the CLI generates a random one, so a retry after a dropped connection becomes a second run with a second result node instead of a replay of the first.
Local MCP: call action_run:
{
"actionId": "action:add-text-to-image",
"destination": "canvas:OWNER_UID:CANVAS_ID",
"inputs": ["node:HERO_IMAGE"],
"params": { "text": "Summer sale", "position": "top", "fontSize": 96 },
"idempotencyKey": "hero-headline-summer-a"
}idempotencyKey is required here. destination (or canvasId) is required. Optional fields are targetNodeId, baseRevision, wait (default true), and timeoutSeconds (default 900, at most 3,600).
Destination. Use your task canvas handle. new-canvas also works, but it needs --canvas-title (canvasTitle over MCP). The retired agent-canvas fails before anything is sent.
Where the result goes. By default the CLI and the local MCP tool create one empty image node titled after the Action, such as “Resize result” (change it with --title). The node goes in free space so it does not cover existing work. The node’s identity comes from the idempotency key, so a retry with the same key reuses it. To write into a node you have already placed, pass --target node:<id> (targetNodeId). That node must be an empty image node.
Wait, or hand off
An Action is asynchronous: starting it queues a Run, and the schema’s estimatedSeconds is 2. The CLI waits up to 15 minutes by default, polling every 1.5 seconds; change that with --timeout and --interval. --progress writes each state change to stderr as JSON and keeps stdout clean. action_run waits by default too.
To hand off instead, pass --no-wait (or wait: false). You get the run: handle at once. Resume later:
gavana run wait run:RUN_ID --output markdownOver the local MCP server, call run_wait with runId.
Waiting needs job:manage. Without it, start with --no-wait / wait: false. If you don’t, the Action is queued and then the wait fails with a missing-permission error (CLI exit 3). The Action still finishes. On the CLI, a token without job:manage can pass --no-wait --webhook-url URL to get one signed callback instead. The secret comes from GAVANA_WEBHOOK_SECRET, or from the variable you name with --webhook-secret-env. Callbacks need an Agent Access token, and webhooks are not available over MCP.
Read the result and report
The terminal Run carries status, images[] with each image’s nodeId and assetId, canvasId, canvasRevision, and canvasUrl. The CLI and the local MCP tool add a destination object: requested, canvasId, and targetNodeIds.
On the canvas you now have:
- The result image node, filled with the transformed picture.
- A reference connection from each input to the result. An
asset:input that was not already on the canvas appears as aReference — <name>image node. - Your inputs, unchanged.
Report images[].nodeId and images[].assetId, plus canvasUrl for a person to review. The run: handle is a temporary observation record: it lasts 24 hours, or 15 minutes after the result is first finalized. The node: and asset: handles are durable.
Check. status is succeeded. Re-running the identical request with the same key does not start a second Run: Gavana returns the original, and the start response is marked replayed: true.
Over the API
The CLI and local MCP tool do two things for you that a direct API caller must do itself: create the empty target node, and send the matching baseRevision.
GET /canvases/{canvasId}to read the canvas and its revision.- Create one empty image node with a
node.createoperation throughPOST /canvases/{canvasId}/operations(see Batch edits). Keep itsnode:handle and the revision the write returns. POST /actions/{actionKey}/runs.actionKeyis the slug or theaction:id. The response is202, with arun:handle.GET /runs/{runId}(job:manage) until the status is terminal, or supply awebhook(urlplus a 32–512 charactersecret) in step 3.
gavana api POST /actions/rotate/runs --json '{
"canvasId": "canvas:OWNER_UID:CANVAS_ID",
"baseRevision": "REVISION_AFTER_STEP_2",
"idempotencyKey": "rotate-hero-90-a",
"targetNodeId": "node:EMPTY_IMAGE_NODE",
"inputs": ["node:HERO_IMAGE"],
"params": { "angle": 90 }
}'gavana api sends exactly what you give it. baseRevision must equal the canvas’s current revision, and inputs must already be node: or asset: handles. To use a local file, upload it first with POST /assets.
What you end up with
- A terminal Run with
status: "succeeded" - A durable
node:handle for the result image node and a durableasset:handle for the stored image - A new canvas revision, with the inputs untouched and connected to the result
- No AI credits spent
When it fails
| What you see | Why | What to do |
|---|---|---|
CLI exit 2: “Resize requires exactly 1 —input value in the order shown by action get.” | Wrong number of --input values | Read action get and match its inputs |
input_validation_error: “Unknown Add text parameter: …” | A parameter the Action does not declare | Use only the ids from action get |
input_validation_error: “Invalid Resize parameters.”, with fields such as params.width “Width is required.” | A required parameter is missing, out of range, or off its step | Fix the value. The CLI ignores a misspelled flag, so a typo shows up here as a missing parameter |
“Image Action was not found.”: not_found (CLI exit 5) from the CLI or action_get, input_validation_error from the run endpoint | The id is not one of the nine, for example print-size or upscale | Pick an id from action list |
input_validation_error: “Image Action inputs must use valid node: or asset: handles.” | A file path or URL sent to the API or to action_run | Upload it first and pass the asset: handle |
forbidden, CLI exit 3: “This agent token is missing required permissions: …” | The token lacks a scope listed above | Ask for a token with that scope |
conflict, CLI exit 4: “This idempotency key was already used for a different image or Action request. Use a new key for new intended work.” | The same key with different inputs, parameters, or target | New intent, new key |
conflict: “The canvas changed after it was read. Read the latest revision before starting the image Action.” | A stale baseRevision on a direct API call | Read again, then send the current revision |
input_validation_error: “An Image Action cannot overwrite one of its input images.” or “Target node … is not empty.” | The target is an input, or already has content | Use a new, empty image node, or omit the target |
payload_too_large: “Image Action inputs exceed the 80 MB combined limit.” | The inputs are too big together | Resize or crop them in separate runs first |
rate_limited: “This account already has 4 active image or Action jobs, which is the limit of 4. …” | The account’s active-job limit is full. details.activeRuns names what holds it | Wait for one to finish, or cancel one with run cancel |
Run failed with failure.code: "action_input_invalid", retryable: false; CLI exit 9 | The Action could not process these inputs or settings | Change the input or parameters and use a new key. The same key returns the same failed Run |
Run failed with canvas_target_deleted, canvas_target_reassigned, or output_finalization_failed | The image was computed, but the result node was deleted, taken by other work, or could not be written | Read the canvas, then run again with a new key if the user still wants it |
CLI exit 8 | You stopped waiting; the Action did not stop | Resume with gavana run wait run:RUN_ID |
Actions are free, but a failure is still something to report rather than retry in a loop. Unchanged inputs fail the same way every time.