Skip to main content
If your application already uses LangSmith tracing, Catalyst can bridge LangSmith OpenTelemetry spans into the Catalyst tracer provider. This keeps LangSmith traceable functions and framework integrations visible with the rest of your application traces.

Install

bun add @inference/tracing langsmith

TypeScript Traceable Function

TypeScript
import { setup } from "@inference/tracing";
import { Client } from "langsmith";
import { traceable } from "langsmith/traceable";

process.env.LANGSMITH_TRACING = "true";
process.env.LANGSMITH_TRACING_MODE = "otel";

const tracing = await setup({ serviceName: "langsmith-worker" });
const client = new Client({ tracingMode: "otel" });

const answerQuestion = traceable(
  async (input: { question: string }) => ({
    answer: input.question.toUpperCase(),
  }),
  {
    name: "answerQuestion",
    run_type: "tool",
    client,
    tracer: tracing.provider.getTracer("langsmith-app"),
  },
);

console.log(await answerQuestion({ question: "hi" }));
await client.flush();
await tracing.shutdown();

Python Traceable Function

Python
import os

from inference_catalyst_tracing import setup
from langsmith import Client, traceable

os.environ["LANGSMITH_TRACING"] = "true"
os.environ["LANGSMITH_TRACING_MODE"] = "otel"

tracing = setup(service_name="langsmith-worker")
client = Client()

@traceable(name="answer_question", run_type="tool", client=client, enabled=True)
def answer_question(question: str) -> str:
    return question.upper()

print(answer_question("hi"))
client.flush()
tracing.shutdown()

Hybrid Mode

If LANGSMITH_TRACING=true is set and LANGSMITH_TRACING_MODE is not set, Catalyst defaults LangSmith to hybrid mode. That keeps existing LangSmith tracing active while also routing OpenTelemetry spans through Catalyst.
export LANGSMITH_TRACING=true
# Catalyst sets LANGSMITH_TRACING_MODE=hybrid when unset.