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

@agenr/sdk

v0.1.0

Published

TypeScript SDK for the Agent Gateway Protocol (AGP) — let your AI agent interact with real-world businesses

Downloads

16

Readme

@agenr/sdk

npm version license

Connect your AI agent to any business in 3 lines of code.

The TypeScript SDK for Agenr -- the trust and commerce layer for AI agents. Discover what businesses offer, query their data, and execute real transactions through a single unified protocol (AGP).

Install

npm install @agenr/sdk

Quick Start

No signup required. Use the public demo key with the built-in Echo adapter:

import { AgenrClient } from "@agenr/sdk";

const agenr = new AgenrClient({ apiKey: "ak_test_public_demo" });

// What can this business do?
const capabilities = await agenr.discover("echo");

// Browse their catalog
const catalog = await agenr.query("echo", { serviceId: "catalog" });

// Place an order
const order = await agenr.execute("echo", {
  serviceId: "order",
  items: [{ productId: "echo-widget-1", quantity: 2 }],
});

That's it. Same three methods work for any business connected to Agenr -- restaurants, retailers, SaaS platforms, anything with an adapter.

Execute Confirmation

Agenr supports two levels of confirmation to keep humans in the loop before money moves.

Simple (open policy)

When the server runs with AGENR_EXECUTE_POLICY=open, agents call execute() directly. If the adapter needs business-level confirmation (e.g. "confirm your payment"), it returns pending_confirmation with a token:

const result = await agenr.execute("echo", {
  serviceId: "order",
  items: [{ productId: "echo-widget-1", quantity: 2 }],
});

if (result.data?.status === "pending_confirmation") {
  const confirmed = await agenr.execute("echo", {
    serviceId: "order",
    items: [{ productId: "echo-widget-1", quantity: 2 }],
    confirmationToken: result.data.confirmationToken,
  });
}

When the server requires API-level confirmation (AGENR_EXECUTE_POLICY=confirm), agents must call prepare() first to get a confirmation token:

const request = {
  serviceId: "order",
  items: [{ productId: "echo-widget-1", quantity: 2 }],
};

// 1. Prepare -- get API-level confirmation token
const prepared = await agenr.prepare("echo", request);

// 2. Execute with API confirmation token
const result = await agenr.execute("echo", request, {
  confirmationToken: prepared.confirmationToken,
  idempotencyKey: "order-echo-widget-1-x2",
});

// 3. If adapter also needs confirmation, call execute again
if (result.data?.status === "pending_confirmation") {
  const confirmed = await agenr.execute(
    "echo",
    { ...request, confirmationToken: result.data.confirmationToken },
    {
      confirmationToken: prepared.confirmationToken,
      idempotencyKey: "order-echo-widget-1-x2-confirm",
    },
  );
}

Use with AI Agent Tools

Wire the SDK into any tool-calling framework:

const agenr = new AgenrClient({ apiKey: process.env.AGENR_API_KEY });

const tools = [
  {
    name: "discover_business",
    description: "Discover what a business can do",
    handler: ({ businessId }) => agenr.discover(businessId),
  },
  {
    name: "query_business",
    description: "Query business data (catalog, menu, availability)",
    handler: ({ businessId, request }) => agenr.query(businessId, request),
  },
  {
    name: "execute_action",
    description: "Execute a business action (order, book, pay)",
    handler: ({ businessId, request, confirmationToken, idempotencyKey }) =>
      agenr.execute(businessId, request, { confirmationToken, idempotencyKey }),
  },
];

Or skip the SDK and use the MCP server: @agenr/mcp

Configuration

const agenr = new AgenrClient({
  apiKey: "ak_...",           // from agenr.ai (or ak_test_public_demo for testing)
  baseUrl: "https://api.agenr.ai",  // default; override for self-hosted
  headers: { "X-Custom": "value" }, // extra headers on every request
});

API Reference

| Method | Description | |---|---| | discover(businessId) | What can this business do? | | query(businessId, request) | Browse data (catalog, menu, availability) | | execute(businessId, request, options?) | Take action (order, book, pay) | | prepare(businessId, request) | Get API-level confirmation token | | status(transactionId) | Check transaction status |

ExecuteOptions

interface ExecuteOptions {
  confirmationToken?: string; // maps to x-confirmation-token header
  idempotencyKey?: string;    // maps to idempotency-key header
}

Types

import type {
  AgenrConfig,
  AgpOperation,      // "discover" | "query" | "execute"
  AgpResponse,       // { id, operation, businessId, status, data, ... }
  AgpTransaction,    // same as AgpResponse
  ExecuteOptions,    // { confirmationToken?, idempotencyKey? }
  PrepareResponse,   // { confirmationToken, expiresAt, summary }
  TransactionStatus, // "pending" | "succeeded" | "failed"
} from "@agenr/sdk";

Error Handling

import { AgenrError } from "@agenr/sdk";

try {
  await agenr.execute("echo", { serviceId: "order" });
} catch (err) {
  if (err instanceof AgenrError) {
    err.statusCode;    // HTTP status
    err.message;       // error message
    err.transactionId; // transaction ID (if available)
    err.response;      // raw response payload
  }
}

Links

License

MIT