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.

4 min readSume
All posts

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.

Sume gate fields, from the MCP docs read 2026-09-30
FieldRequired?Meaning in the docs
idempotency_keyRequired on write and paid toolsStable key for transport/dedup, not human approval
dry_run=trueOptionalAdmission/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

All Developers posts

Written by Sume