AI SDK addToolOutput clears approval: Sume idempotency_key
AI SDK 7.0.126 clears tool approvals when addToolOutput runs. If a paid Sume call replays, a stable idempotency_key is what guards the create.

ai@7.0.126 fixes a bug where tool approvals were not cleared when addToolOutput ran; they are now cleared. After an approval is cleared, a later step may ask again or call again. For a paid Sume tool, pass the same idempotency_key on every attempt of the same logical request, so a replay does not become a second paid job.
The release note is one line on the Vercel AI releases page. It does not describe your flow, so verify the replay behavior in your app. Sume behavior is from MCP tools and gates, read 2026-09-30.
What does Sume guarantee about idempotency_key?
The docs say it is required on write and paid tools and is a stable key for transport and dedup, not human approval. They do not spell out the exact dedup window in the gates table, so treat it as protection against retries, not as a permanent lock.
| Field | Required? | Meaning in the docs |
|---|---|---|
idempotency_key | Required on write and paid tools | Stable key for transport/dedup, not human approval |
dry_run=true | Optional | Admission/cost preview only; do not submit the job |
How should I generate the key?
Derive it from the tool call, not from the attempt. Store it with the tool call id when the model first proposes the call, then reuse it on any replay.
import { randomUUID } from "node:crypto";
const keys = new Map<string, string>();
export function keyFor(toolCallId: string): string {
let key = keys.get(toolCallId);
if (!key) {
key = randomUUID();
keys.set(toolCallId, key);
}
return key;
}What if the call already went through?
Read the job instead of creating again. The Jobs docs say to re-read with the same ids and never resubmit the paid create. dry_run=true is an optional admission/cost preview that does not submit the job, which is a safe thing to run on a replay you are unsure about.
Where else does a retry double-charge?
Any layer that retries a step: see Activepieces subflow retry and approval for paid video.
Sources
Related posts
More in Developers
- AI SDK SSE heartbeat vs Sume jobs_wait 55s slices
AI SDK 7.0.123 adds optional SSE heartbeats for idle UI streams. Sume's jobs_wait is capped at 55s per call, so you still repeat it with the same ids.
- Vercel function max duration 800s: Sume wait budget
Vercel Pro and Enterprise allow 800s, with 1800s in beta. Sume still caps a blocking wait at 30s, so video jobs need a poll loop with its own deadline.
- Vercel Queues retry can resubmit a paid Sume job
A Vercel Queues consumer that times out is redelivered, and maxDeliveries is unlimited by default. Reuse one Idempotency-Key per message so Sume bills once.
- Vercel rewrite to an external API times out at 120 seconds
Vercel proxied rewrites to an external destination time out at 120 seconds with ROUTER_EXTERNAL_TARGET_ERROR. A Sume async submit returns at once.
Written by Sume