Agent Kit Beta extends x402 allowing websites to enable agent traffic without falling victim to spam.
Agent Kit Beta extends x402 allowing websites to distinguish human-backed agents from bots and scripts.
Enable agentic traffic to access api endpoints while blocking malicious actors, scalpers and spam.This quickstart follows a default implementation path:
Accepts payments on both World Chain and Base
Agent registration on Worldchain
AgentBook lookup pinned to Worldchain
free-trial mode with 3 uses
Hono plus @x402/hono as the reference server example
By default, the CLI registers on Worldchain and submits through the hosted relay. That matches the lookup configuration used in the example below.During registration, the CLI:
Looks up the next nonce for the agent address
Prompts the World App verification flow
Submits the registration transaction
Once the wallet is registered, Agent Kit can resolve it to an anonymous human identifier at request time.
The example below shows the maintained Hono wrapper path. Agent Kit itself is not Hono-only: Express and Next.js route handlers can use the same hooks and low-level helpers from the SDK Reference.
Copy
Ask AI
import { Hono } from 'hono'import { serve } from '@hono/node-server'import { HTTPFacilitatorClient } from '@x402/core/http'import { ExactEvmScheme } from '@x402/evm/exact/server'import { paymentMiddlewareFromHTTPServer, x402HTTPResourceServer, x402ResourceServer,} from '@x402/hono'import { agentkitResourceServerExtension, createAgentBookVerifier, createAgentkitHooks, declareAgentkitExtension, InMemoryAgentKitStorage,} from '@worldcoin/agentkit'const WORLD_CHAIN = 'eip155:480'const BASE = "eip155:8453";const WORLD_USDC = '0x79A02482A880bCE3F13e09Da970dC34db4CD24d1'const payTo = '0xYourAddress'const facilitatorClient = new HTTPFacilitatorClient({ url: 'https://x402-worldchain.vercel.app/facilitator',})const evmScheme = new ExactEvmScheme() // Register a money parser to accept USDC payments on WorldChain. .registerMoneyParser(async (amount, network) => { if (network !== WORLD_CHAIN) return null return { amount: String(Math.round(amount * 1e6)), asset: WORLD_USDC, extra: { name: 'USD Coin', version: '2' }, } })const agentBook = createAgentBookVerifier({ network: 'world' })const storage = new InMemoryAgentKitStorage()const hooks = createAgentkitHooks({ agentBook, storage, mode: { type: 'free-trial', uses: 3 },})const resourceServer = new x402ResourceServer(facilitatorClient) .register(WORLD_CHAIN, evmScheme) .registerExtension(agentkitResourceServerExtension)const routes = { 'GET /data': { // Accept payments on both World Chain and Base accepts: [ { scheme: 'exact', price: '$0.01', network: WORLD_CHAIN, payTo, }, { scheme: 'exact', price: '$0.01', network: BASE, payTo, }, ], extensions: declareAgentkitExtension({ statement: 'Verify your agent is backed by a real human', mode: { type: 'free-trial', uses: 3 }, }), },}const httpServer = new x402HTTPResourceServer(resourceServer, routes) .onProtectedRequest(hooks.requestHook)const app = new Hono()app.use(paymentMiddlewareFromHTTPServer(httpServer))app.get('/data', c => { return c.json({ message: 'Protected content' })})serve({ fetch: app.fetch, port: 4021 })
This example payments on both WorldChain and Base while explicitly checking registrations against the World chainAgentBook deployment.
This guide uses free-trial mode so registered human-backed agents get 3 free requests before the normal x402 payment flow resumes. InMemoryAgentKitStorage is fine for local testing, but production should persist both usage counters and nonces.