@intertrace-runtime/tracing
v0.2.1
Published
Slim Intertrace tracing client — films sessions via Chat Completions, Responses, and Anthropic Messages. Analogue of mlflow-tracing.
Maintainers
Readme
@intertrace-runtime/tracing
Slim tracing client — films sessions, not a dashboard. Same idea as MLflow’s
mlflow-tracing: a small exporter, not the whole product.
Public npm name: @intertrace-runtime/tracing. Always import that name.
Install
npm install @intertrace-runtime/tracingUsage
import { IntertraceRuntime } from "@intertrace-runtime/runtime";
import { fromEnv, instrumentOpenAI, instrumentAnthropic } from "@intertrace-runtime/tracing";
import OpenAI from "openai";
const runtime = IntertraceRuntime.fromEnv();
const { sessionId } = await runtime.ensureSession({ taskSummary: "Handle ticket" });
const tracer = fromEnv();
tracer.bindSession(sessionId); // one job with protectTool
const openai = instrumentOpenAI(
new OpenAI({
apiKey: process.env.INTERTRACE_RUNTIME_API_KEY,
baseURL: "https://intertrace.fly.dev/v1",
})
);
await tracer.trace("handle ticket", async () => {
await openai.chat.completions.create({
model: "gpt-4o-mini",
messages: [{ role: "user", content: "Summarize the ticket" }],
});
await openai.responses.create({
model: "gpt-4o-mini",
input: "Summarize the ticket",
});
});fromEnv() reads INTERTRACE_API_KEY / INTERTRACE_RUNTIME_API_KEY and
INTERTRACE_SESSION_ID. bindSession() attaches a real runtime session —
do not invent one. Unbound tracers mint a UUID so ingest can still film.
instrumentOpenAI patches Chat Completions and Responses.
instrumentAnthropic patches Messages. Nested trace() calls set
parentSpanId. Hops land in Estate → Sessions.
OTel without this SDK
OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=https://platform.intertrace.ai/api/v1/traces
OTEL_EXPORTER_OTLP_HEADERS=Authorization=Bearer itr_rt_…JSON GenAI resourceSpans with session.id or gen_ai.conversation.id group
into one job.
License
Intertrace Proprietary License — see LICENSE.
