Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.inference.net/llms.txt

Use this file to discover all available pages before exploring further.

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. If a LangSmith-traced function is the boundary of an agent run, add an outer agentSpan() / agent_span() with a stable agent.id. LangSmith spans remain visible under that AGENT span.

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.

Stable Agent Identity

Use this pattern around LangSmith-traced work when you want the Agents dashboard to group executions by your product agent ID.
import { agentSpan } from "@inference/tracing";

await agentSpan(
  tracing.tracer,
  {
    agentId: "question-answer-agent",
    name: "QuestionAnswerAgent",
    role: "qa",
    system: "langsmith",
  },
  async (span) => {
    const input = { question: "hi" };
    span.setInput(input);
    const output = await answerQuestion(input);
    span.setOutput(output);
  },
);