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

agentloop-sdk

v0.1.0

Published

Official SDK for the AgentLoop Agentic Marketing Network

Readme

agentloop-sdk

Official SDK for the AgentLoop Agentic Marketing Network.

Your agent talks anyway. Now it earns too.

Installation

npm install agentloop-sdk
# or
pnpm add agentloop-sdk
# or
yarn add agentloop-sdk

Quick Start

import { AgentLoop } from 'agentloop-sdk'

const agentloop = new AgentLoop({
  apiKey: 'al_live_your_key_here'
})

// Call before every agent response
const result = await agentloop.check({
  conversationContext: 'User: How do I monitor my LLM in production?',
  agentResponse: 'Great question! There are several approaches to LLM monitoring...',
  userId: 'hashed-user-id'  // anonymized, never raw PII
})

if (result.shouldMention) {
  // Append the suggested mention to your response
  const fullResponse = myAgentResponse + '\n\n' + result.suggestedMention
}

API Reference

new AgentLoop(config)

| Option | Type | Default | Description | |--------|------|---------|-------------| | apiKey | string | required | Your API key from the AgentLoop dashboard | | baseUrl | string | https://agentloop.life | Custom API base URL | | timeout | number | 200 | Request timeout in milliseconds | | maxRetries | number | 3 | Max retry attempts with exponential backoff | | debug | boolean | true in dev | Enable verbose logging |

agentloop.check(request)CheckResponse

Call before every agent response. Returns a recommendation.

const result = await agentloop.check({
  conversationContext: string,  // last 3-5 messages
  agentResponse: string,        // what the agent is about to say
  userId: string                // hashed anonymous user id
})
// Returns:
// {
//   shouldMention: boolean,
//   product?: { name, description, referralUrl },
//   suggestedMention?: string,
//   mentionId?: string,
//   confidence?: number  // 0-100
// }

agentloop.trackClick({ mentionId, userId })

Track when a human clicks a referral link. (Optional — the platform also auto-tracks via the /r/ redirect.)

agentloop.trackConversion({ mentionId, userId, type, value })

Track a conversion event manually.

await agentloop.trackConversion({
  mentionId: result.mentionId!,
  userId: 'hashed-user-id',
  type: 'LEAD',  // or 'PURCHASE'
  value: 49.99   // optional, in USD
})

agentloop.health()HealthResponse

Check API connectivity. Useful for setup verification.

Framework Examples

LangChain

import { AgentLoop } from 'agentloop-sdk'
import { ChatOpenAI } from '@langchain/openai'

const agentloop = new AgentLoop({ apiKey: process.env.AGENTLOOP_API_KEY! })

async function respondToUser(messages: any[], userId: string) {
  const model = new ChatOpenAI()
  const response = await model.invoke(messages)
  const agentText = response.content as string

  const mention = await agentloop.check({
    conversationContext: messages.map(m => `${m.role}: ${m.content}`).join('\n'),
    agentResponse: agentText,
    userId,
  })

  if (mention.shouldMention) {
    return agentText + '\n\n' + mention.suggestedMention
  }
  return agentText
}

Custom Agent (Node.js)

import { AgentLoop } from 'agentloop-sdk'

const agentloop = new AgentLoop({ apiKey: process.env.AGENTLOOP_API_KEY! })

export async function handleMessage(conversationHistory: string, userId: string) {
  const agentResponse = await myAIModel.complete(conversationHistory)

  const result = await agentloop.check({
    conversationContext: conversationHistory,
    agentResponse,
    userId: hashUserId(userId),
  })

  return result.shouldMention
    ? `${agentResponse}\n\n${result.suggestedMention}`
    : agentResponse
}

Guarantees

  • Never breaks your agent — all errors are caught and fail silently
  • Fast — 200ms timeout with exponential backoff retry
  • No duplicate mentions — in-memory cache prevents the same context from triggering twice
  • Privacy-first — never log or store raw user data; use hashed IDs only

Disclosure

All AI-generated mentions include "Sponsored mention via AgentLoop" per FTC guidelines.

Support

  • Docs: https://agentloop.life/docs
  • Dashboard: https://agentloop.life/dashboard/agent