Signed decision evidence for Vercel AI SDK.
Attach LoopGrid through AI SDK 7's native Telemetry integration surface. AI SDK keeps running the model and tools; your application owns authority, policy, human approval and the real downstream outcome; LoopGrid preserves and independently verifies the evidence.
loopgrid-vercel-ai-sdk v0.1.0 · validated with ai 7.0.122 · Node.js 22 / 24 · LoopGrid Core 0.8.1-design-partner.
Telemetry observes; it does not authorize. AI SDK's approval mechanism remains framework-owned, while reviewer identity and business outcome are recorded explicitly by the application.
Install the native Vercel AI SDK integration.
npm install loopgrid-vercel-ai-sdk ai
Version 0.1.0 is public on npm. The integration depends on @cybertechsoft/loopgrid and targets AI SDK 7 on Node.js 22 or newer. npm Trusted Publishing is configured for future releases.
Bind one consequential decision to one AI SDK call.
import { generateText } from 'ai';
import { LoopGridAISDK } from 'loopgrid-vercel-ai-sdk';
const loopgrid = new LoopGridAISDK({
baseUrl: 'http://127.0.0.1:8000',
workspaceId: 'default',
});
const { decisionId } = await loopgrid.startDecision({
decisionType: 'customer_refund',
agent: { id: 'refund-agent', version: '1.0.0' },
authority: { acting_for: 'Support', scope: ['refund:create'] },
model: { provider: 'configured-provider', name: 'configured-model' },
context: { prompt_version: 'refund-v3' },
proposedAction: { tool: 'refund', amount: 25, currency: 'USD' },
policy: {
policy_id: 'refund-policy',
version: '3',
decision: 'auto_allowed',
},
});
const result = await generateText({
model,
prompt,
tools,
telemetry: loopgrid.telemetryOptions(decisionId, {
functionId: 'refund-agent',
}),
});
await loopgrid.flush(decisionId);
loopgrid.assertHealthy();
// Application-owned fact observed from the downstream system:
await loopgrid.recordOutcome(decisionId, {
status: 'settled',
external_id: 'refund_123',
});The telemetry object is decision-scoped instead of relying on a global mutable “current decision” value, so concurrent AI SDK calls remain isolated.
Use AI SDK Telemetry instead of wrapping generateText().
startDecision() records agent identity, delegated authority, model/context provenance and the proposed consequential action from explicit application input.
onLanguageModelCallEnd records model_completed with privacy-safe content commitments by default.
onToolExecutionStart records tool_requested before the tool execution evidence arrives.
onToolExecutionEnd records tool_executed on success or tool_result for an error instead of inventing a successful outcome.
recordHumanReview() records explicit reviewer identity and approval/rejection only when the application supplies it.
recordOutcome() appends outcome_observed after the application observes the authoritative downstream result.
AI SDK owns approval mechanics. LoopGrid preserves the evidence.
AI SDK requests approval → tool has not executed application records explicit reviewer → loopgrid.recordHumanReview(...) → human_approved AI SDK resumes approved tool → tool_requested → tool_executed application observes downstream result → loopgrid.recordOutcome(...) → outcome_observed → evidence_complete → verify valid:true
LoopGrid does not infer delegated authority from tool availability, infer policy from AI SDK approval configuration, infer reviewer identity from an approval response, or treat a successful tool callback as proof of the final business outcome. Telemetry callbacks are observational rather than a policy-enforcement boundary.
Commit to model/tool content without storing it by default.
captureContent = false by default. The integration stores SHA-256 commitments for model content, provider metadata, tool inputs, results and errors while omitting raw content unless explicitly enabled.AI SDK telemetry inputs and outputs also default to disabled. A dedicated regression test against ai@7.0.122 verifies that context excluded by telemetry allowlists is not exposed on the diagnostics tracing channel. Transport failures are retained and surfaced through flush() and assertHealthy(); applications that require evidence before execution should enforce that requirement in their own control logic.
Validated through the actual AI SDK runtime and a real LoopGrid Core E2E.
MockLanguageModelV4 tool-call flow on ai@7.0.122evidence_completevalid: true with no failuresloopgrid-vercel-ai-sdk@0.1.0 clean-installed from npm and runtime-import validatedv0.1.0; Trusted Publisher configured for future npm releasesThe release E2Es used a deterministic AI SDK test model and sandbox action, so no model API key or real-money movement was required. Verification establishes the integrity/provenance of captured evidence; it does not prove that the underlying decision was correct, that every upstream statement was true, or that the system is legally compliant.
Keep AI SDK native. Make the evidence portable.
Install the npm package, bind native decision-scoped telemetry, and preserve consequential agent evidence without replacing the Vercel AI SDK runtime.