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). Send POST /api/route/execute with no required fields (5 optional) and pay $0.01 per call over x402 or MPP (there is no free tier). It returns a JSON object with receipt and result.

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.

Category: Routing & delegation · Tags: router sor execute dispatch meta agent x402 buy

TRY IN PLAYGROUND →

Parameters

NameTypeRequiredDescription
taskstringnoPlain-language task, e.g. "sha256 hash of a string" - resolved via the same ranker as /api/find. Provide task OR slug.
slugstringnoExact tool slug to execute (skips ranking). Provide task OR slug.
paramsobjectnoInput for the resolved tool, matching its inputSchema (default {})
includestringnoWhere 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).
maxUsdnumbernoRefuse tools listed above this underlying price (default and ceiling: $0.005)

Example request

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

Without payment this returns HTTP 402 Payment Required with the exact price for route-execute; any x402 v2 or MPP client pays it and retries.

Example response

{
  "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": "…"
  }
}
FieldTypeAlways presentIn the example
receiptobjectyes9 fields: slug, route, underlyingPriceUsd, paidUsd, routingFeeUsd, seller
resultobjectyes3 fields: algo, hex, base64

From an MCP client

catalog.call {
  "slug": "route-execute",
  "params": {
    "slug": "hash",
    "params": {
      "text": "agent402",
      "algo": "sha256"
    }
  }
}

The hosted connector at https://agent402.tools/mcp needs a payment for route-execute; the stdio package pays it from a wallet or from AGENT402_CREDITS_KEY. Local install: npx -y agent402-mcp.

Errors and behavior

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();
client.setSpendControls?.(false); // keep your own spending ceiling in code
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"
    }
  }),
});

Related tools

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…

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…

Route and execute (pro tier)

$3.3 · POST /api/route/execute-pro

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

Decide: execute a plan

$0.001 · POST /api/decide/execute

Run a decision's plan through Agent402: first-party steps run directly, third-party steps are paid on your behalf (paid …

x402 seller dossier

$0.05 · POST /api/seller-dossier

Everything Agent402 knows about one x402 seller origin, in one read: identity and crawl history, the catalog with the pr…

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…