Vercel AI SDK
Instrument streamText, generateText, and tool execution from the Vercel AI SDK with Iqrar — works across every provider the SDK supports.
bun add @iqrar/agent
import { streamText } from "ai";
import { openai } from "@ai-sdk/openai";
import { Iqrar } from "@iqrar/agent";
const iqrar = Iqrar({
org: "acme",
jurisdiction: "EU",
endpoint: process.env.IQRAR_API,
agentId: "next-app",
capabilities: ["consumer_chatbot"],
});
const wrappedStreamText = iqrar.wrap(streamText);
const result = await wrappedStreamText({
model: openai("gpt-4o"),
messages,
tools,
});
For per-step telemetry, hook the SDK's onStepFinish callback and call iqrar.emit("agent.step", { ... }) from inside it. Token usage from result.usage lands in agent.invocation.end automatically.
See also
· ·