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

stillrunning-langchain

v0.1.0

Published

One-line monitoring for LangChain. A BaseCallbackHandler that pings StillRunning on every chain/agent run with duration, tokens, cost, model, and tool-call count.

Downloads

173

Readme

stillrunning-langchain

One-line monitoring for LangChain. A BaseCallbackHandler that pings StillRunning once per top-level run (chain or agent) with its duration, tokens, cost, model, and tool-call count, and alerts you the moment a run fails, runs too long, or costs too much.

import { stillrunning } from 'stillrunning-langchain'

const sr = stillrunning() // reads STILLRUNNING_TOKEN

await chain.invoke({ topic: 'otters' }, { callbacks: [sr.handler] })

Attach sr.handler via the callbacks option on any chain, agent, model, or .invoke / .stream call. One handler instance is safe to reuse across many concurrent invocations, state is keyed by each run tree's root.

Install

npm install stillrunning-langchain

LangChain (@langchain/core) is your dependency; this package is a callback handler that plugs into it.

Setup

  1. Create a workflow at stillrunning.ai/app/new and copy its ping token.
  2. Set STILLRUNNING_TOKEN (or pass stillrunning({ token })).
  3. Pass sr.handler in callbacks.

What it captures

The handler watches the whole run tree (chain → LLM/chat-model → tools) and pings on the top-level run's completion with:

| Field | Source | | --- | --- | | success / fail | root chain/LLM end vs error | | duration | wall-clock from the root run's start to its end | | tokens in / out | summed across every LLM call in the tree (tokenUsage, usage, or usage_metadata) | | cost | estimated from model + tokens (LangChain reports no dollar cost) | | model | the model id from the LLM/chat-model start | | tool calls | counted from handleToolStart |

Token usage is read from whichever shape your provider emits, and cost is estimated from a built-in pricing table (override with computeCost). A failed run still reports the tokens it burned.

Grouping multi-step runs

Wrap several invocations in withTrace so they share one traceId and stitch into a single outcome chain:

import { stillrunning, withTrace } from 'stillrunning-langchain'
const sr = stillrunning()

await withTrace(async () => {
  await planner.invoke(input, { callbacks: [sr.handler] })
  await executor.invoke(input, { callbacks: [sr.handler] })
})

Configuration

stillrunning({
  token,         // ping token; defaults to process.env.STILLRUNNING_TOKEN
  baseUrl,       // defaults to https://stillrunning.ai
  computeCost,   // ({ model, inputTokens, outputTokens }) => number , override cost estimation
  awaitPing,     // default true; false = fire-and-forget (lowest latency)
  pingTimeoutMs, // default 3000
  onError,       // (err) => void , observe ping delivery failures
  fetch,         // custom fetch (testing / non-global-fetch runtimes)
})

Monitoring never throws into your code: a failed ping routes to onError and is otherwise swallowed, bounded by pingTimeoutMs. Your chains run exactly as before.

Requirements

Node 18+. @langchain/core >= 0.2 as a peer dependency. Ships ESM + CJS with TypeScript types.

License

MIT