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

@claude-code-kit/agent

v0.3.1

Published

Headless agent framework for claude-code-kit — LLM query loop, tool execution, multi-provider

Readme

@claude-code-kit/agent

Headless agent framework for building LLM-powered tools and applications. Provides an AsyncGenerator-based query loop with tool execution, multi-provider support, context management, and tiered permissions.

Features

  • Multi-provider: Anthropic (Claude) and OpenAI-compatible APIs (GPT, Ollama, vLLM, Groq, Together)
  • Tool execution: Zod-based tool definitions with automatic JSON Schema generation
  • Context management: Token counting with configurable compaction strategies
  • Tiered permissions: Allow/deny lists, session approvals, read-only auto-approve, custom callbacks
  • Streaming: AsyncGenerator-based event stream for real-time UI updates
  • Stateful sessions: Maintains conversation history across calls
  • MCP client: Optional Model Context Protocol client for dynamic tool discovery
  • Headless: No UI dependencies -- works in Node.js scripts, CLI apps, web servers, anywhere

API status

  • Stable in v0.3.x: Agent, providers, permissions, sessions, compaction, ToolRegistry
  • Experimental in v0.3.x: MCPClient and MCP-backed dynamic tool discovery

Quick start

import { Agent, AnthropicProvider } from '@claude-code-kit/agent'
import { z } from 'zod'

const agent = new Agent({
  provider: new AnthropicProvider({ apiKey: process.env.ANTHROPIC_API_KEY }),
  model: 'claude-sonnet-4-20250514',
  systemPrompt: 'You are a helpful assistant.',
  tools: [{
    name: 'get_weather',
    description: 'Get weather for a city',
    inputSchema: z.object({ city: z.string() }),
    async execute({ city }) {
      return { content: `Weather in ${city}: 72F, sunny` }
    },
  }],
})

// Simple API
const response = await agent.chat('What is the weather in Tokyo?')

// Streaming API
for await (const event of agent.run('What is the weather in Tokyo?')) {
  switch (event.type) {
    case 'text': process.stdout.write(event.text); break
    case 'tool_call': console.log('Calling:', event.toolCall.name); break
    case 'tool_result': console.log('Result:', event.result.content); break
    case 'done': console.log('\nDone'); break
  }
}

Providers

Anthropic

import { AnthropicProvider } from '@claude-code-kit/agent'
const provider = new AnthropicProvider({ apiKey: '...' })

OpenAI (and compatible)

import { OpenAIProvider } from '@claude-code-kit/agent'

// OpenAI
const openai = new OpenAIProvider({ apiKey: '...' })

// Ollama
const ollama = new OpenAIProvider({ baseURL: 'http://localhost:11434/v1' })

// Groq
const groq = new OpenAIProvider({ apiKey: '...', baseURL: 'https://api.groq.com/openai/v1' })

Mock (for testing)

import { MockProvider } from '@claude-code-kit/agent'

const provider = new MockProvider([
  [{ type: 'text', text: 'Hello!' }, { type: 'done' }],
])

Permissions

import { Agent, createPermissionHandler } from '@claude-code-kit/agent'

const agent = new Agent({
  // ...
  permissionHandler: createPermissionHandler({
    alwaysAllow: ['get_weather', 'search'],
    alwaysDeny: ['delete_file'],
    autoApproveReadOnly: true,
    onPermission: async (req) => {
      const ok = await promptUser(`Allow ${req.tool}?`)
      return { decision: ok ? 'allow' : 'deny' }
    },
  }),
})

MCP

MCPClient is available when you want to connect to stdio or Streamable HTTP MCP servers. Treat it as an evolving API during 0.x; the stable default remains explicit local tools passed via tools.

License

MIT