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-claude-agent-sdk

v0.1.0

Published

One-line monitoring for the Claude Agent SDK. Wrap query() and auto-ping StillRunning on every agent run with duration, tokens, cost, model, and tool-call count.

Readme

stillrunning-claude-agent-sdk

One-line monitoring for the Claude Agent SDK. Wrap query() and every agent run auto-reports to StillRunning with its duration, tokens, cost, model, and tool-call count, and fires an alert the moment a run fails, runs too long, or costs too much.

import { query } from '@anthropic-ai/claude-agent-sdk'
import { stillrunning } from 'stillrunning-claude-agent-sdk'

const sr = stillrunning() // reads STILLRUNNING_TOKEN
const monitoredQuery = sr.wrap(query)

for await (const message of monitoredQuery({ prompt: 'fix the failing test' })) {
  // use messages exactly as before , a ping fires automatically when the run completes
}

That's the whole integration. monitoredQuery is a drop-in for query: same arguments, same message stream, same control methods (interrupt(), setPermissionMode(), …). It just watches the run go by.

Install

npm install stillrunning-claude-agent-sdk

The Claude Agent SDK is your dependency; this package wraps the query you already import, so there's nothing to keep in version lockstep.

Setup

  1. Create a workflow at stillrunning.ai/app/new and copy its ping token.
  2. Set STILLRUNNING_TOKEN (or pass stillrunning({ token })).
  3. Wrap query once and use it everywhere.

What it captures

On completion the wrapper reads the Claude Agent SDK's final result message and pings StillRunning with:

| Field | Source | | --- | --- | | success / fail | result.subtype (error_* or is_error → fail) | | duration | result.duration_ms | | cost | result.total_cost_usd (the SDK's own number) | | tokens in / out | result.usage (input + cache reads/writes, and output) | | model | the dominant model in result.modelUsage | | tool calls | counted from the tool_use blocks in the run | | turns, session id, terminal reason | sent as metadata |

A run that throws mid-stream pings fail with the error message, then the error rethrows untouched. A failed run still reports the tokens and cost it burned before failing.

Grouping multi-step agents

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

import { stillrunning, withTrace } from 'stillrunning-claude-agent-sdk'
const sr = stillrunning()
const query = sr.wrap(baseQuery)

await withTrace(async () => {
  for await (const _ of query({ prompt: 'plan the work' })) {}
  for await (const _ of query({ prompt: 'execute step 1' })) {}
}) // both runs share one traceId

Configuration

stillrunning({
  token,         // ping token; defaults to process.env.STILLRUNNING_TOKEN
  baseUrl,       // defaults to https://stillrunning.ai
  computeCost,   // ({ model, inputTokens, outputTokens }) => number , override the SDK's cost
  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 so a slow StillRunning never hangs your agent. Messages stream through unchanged.

Requirements

Node 18+. Claude Agent SDK as a peer (you already have it). Ships ESM + CJS with TypeScript types.

License

MIT