npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@rawdash/connector-langsmith

v0.28.0

Published

Rawdash connector for LangSmith — LangChain runs, daily run rollups (count, tokens, cost), and feedback scores.

Downloads

964

Readme

@rawdash/connector-langsmith

npm version license

Sync LangChain runs, daily run rollups (count, tokens, cost, latency), and feedback scores from a LangSmith tenant.

Install

npm install @rawdash/connector-langsmith

Authentication

A LangSmith API key with read access is required. The key is sent as the x-api-key header on every request.

  1. Open LangSmith -> Settings -> API Keys and create a Personal Access Token (or Service key) with read access.
  2. Copy the key (it is shown once).
  3. Set endpoint to your LangSmith region: https://api.smith.langchain.com (US, default), https://eu.api.smith.langchain.com (EU), or your self-hosted origin (no trailing slash).
  4. Store the API key as a secret and reference it from config as apiKey: secret("LANGSMITH_API_KEY").

Configuration

| Field | Type | Required | Description | | -------------- | ------ | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | apiKey | secret | Yes | LangSmith API key with read access to the tenant. Create one in LangSmith -> Settings -> API Keys. | | endpoint | string | No | LangSmith API base URL. Defaults to https://api.smith.langchain.com (US cloud). Use https://eu.api.smith.langchain.com for the EU region or your self-hosted origin. No trailing slash. | | lookbackDays | number | No | How many calendar days of history to backfill on a full sync. Defaults to 30. | | resources | array | No | Which LangSmith resources to sync. Omit to sync all of them. Both runs and runs_per_day are produced from the same upstream query, so listing either pulls runs. |

Resources

  • langsmith_run (entity) - LangSmith run rows, keyed by id, with name, owning session/project, parent run, run type, status, start/end timestamps, total/prompt/completion tokens, total/prompt/completion cost in USD, and end-to-end latency in milliseconds.
    • Endpoint: POST /api/v1/runs/query
    • Runs upsert by id on every run. Trace input/output payloads are not stored.
    • name: Run name set by the SDK.
    • runType: Run type (chain, tool, llm, embedding, parser, retriever).
    • status: Run status (success, error, pending).
    • sessionId: Owning session (project) id, if any.
    • sessionName: Owning session (project) name, if any.
    • parentRunId: Parent run id for nested runs.
    • startTime: ISO timestamp of run start.
    • endTime: ISO timestamp of run end, if completed.
    • totalTokens: Aggregate token count across the run.
    • promptTokens: Prompt token count for the run.
    • completionTokens: Completion token count for the run.
    • totalCost: Aggregate run cost in USD.
    • latencyMs: End-to-end latency in milliseconds.
    • error: Error message if the run failed.
  • langsmith_runs_per_day (metric) - Per-run samples used to roll runs up to daily totals at query time. One sample is emitted per run at its start timestamp, tagged with project, run type, and status. The sample value is 1 (so summing field:value yields the run count); token, cost, and latency are exposed as additional measures.
    • Endpoint: POST /api/v1/runs/query
    • Unit: runs
    • Granularity: Per-run (query-time rollup)
    • Dimensions: sessionId, sessionName, runType, status
    • Measures: totalTokens, promptTokens, completionTokens, costUsd, latencyMs
    • No server-side aggregation - widgets group by day, project, or run type to produce the rollup.
  • langsmith_feedback (metric) - Feedback rows from LangSmith, one sample per feedback row at its created_at timestamp. The sample value is the numeric score (zero for non-numeric feedback) and the measure count is 1 so summing it yields feedback counts per (day, project, key).
    • Endpoint: GET /api/v1/feedback
    • Unit: score
    • Granularity: Per-feedback (query-time rollup)
    • Dimensions: key, sessionId, runId
    • Measures: count, hasNumericScore
    • Non-numeric feedback (string, boolean, JSON value) is still emitted but with score 0; use count to count rows and average the sample value for numeric score trends.

Example

import {
  defineConfig,
  defineDashboard,
  defineMetric,
  secret,
} from '@rawdash/core';

const langsmith = {
  name: 'langsmith',
  connectorId: 'langsmith',
  config: {
    apiKey: secret('LANGSMITH_API_KEY'),
    endpoint: 'https://api.smith.langchain.com',
    lookbackDays: 30,
  },
};

export default defineConfig({
  connectors: [langsmith],
  dashboards: {
    llm_observability: defineDashboard({
      widgets: {
        runs_today: {
          kind: 'stat',
          title: 'Runs today',
          metric: defineMetric({
            connector: langsmith,
            shape: 'metric',
            name: 'langsmith_runs_per_day',
            fn: 'sum',
            field: 'value',
          }),
        },
        spend_today: {
          kind: 'stat',
          title: 'LLM spend today (USD)',
          metric: defineMetric({
            connector: langsmith,
            shape: 'metric',
            name: 'langsmith_runs_per_day',
            fn: 'sum',
            field: 'costUsd',
          }),
        },
      },
    }),
  },
});

Rate limits

LangSmith applies per-tenant rate limits and returns 429 with Retry-After on overrun; the shared HTTP client honors that header.

Limitations

  • Run input/output payloads are not synced - only the run envelope plus aggregated cost, token, and latency.
  • Datasets, examples, prompts, and evaluation runs are out of scope for the initial release.
  • Feedback non-numeric values (string, boolean, JSON) are still counted but do not contribute to the score sample.

Links

License

Apache-2.0