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

@multi-agent/agent-kit

v0.1.1

Published

agent-kit

Downloads

621

Readme

@multi-agent/agent-kit

AI Agent 开发工具包 - 提供 ReAct 执行器、重试工具等基础能力。

安装

npm install @multi-agent/agent-kit

快速开始

import { react, retry } from '@multi-agent/agent-kit'

// ReAct 模式实现自我修正
const result = await react({
  reason: async (input, feedback) => makeDecision(input, feedback),
  act: async (decision) => execute(decision),
  observe: (result) => analyzeResult(result),
  maxRetries: 3,
}, input)

API 文档

ReAct 执行器

实现 ReAct 模式:推理 → 行动 → 观察 → 再推理。适用于需要自我修正的 Agent。

import { react, type ReactConfig } from '@multi-agent/agent-kit'

const result = await react({
  // 推理:根据输入和反馈做出决策
  reason: async (input, feedback) => {
    if (feedback) {
      return adjustedDecision  // 根据上次错误调整决策
    }
    return initialDecision
  },

  // 行动:执行决策
  act: async (decision) => {
    return await execute(decision)
  },

  // 观察:分析结果,判断成功或失败
  observe: (result, decision) => {
    if (result.error) {
      return { success: false, error: result.error }
    }
    return { success: true, data: result.data }
  },

  // 判断错误是否可重试
  isRetryable: (error) => error.type === 'INVALID_SELECTION',

  maxRetries: 2,
}, input)

重试工具

支持指数退避、抖动、选择性重试和错误反馈。

import { retry, type RetryConfig } from '@multi-agent/agent-kit'

const result = await retry(
  (feedback) => callLLMWithStructuredOutput(schema, feedback),
  {
    maxRetries: 3,
    baseDelay: 1000,      // 初始延迟 1 秒
    maxDelay: 10000,      // 最大延迟 10 秒
    shouldRetry: (error) => error.message.includes('timeout'),
    transformError: (error) => {
      // 为下次尝试提供反馈
      if (error.lc_error_code === 'OUTPUT_PARSING_FAILURE') {
        return `上次输出格式错误:${error.message}`
      }
      return undefined
    },
    onRetry: (error, attempt, delay, feedback) => {
      console.log(`重试 ${attempt}/3,延迟 ${delay}ms`)
    }
  }
)

react vs retry 的区别:

| 模式 | 适用场景 | |------|----------| | retry | 相同操作重复执行,临时故障(网络超时、限流) | | react | 根据错误反馈调整决策(LLM 输出错误、选择无效) |

相关项目