@mayurajs/observability-langsmith
v1.2.0
Published
LangSmith for Mayura's traces, with LangSmith's run types, over LangSmith's OpenTelemetry endpoint.
Readme
@mayurajs/observability-langsmith
LangSmith for Mayura's traces (mayura/exporter-otlp), through LangSmith's
OpenTelemetry endpoint.
npm install mayura @mayurajs/observability-langsmithimport { agentRunTraceSpans } from 'mayura/exporter-otlp';
import { langSmithTraceExporter } from '@mayurajs/observability-langsmith';
const langsmith = langSmithTraceExporter({ apiKey, project: 'support-agent', region: 'us', serviceName: 'support-agent' });
await langsmith.sink(agentRunTraceSpans(observer.inspect(handle.id)?.recent ?? []), { signal: AbortSignal.timeout(10_000) });- Regions
us(the default),eu,apacandaws-us, orbaseUrlfor a self-hosted LangSmith's API URL. projectnames the project the traces go to; LangSmith's default project when left out.- Each span carries its LangSmith run type (
langsmith.span.kind:llmfor model calls,toolfor tool calls,chainfor runs) and the provider asgen_ai.system, beside its GenAI attributes, so runs show as chains with their LLM and tool runs, models and token usage.langSmithAttributesis exported to reuse the mapping. - Spans are metadata only, so traces carry no prompts or outputs.
- The
sinkalso works as thesinkofcreateWorkflowTraceExport, for durable workflow runs. - The key is passed in; nothing is read from the environment. Every other option is the OTLP trace exporter's.
See the observability guide. Apache-2.0.
