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

agentsdk-js

v0.1.0

Published

TypeScript-first, multi-provider AI agent SDK — build, orchestrate, and run AI agents anywhere. Bundles core + agent + graph in one package.

Readme

agentsdk-js

TypeScript-first, multi-provider AI agent SDK — build, orchestrate, and run AI agents anywhere.

License: MIT npm version TypeScript

One package, everything included. agentsdk-js bundles the core LLM client, the multi-step agent runtime, and the JSON graph engine into a single install — no need to install multiple packages.

npm install agentsdk-js
import 'agentsdk-js/bootstrap'
import { generateText, runAgent, runGraph } from "agentsdk-js-js'

✨ Features

  • Multi-provider — OpenAI, Anthropic, and GLM with one unified interface.
  • Lazy-loaded providers — only install the SDK packages you actually use.
  • Cost tracking built-in — every call returns token usage and USD cost.
  • Agent-as-tool handoff — wrap any agent as a callable tool for multi-agent orchestration.
  • Graph engine — 7 node types (Trigger, Agent, Tool, Condition, Loop, Output, HumanInLoop) with cycle detection and sandboxed condition evaluation.
  • Streaming — full streaming support across all three providers.
  • Retry & resilience — automatic retry on rate limits and server errors with exponential backoff.
  • Parallel tool execution — when an agent calls multiple tools in one turn, they run concurrently.
  • TypeScript-first — strict types throughout.

📦 Install

npm install agentsdk-js

Then install the provider SDK(s) for the LLM backend(s) you want to use:

# For OpenAI (works anywhere):
npm install openai

# For Anthropic (works anywhere):
npm install @anthropic-ai/sdk

# For GLM:
npm install z-ai-web-dev-sdk

Tip: Set OPENAI_API_KEY, ANTHROPIC_API_KEY, or ZAI_API_KEY in your environment.


🚀 Quick start

Basic LLM call

import 'agentsdk-js/bootstrap'
import { generateText } from "agentsdk-js'

const result = await generateText({
  model: 'gpt-4o-mini',
  messages: [
    { role: 'system', content: 'You are a concise assistant.' },
    { role: 'user', content: 'What is 2+2?' },
  ],
}, { provider: 'openai' })

console.log(result.text)
console.log(result.cost.total)

Multi-step agent with tools

import 'agentsdk-js/bootstrap'
import { runAgent, type AgentConfig } from "agentsdk-js'

const agent: AgentConfig = {
  id: 'researcher',
  name: 'Researcher',
  model: 'gpt-4o-mini',
  provider: 'openai',
  systemPrompt: 'You research topics. Use tools. Cite sources.',
  tools: [webSearchTool],
  maxSteps: 8,
}

const result = await runAgent(agent, {
  messages: [{ role: 'user', content: 'What are the latest AI news?' }],
})

Multi-agent orchestration

import { asTool, withHandoffs, runAgent } from "agentsdk-js'

const researcher = { id: 'researcher', model: 'gpt-4o-mini', systemPrompt: '...' }
const writer = { id: 'writer', model: 'gpt-4o-mini', systemPrompt: '...' }

const orchestrator = {
  id: 'orchestrator',
  model: 'gpt-4o-mini',
  systemPrompt: 'Coordinate: research then write.',
  tools: withHandoffs([], [
    { agent: researcher, opts: { description: 'Research a topic' } },
    { agent: writer, opts: { description: 'Write a draft' } },
  ]),
  maxSteps: 12,
}

JSON graph workflow

import 'agentsdk-js/bootstrap'
import { runGraph, GRAPH_SCHEMA_VERSION } from "agentsdk-js'

const graph = {
  schemaVersion: GRAPH_SCHEMA_VERSION,
  id: 'my-workflow',
  name: 'My Workflow',
  nodes: [/* ... */],
  edges: [/* ... */],
}

const result = await runGraph(graph, 'Hello!')

📚 API

Everything is exported from the main entry point:

import {
  // Core — LLM calls
  generateText, streamText, generateObject,
  createGlmProvider, createOpenAIProvider, createAnthropicProvider,
  registerProvider, getProvider, hasProvider, listProviders,
  AgentSDKError, normalizeError,
  setModelPricing, computeCost, addUsage, addCost,

  // Agent — multi-step runtime
  runAgent, asTool, withHandoffs, applyMemory,
  type AgentConfig, type AgentRunResult, type StepEvent,

  // Graph — workflow engine
  runGraph, validateGraph, isRunnable,
  resolveRef, resolveValue, evaluateCondition,
  GRAPH_SCHEMA_VERSION,
  type AgentGraph, type AnyGraphNode, type GraphState,
} from "agentsdk-js'

// Bootstrap (side-effect import for auto-registration):
import 'agentsdk-js/bootstrap'

🌐 Providers

| Provider | id | Env var | Works anywhere? | |----------|------|---------|-----------------| | OpenAI | openai | OPENAI_API_KEY | ✅ | | Anthropic | anthropic | ANTHROPIC_API_KEY | ✅ | | GLM | glm | ZAI_API_KEY | ✅ |

The SDK auto-detects which providers are available (via import 'agentsdk-js/bootstrap') and gracefully falls back.


📄 License

MIT — see LICENSE. Copyright (c) 2026 Shetan Mehra.