SENTINEL Docs

Quick Start

Get started with Sentinel in under 5 minutes.

Install

npm install @valeo/x402
# or
pnpm add @valeo/x402

Sentinel requires @x402/core and @x402/fetch as peer dependencies. Install them if you haven't already.

Wrap Your Fetch

Add 4 lines to your existing x402 setup:

import { x402Client, wrapFetchWithPayment } from "@x402/fetch";
import { registerExactEvmScheme } from "@x402/evm/exact/client";
import { wrapWithSentinel, standardPolicy } from "@valeo/x402";

const client = new x402Client();
registerExactEvmScheme(client, { signer });
const fetchWithPayment = wrapFetchWithPayment(fetch, client);

const secureFetch = wrapWithSentinel(fetchWithPayment, {
  agentId: "agent-weather-001",
  budget: standardPolicy(),
});

const response = await secureFetch("https://api.example.com/weather");

Console Output

With default in-memory storage, you won't see console output. To verify Sentinel is working, add a hook:

const secureFetch = wrapWithSentinel(fetchWithPayment, {
  agentId: "agent-weather-001",
  budget: standardPolicy(),
  hooks: {
    afterPayment: async (record) => {
      console.log(`Paid $${record.amount} to ${record.endpoint}`);
    },
  },
});

Next Steps