Integrations
Pick the path that matches your stack. All snippets emit the same OTel-compatible gen_ai.* attributes so Sankey, SHAP ablation, and constitutional governance work identically across sources.
Python
Official audittrail-sdk for Python 3.10+. contextvars-based trace context, LangGraph + LangChain + OpenAI Agents SDK wrappers.
# Install
pip install audittrail-sdk
# Use
from audittrail import AuditTrailClient, traceable
audit = AuditTrailClient(
api_key="sk-at-<your-ingest-key>",
base_url="https://auditrail.imaginaerium.in",
)
@traceable(span_type="agent", name="research-agent")
async def run_agent(query: str) -> str:
...TypeScript / Node.js
@audittrail/sdk v1.1.0-alpha. AsyncLocalStorage context, wrapOpenAI / wrapAnthropic / LangChain-JS handler. Node ≥18.
// Install
npm install @audittrail/sdk
// Use
import { AuditTrailClient, wrapOpenAI } from "@audittrail/sdk";
import OpenAI from "openai";
const audit = new AuditTrailClient({
apiKey: process.env.AUDITTRAIL_API_KEY,
baseUrl: "https://auditrail.imaginaerium.in",
});
const openai = wrapOpenAI(new OpenAI(), audit);
await openai.chat.completions.create({ model: "gpt-4o", messages: [...] });
await audit.flush();LangChain.js + LangGraph-JS
Duck-typed CallbackHandler — works with @langchain/core ≥0.3 without bundling the runtime dep.
import { ChatOpenAI } from "@langchain/openai";
import { AuditTrailClient, AuditTrailCallbackHandler } from "@audittrail/sdk";
const audit = new AuditTrailClient();
const model = new ChatOpenAI({
callbacks: [new AuditTrailCallbackHandler(audit)],
});Planned — all languages share the gen_ai.* + audittrail.* attribute contract already in prod. Until then, route through the gateway proxy (works with any OpenAI-compatible client in any language today).
Timeline: V1.2 (Go + Java), V1.3 (Rust), V2.0 (.NET)