Integrations
Loading
Loading
Integrations
Vercel AI SDK handles streaming and model access. Loop Engine governs when and whether model-requested tool actions are authorized. Use Vercel AI SDK for model execution; use Loop Engine for guard enforcement, actor attribution, and audit trails.
Install
1npm install @loop-engine/adapter-vercel-ai aiWrap a tool with governance
1import { streamText, tool } from "ai";2import { wrapTool } from "@loop-engine/adapter-vercel-ai";3 4const submitPurchaseOrder = wrapTool(5 tool({6 description: "Submit purchase order",7 parameters: z.object({ vendor: z.string(), amount: z.number() }),8 execute: async ({ vendor, amount }) => ({ orderId: "PO-0042", vendor, amount })9 }),10 {11 loopDefinition: purchaseOrderLoop,12 engine,13 requiresApproval: ({ amount }) => amount > 500014 }15);Run with streaming
1await streamText({2 model: openai("gpt-4o"),3 tools: { submitPurchaseOrder },4 prompt: "Submit a PO to Acme Medical for $9,200"5});