Docs

OpenAI (TypeScript)

Wrap the OpenAI SDK with Iqrar's three-line drop-in — every chat completion, tool call, and assistant run is instrumented automatically.

bun add @iqrar/agent
import OpenAI from "openai";
import { Iqrar } from "@iqrar/agent";

const iqrar = Iqrar({
  org: "acme",
  jurisdiction: "EU",
  endpoint: process.env.IQRAR_API,
  agentId: "support-bot-prod",
  capabilities: ["consumer_chatbot"],
});

const openai = iqrar.wrap(new OpenAI());

// Every method on `openai` now emits agent.invocation.start/.end events.
const completion = await openai.chat.completions.create({
  model: "gpt-4o",
  messages: [{ role: "user", content: "hello" }],
});

wrap() returns the same type you pass in — your call sites need no changes.

Assistants API

The same wrapper instruments openai.beta.threads.runs.create(...) and the polling lifecycle. For richer telemetry on the run/step level, use iqrar.observe(...) around your run.poll() loop and emit decision() calls when the assistant returns a final answer.

See also

  • · · ·
  • Python:
© 2026 Cortex Innovations (Pty) Ltd. Iqrar is a working name pending trademark clearance.Powered by Stratafy