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

mini-agents

v0.0.4

Published

A mini AI agent framework

Downloads

17

Readme

mini-agents

npm version License: MIT

A minimalist yet professional TypeScript Agent framework, inspired by MiniMax's open-source Python version of Mini-Agent.

Features

  • Complete Agent Execution Loop: Reliable execution framework with a basic toolset for file system operations and shell execution
  • Smart Context Management: Automatic summarization of conversation history to support long task execution
  • Skill System: Progressive disclosure Skill mechanism, where the Agent can retrieve Skill details on demand
  • Multi-LLM Support: Supports both Anthropic (Claude) and OpenAI APIs
  • Cancellation Mechanism: Support for canceling Agent execution at any time with proper cleanup of session state
  • Modular Design: Clean separation of concerns with modular architecture

Installation

npm install mini-agents

Quick Start

Basic Usage

import { Agent, LLMClient } from 'mini-agents';
import { createReadTool, createWriteTool, createBashTool } from 'mini-agents/tools';

// Create LLM client
const llm = new LLMClient({
  provider: 'anthropic',
  model: 'claude-sonnet-4-5-20250929',
  apiKey: process.env.ANTHROPIC_API_KEY,
  apiBase: process.env.ANTHROPIC_API_BASE_URL,
});

// Create tools with working directory restrictions
const tools = [
  createReadTool('./workspace'),
  createWriteTool('./workspace'),
  createBashTool('./workspace'),
];

// Create Agent
const agent = new Agent(llm, 'You are a helpful assistant.', tools);

// Add user message
agent.addUserMessage('Please help me create a simple HTML file');

// Run Agent, processing event stream
for await (const event of agent.run()) {
  switch (event.type) {
    case 'thinking':
      console.log('🤔', event.thinking);
      break;
    case 'toolCall':
      console.log('🔧 Call:', event.toolCall.function.name);
      break;
    case 'toolResult':
      console.log('✅ Result:', event.result.content);
      break;
    case 'assistantMessage':
      console.log('💬', event.content);
      break;
  }
}

API Reference

Agent

The core Agent class that manages the conversation loop and tool execution.

import { Agent } from 'mini-agents';

const agent = new Agent(
  llmClient,      // LLMClient instance
  systemPrompt,   // System prompt string
  tools,          // Array of tools
  options         // Optional configuration
);

LLMClient

Unified client for interacting with LLM providers.

import { LLMClient } from 'mini-agents';

const client = new LLMClient({
  provider: 'anthropic', // or 'openai'
  model: 'claude-sonnet-4-5-20250929',
  apiKey: 'your-api-key',
  apiBase: 'https://api.anthropic.com',
});

Tools

File System Tools

import { createReadTool, createWriteTool, createEditTool } from 'mini-agents/tools';

const readTool = createReadTool(workspaceDir);
const writeTool = createWriteTool(workspaceDir);
const editTool = createEditTool(workspaceDir);

Bash Tool

import { createBashTool } from 'mini-agents/tools';

const bashTool = createBashTool(workspaceDir);

Skill Tool

import { SkillLoader, createGetSkillTool } from 'mini-agents/tools';

const skillLoader = new SkillLoader('./skills');
const skills = skillLoader.discoverSkills();
const getSkillTool = createGetSkillTool(skillLoader);

Custom Tools

import { tool } from 'mini-agents';
import { z } from 'zod';

const myTool = tool({
  name: 'my_tool',
  description: 'My custom tool',
  parameters: z.object({
    input: z.string().describe('Input parameter'),
  }),
  async execute({ input }) {
    // Tool logic here
    return `Result: ${input}`;
  },
});

Exports

// Core
export { Agent, LLMClient } from 'mini-agents';

// Tools
export {
  createReadTool,
  createWriteTool,
  createEditTool,
  createBashTool,
  createBashKillTool,
  createBashOutputTool,
  SkillLoader,
  createGetSkillTool,
  tool,
} from 'mini-agents/tools';

// Types
export type {
  Message,
  LLMProvider,
  Tool,
  ToolResult,
  AgentMessageEvent,
} from 'mini-agents/types';

License

MIT