agent402-client 0.6.4 → 0.6.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +23 -4
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -29,11 +29,30 @@ const out = await a.call("hash", { text: "hello world", algo: "sha256" });
29
29
  console.log(out.hex);
30
30
  ```
31
31
 
32
- ## Paid tools (USDC via x402)
32
+ ## Paid tools: x402 or MPP, your choice of wire
33
33
 
34
- Wallet-only tools (live search, headless browser, PDFs, durable memory) settle
35
- in USDC. Pass an [`@x402/fetch`](https://www.npmjs.com/package/@x402/fetch)-wrapped
36
- fetch — your wallet signs, the client never touches your key:
34
+ Wallet-only tools settle in USDC. The SDK never touches your key: pass a
35
+ payment-aware `fetch` and it pays 402s for you. Two wires work out of the box,
36
+ because every paid route on Agent402 carries both offers on the same 402:
37
+
38
+ **Over MPP** (Machine Payments Protocol) with the [`mppx`](https://www.npmjs.com/package/mppx) client - USDC on Base/Celo (`evm`), or natively on Tempo (`tempo`):
39
+
40
+ ```js
41
+ import { Fetch, evm, tempo } from "mppx/client";
42
+ import { privateKeyToAccount } from "viem/accounts";
43
+
44
+ const account = privateKeyToAccount(process.env.AGENT_KEY);
45
+ const mppFetch = Fetch.from({ methods: [tempo.charge({ account }), evm.charge({ account })] });
46
+
47
+ const a = new Agent402({ fetch: mppFetch, maxPerCallUsd: 0.05 });
48
+ const verdict = await a.call("sql-guard", { sql: "UPDATE users SET plan = 'pro' WHERE id = 42" });
49
+ ```
50
+
51
+ The SDK's spending caps, reservations and caching apply identically on the MPP
52
+ path (pinned by `scripts/test-client-mpp.js` in the parent repo, which buys
53
+ through the SDK with a real mppx client).
54
+
55
+ **Over x402** with [`@x402/fetch`](https://www.npmjs.com/package/@x402/fetch) - USDC on any of the 12 x402 chains:
37
56
 
38
57
  ```js
39
58
  import { wrapFetchWithPayment } from "@x402/fetch";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "agent402-client",
3
- "version": "0.6.4",
4
- "description": "Buyer-side SDK for Agent402.Tools (x402): resolve a task to a tool across a catalog of 500+ pay-per-call endpoints (400+ tools + 100+ skill packs) and call it with payment handled for you - free tools settle via built-in proof-of-work (no wallet), wallet-only tools via your x402 fetch - with a withNetworkPreference helper to pick the settlement chain (USDC on Base/Solana/Polygon/Arbitrum/Monad/Celo/Avalanche/Sei/Optimism/Stellar/Algorand or USDG on Robinhood Chain - 12 chains). Caching, idempotent retries, cross-seller Smart Order Router.",
3
+ "version": "0.6.6",
4
+ "description": "Buyer-side SDK for Agent402.Tools (x402): resolve a task to a tool across a catalog of 500+ pay-per-call endpoints (400+ tools + 100+ skill packs) and call it with payment handled for you - free tools settle via built-in proof-of-work (no wallet), wallet-only tools via your x402 fetch - with a withNetworkPreference helper to pick the settlement chain (USDC on Base/Solana/Polygon/Arbitrum/Monad/Celo/Avalanche/Sei/Optimism/Stellar/Algorand or USDG on Robinhood Chain - 12 chains). Caching, idempotent retries, cross-seller Smart Order Router. Pays over x402 (@x402/fetch) or MPP (mppx: Base/Celo USDC or native Tempo) - hand it either payment-aware fetch.",
5
5
  "type": "module",
6
6
  "main": "index.js",
7
7
  "exports": {