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

@agentos-sdk/core

v0.2.2

Published

AgentOS TypeScript SDK — instrument agents with runs, events, and tasks.

Downloads

148

Readme

@agentos-sdk/core

Official TypeScript SDK for AgentOS — instrument your AI agents with runs, events, and tasks.

The SDK is a thin client over the AgentOS ingest API. Your agent code runs wherever you want; AgentOS observes it.

Install

npm install @agentos-sdk/core
# or
pnpm add @agentos-sdk/core
# or
yarn add @agentos-sdk/core

Quick start

Generate an API key from your agent's page in the AgentOS dashboard, then pick a path:

Calling a hosted agent

For agents you've defined in AgentOS — invoke runs the agent server-side and returns its output:

import { AgentOS } from "@agentos-sdk/core";

const aos = new AgentOS({
  apiKey: process.env.AGENTOS_API_KEY!,
  agentId: process.env.AGENTOS_AGENT_ID!,
});

const { output } = await aos.invoke({ prompt: "Hello" });
console.log(output);

Instrumenting your own agent

For agents that run in your own code — startRun / emit / complete reports them to AgentOS for observability:

import { AgentOS } from "@agentos-sdk/core";

const aos = new AgentOS({
  apiKey: process.env.AGENTOS_API_KEY!,
  agentId: process.env.AGENTOS_AGENT_ID!,
});

const run = await aos.startRun({ input: { prompt: "Hello" } });

try {
  run.emit("step.started", { step: 1 });

  // ... do work ...

  run.emit("step.completed", { step: 1, durationMs: 42 });
  await run.complete({ output: { answer: "..." } });
} catch (err) {
  await run.fail({ errorMessage: String(err) });
}

emit(type, payload?, level?) is non-blocking and returns void — events are buffered and flushed on a timer (default 500ms) or when the buffer fills (50 events). Call await run.flush() if you need to be sure pending events are sent before the process exits (e.g. in a Lambda or short-lived script). await run.complete() and await run.fail() flush automatically.

LangChain.js integration

Drop in AgentOSCallbackHandler to mirror LangChain runs into AgentOS automatically:

import { AgentOS } from "@agentos-sdk/core";
import { AgentOSCallbackHandler } from "@agentos-sdk/core/langchain";
import { ChatAnthropic } from "@langchain/anthropic";

const aos = new AgentOS({ apiKey: process.env.AGENTOS_API_KEY!, agentId: "..." });
const run = await aos.startRun();

const model = new ChatAnthropic({
  callbacks: [new AgentOSCallbackHandler(run)],
});

await model.invoke("What's the weather in SF?");
await run.complete();

@langchain/core is an optional peer dependency — only install it if you use the LangChain handler.

Configuration

new AgentOS({
  apiKey: "...",         // required
  agentId: "...",        // required
  baseUrl: "http://localhost:3000",              // optional — defaults to the AgentOS production URL; override for self-hosted or local dev
  batchInterval: 500,    // ms between event flushes
  batchSize: 50,         // max events per batch
  disabled: false,       // no-op the SDK in tests
});

Requirements

  • Node.js 18+
  • An AgentOS workspace with an agent + API key (sign up)

License

MIT