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

@agentscope-sdk/sdk

v0.1.7

Published

AgentScope TypeScript SDK

Readme

AgentScope TypeScript SDK

Node.js SDK for instrumenting runs, spans, and artifacts and exporting them to the AgentScope ingestion API.

Install

npm install
npm run build

Usage

import { addArtifact, autoInstrument, observeRun, observeSpan, trace } from "@agentscope/sdk";

autoInstrument(["openai", "anthropic"]);

await observeRun("coding_agent", async () => {
  await observeSpan("file_read", async () => {
    // file read logic
  });

  await observeSpan("llm_call", async () => {
    addArtifact("llm.prompt", {
      model: "gpt-4o",
      messages: [{ role: "user", content: "hello" }],
    });
  });

  trace.log("run step finished", { level: "info" });
});

Set AGENTSCOPE_API_BASE=http://localhost:8080 if the API is not running on the default host.

Anonymous SDK Telemetry (Optional)

SDK usage telemetry is disabled by default. To opt in, set:

export AGENTSCOPE_TELEMETRY_ENABLED=true

When enabled, the SDK sends only anonymous events (sdk_init, run_start, run_end) to POST /v1/telemetry with an anonymized project_id stored in ~/.agentscope/config.json. Prompt/output content and user payloads are never sent by this channel.

Example Script

npm install
npm run example

This runs examples/basic.js, which emits a run with nested spans and artifacts to the local AgentScope API.

API

  • observeRun(workflowName, fn, options?)
    • Cross-run linkage options in options: traceId, parentRunId, rootRunId
  • observeSpan(name, fn, options?)
  • addArtifact(kind, payload, spanId?)
  • trace.auto(providers?)
  • trace.log(message, options?)
  • trace.updateSpan(spanId, data)
  • autoTrace(providers?)
  • autoInstrument(providers?)
  • codingAgentRun(fn, options?)
  • instrumentCodingAgent(fn)
  • readFile(filePath, encoding?)
  • writeFile(filePath, content, encoding?)
  • runCommand(command, options?)
  • flush()

Fetch Instrumentation

Phase two includes fetch auto-instrumentation:

import { instrumentFetch, observeRun } from "@agentscope/sdk";

const restoreFetch = instrumentFetch();

await observeRun("coding_agent", async () => {
  await fetch("https://api.openai.com/v1/chat/completions", {
    method: "POST",
    headers: {
      "content-type": "application/json",
      authorization: `Bearer ${process.env.OPENAI_API_KEY}`,
    },
    body: JSON.stringify({
      model: "gpt-4o",
      messages: [{ role: "user", content: "hello" }],
    }),
  });
});

restoreFetch();

OpenAI-compatible requests are detected by URL and JSON payload shape. Prompt and response bodies are captured as llm.prompt and llm.response artifacts.