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

@priors/agentkit

v0.2.5

Published

Priors action provider for Coinbase AgentKit: pay x402 APIs in USDG on Robinhood Chain and borrow the gap from an ERC-8004 agent's Priors credit line, repay, and read another agent's repayment record before paying it.

Readme

@priors/agentkit

A Coinbase AgentKit action provider for Priors: an ERC-8004 agent on Robinhood Chain pays x402 APIs in USDG and, when its wallet is short, borrows the gap from its Priors credit line, then repays. Before paying another agent it can read that agent's repayment record.

The same provider is proposed to AgentKit itself (priorsActionProvider in @coinbase/agentkit); this package makes it usable with the AgentKit already on npm.

Install

npm install @priors/agentkit @coinbase/agentkit

Use

import { AgentKit, ViemWalletProvider } from "@coinbase/agentkit";
import { priorsActionProvider } from "@priors/agentkit";
import { createWalletClient, defineChain, http } from "viem";
import { privateKeyToAccount } from "viem/accounts";

const robinhood = defineChain({
  id: 4663,
  name: "Robinhood Chain",
  nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
  rpcUrls: { default: { http: ["https://rpc.mainnet.chain.robinhood.com"] } },
});
const walletProvider = new ViemWalletProvider(
  createWalletClient({ account: privateKeyToAccount(KEY), chain: robinhood, transport: http() }),
);
const agentKit = await AgentKit.from({ walletProvider, actionProviders: [priorsActionProvider()] });

Then hand agentKit to your framework as usual (getVercelAITools(agentKit), getLangChainTools(agentKit), ...).

Inference on credit (0.2.0). Give the provider autoBorrow, set by you in code, never by the model:

priorsActionProvider(undefined, { autoBorrow: { perCall: "5", perDay: "10", hosts: ["models.example"] } })

With it, pay_x402_with_priors_credit borrows the gap on its own when the wallet is short, for the listed hosts only. There is no default host: hosts names each one, exactly (here models.example stands for the model API you choose). The limits are perCall USDG a call and perDay USDG a UTC day (each read exactly, at most 6 decimals), for 14 days whatever term the model names (or the pool's maximum term). The day counts what the pool lent the agent since 00:00 UTC, every loan of the agent whoever took it, as well as this process's own auto-borrows, so a restart does not start the day again (0.2.5); if those loans cannot be read, nothing is borrowed. A borrow another process sent that is not mined yet is not seen, and after a restart a provider that auto-borrows for several agents counts each agent's loans only. It borrows only while this wallet's Autopay (AutoRepay v2) covers the new loan: the wallet is the agent's declared wallet, the plan is on under the agent's current owner, not held or paused, its limit per loan and its USDG approval cover the loan's due. Otherwise nothing is borrowed or paid, and the answer says to turn Autopay on. The wallet must be a key of the agent's own, not its owner's address: AutoRepay repays an agent whose declared wallet is its owner (what registering it leaves) under the owner's plan only, so auto-borrow refuses that wallet. Autopay then repays the loan in its window. The model's maxBorrow can only lower the amount. A chat completion is one call to an OpenAI-compatible model API you choose that charges over x402 in USDG on Robinhood Chain: url its chat completions URL (for example https://models.example/v1/chat/completions, its host in hosts), body the OpenAI-style request as JSON (sent with POST), maxPrice the most to pay for the call (for example "0.02").

Actions

| Action | What it does | Moves money | |---|---|---| | get_priors_agent_record | reads an agent's repayment record: loans repaid, late repayments, defaults, score | no | | get_priors_credit_line | reads an agent's line: size, drawn, available | no | | pay_x402_with_priors_credit | pays an x402 URL in USDG, at most maxPrice, with GET or with POST and a body; if the wallet is short, first borrows the gap (at least the pool's minimum loan, 5 USDG today) when maxBorrow covers it, or, with autoBorrow, on its own within its limits | yes | | borrow_from_priors | borrows USDG from the agent's line into the wallet | yes | | repay_priors_loan | repays a loan in full; approves exactly what is due | yes |

Only the agent's owner or its registry wallet can borrow against or repay its line, as in @priors/mcp: the wallet must control the agent at the pool and be its current owner or its declared ERC-8004 wallet (a pool delegate named by the owner alone is not enough), and repay_priors_loan pays only a loan the agent's current owner took. A loan more than three days late can be marked defaulted, which ends the agent's record on Priors. The reads use Priors' public API, no key.

What pay_x402_with_priors_credit will and will not do:

  • it pays only a public https host (an address that is private, loopback or link-local, or a name resolving to one, is refused before anything is fetched), and follows no redirect;
  • it signs exactly the requirement it probed and checked against maxPrice (the same payTo, the same amount), once, with @priors/x402's client (USDG on Robinhood Chain only, an authorization valid at most 600 s); a different one in the paid round's 402 is never signed;
  • one payment per purchase: until a payment it signed settles or expires, a call for the same purchase (the same method, URL and body, from the same wallet) sends that same payment again and borrows nothing more. Only a 2xx answer is reported as paid, also when its body breaks off (the answer then says so, and that calling again pays again); after any other one the answer says until when the seller may still settle it. This is kept in the process's memory: a restart within those 600 s forgets it;
  • a wallet's money actions run one at a time (pay, borrow, repay), and a seller's probe has 60 s to answer;
  • maxPrice, maxBorrow and amount are read exactly, at most 6 decimals (a longer one is refused, never rounded);
  • the seller's body comes back between per-call markers, each of its lines quoted (@priors/mcp's fence), and of its settlement header only the transaction hash: treat it as data, not instructions;
  • a loan taken for the gap stays in the answer if the payment then fails, a borrow sent whose answer was lost is named with its transaction, and a transaction whose receipt says it reverted is never reported as done.

maxPrice and maxBorrow are what the model passes: confirm them with the user, and keep the wallet's balance small.

Known issue in AgentKit

AgentKit sends an analytics event on every action call (to cca-lite.coinbase.com/amp). That endpoint answers HTTP 400 today, and AgentKit's action decorator leaves the rejection unhandled, which ends a Node process on the first action call. coinbase/agentkit#1537 fixes it. Until it ships, a Node host can log that one error instead:

process.on("unhandledRejection", (e) => {
  if (e instanceof Error && /^HTTP error! status: \d+$/.test(e.message)) return console.warn("AgentKit analytics:", e.message);
  throw e;
});

Demo

A production run on 2026-10-30 (agent #437, Robinhood Chain mainnet; the model calling these actions through @coinbase/agentkit-vercel-ai-sdk). The agent reads the seller's record, pays its x402 check (0.10 USDG) from an empty wallet by borrowing 5 USDG (loan #50884), and repays 5.011666 USDG after its income arrives. Transactions: borrow, payment, repayment.

Test

npm test   # builds, then runs test/*.test.cjs against the published @coinbase/agentkit

License

MIT