agent402-client 0.6.5 → 0.6.7
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.
- package/README.md +22 -5
- package/package.json +8 -3
package/README.md
CHANGED
|
@@ -29,13 +29,30 @@ const out = await a.call("hash", { text: "hello world", algo: "sha256" });
|
|
|
29
29
|
console.log(out.hex);
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
## Paid tools: x402 or MPP, your choice of wire
|
|
33
33
|
|
|
34
|
-
|
|
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:
|
|
35
37
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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:
|
|
39
56
|
|
|
40
57
|
```js
|
|
41
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
|
-
"description": "
|
|
3
|
+
"version": "0.6.7",
|
|
4
|
+
"description": "Agentic Finance (AIFI) buyer SDK: 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": {
|
|
@@ -41,7 +41,12 @@
|
|
|
41
41
|
"smart-order-router",
|
|
42
42
|
"robinhood-chain",
|
|
43
43
|
"usdg",
|
|
44
|
-
"multi-chain"
|
|
44
|
+
"multi-chain",
|
|
45
|
+
"agentic-finance",
|
|
46
|
+
"aifi",
|
|
47
|
+
"agentic-payments",
|
|
48
|
+
"mpp",
|
|
49
|
+
"machine-payments-protocol"
|
|
45
50
|
],
|
|
46
51
|
"author": "Havok Holdings LLC <mike@agent402.tools> (https://agent402.tools)",
|
|
47
52
|
"license": "MIT",
|