The Vercel AI SDK adapter (@deedglass/sdk/ai-sdk)
Tested with ai 7.0.127 (2026-10-04) using AI SDK’s own MockLanguageModelV4; the peer range is
ai >=7 <8.
import { generateText } from 'ai';import { Deedglass } from '@deedglass/sdk';import { governTools, deedglassTools } from '@deedglass/sdk/ai-sdk';
const dg = new Deedglass();const tools = governTools({ refund_customer, send_report }, { client: dg, connector: 'billing' });const connectorTools = await deedglassTools(dg, { include: ['stripe.*'] });await generateText({ model, tools: { ...tools, ...connectorTools }, prompt });governTools(tools, options)(proxy mode): each tool’sexecuteruns only after Deedglass authorizes the call, recorded as<connector>.<name>(connectordefaults toapp;namesmaps one tool to any Deedglass name). Tools withoutexecuteare left alone, with a warning. TheabortSignalpasses through.deedglassTools(client)(gateway mode): the org’s connector tools fromGET /v1/tools, namedstripe__create_refund, with their JSON Schema (jsonSchema(...)), run by Deedglass with the connector’s credentials, which never leave it.- Pending and denied: by default the model reads the sentence (
Blocked by policy "no-deletes": Agents never delete customers. Nothing was run., orWaiting for approval in Console › Approvals (apr_…). Try again after someone decides., the same sentence the Python SDK writes), and the run continues.onDenied: 'throw',onPending: 'throw' | 'wait'change that.onActionsees every decided action. - AI SDK’s
toolApprovaland Deedglass’s approvals are different people:toolApprovalasks the chat user in your UI; a Deedglass rule asks the org’s approvers (Console, email, Slack) and seals their answer. Use both when a call needs both.