Agent402 / tools / route-execute

Route and execute

$0.01 per call · USDC via x402 · POST /api/route/execute

Describe a task (or name a slug) and the Smart Order Router resolves the best-matching tool and RUNS it in the same call - flat $0.01 covering any tool listed at $0.005 or less, from THIS host's catalog or any external seller in the open index - x402 sellers, or MPP sellers on Tempo (paid on your behalf over x402 or MPP, result relayed). One payment, one request, result + receipt. /api/route quotes which tier a task needs; pricier tools return a self-correcting 409 with their direct route.

TRY IN PLAYGROUND →

Input

FieldTypeDescription
taskstringPlain-language task, e.g. "sha256 hash of a string" - resolved via the same ranker as /api/find. Provide task OR slug.
slugstringExact tool slug to execute (skips ranking). Provide task OR slug.
paramsobjectInput for the resolved tool, matching its inputSchema (default {})
includestringWhere to route: default runs a tool from THIS host's catalog; "external" routes to the best-matching x402 seller in the OPEN index and pays it on your behalf (result relayed, marked untrustedContent). Requires task (not slug).
maxUsdnumberRefuse tools listed above this underlying price (default and ceiling: $0.005)

Example output

{
  "receipt": {
    "slug": "hash",
    "route": "POST /api/hash",
    "underlyingPriceUsd": 0.001,
    "paidUsd": 0.01,
    "routingFeeUsd": 0.009,
    "seller": "internal",
    "resolvedBy": "slug",
    "ts": "2026-07-10T00:00:00.000Z",
    "callRef": "sha256:…  (recomputable: sha256 of {\"nonce\":<payment authorization nonce>,\"slug\":…,\"ts\":…} - null on nonce-less calls)"
  },
  "result": {
    "algo": "sha256",
    "hex": "…",
    "base64": "…"
  }
}

Try it - see the 402 challenge (free)

curl -i -X POST https://agent402.tools/api/route/execute \
  -H "Content-Type: application/json" \
  -d '{"slug":"hash","params":{"text":"agent402","algo":"sha256"}}'

The response is HTTP 402 Payment Required with exact payment requirements. Any x402 v2 client pays automatically and retries:

Paid call (JavaScript agent)

import { wrapFetchWithPayment } from "@x402/fetch";
import { x402Client } from "@x402/core/client";
import { registerExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";

const client = new x402Client();
registerExactEvmScheme(client, { signer: privateKeyToAccount(KEY) });
const payFetch = wrapFetchWithPayment(fetch, client);

const res = await payFetch("https://agent402.tools/api/route/execute", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "slug": "hash",
    "params": {
      "text": "agent402",
      "algo": "sha256"
    }
  }),
});
Wallet-only. This tool reaches the network/browser/storage, so it is paid in USDC via x402 (no proof-of-work tier).

Related tools

AI agent action preflight

$0.010 · POST /api/action-gate

Deterministic preflight check for a proposed AI agent action - a tool call, payment, fetch, or write - before it execute…

try in playground →

Route and execute (plus tier)

$0.05 · POST /api/route/execute-plus

Describe a task (or name a slug) and the Smart Order Router resolves the best-matching tool and RUNS it in the same call…

try in playground →

Route and execute (max tier)

$0.55 · POST /api/route/execute-max

Describe a task (or name a slug) and the Smart Order Router resolves the best-matching tool and RUNS it in the same call…

try in playground →