Decide: tool plan for a task
POST /api/decideDescribe a job and get a call-ready plan: which tools, across this catalog and outside x402 sellers with a recently verified 402, solve it end to end, in what order, with fallbacks, input params that validate against each tool's schema, and cost/latency estimates. Send POST /api/decide with the required field task and pay quoted per request from $0.005 over x402 or MPP (there is no free tier). It returns a JSON object with decisionId, task, depth, plan, estimatedCostUsd and 9 more.
Priced by depth: quick (one best tool), plan (steps + fallbacks), full (plan + params + compiled prompt). The fee comes back as a credit toward running the plan with POST /api/decide/execute. The ranking formula has no first-party term; every tool carries firstParty. Uncovered needs are listed in gaps.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
task | string | yes | What the agent needs done (max 2000 chars) |
depth | string (one of: quick, plan, full) | no | quick | plan (default) | full |
constraints | object | no | maxBudgetUsd, maxLatencyMs, rails [x402|mpp], chains [CAIP-2 or namespace], excludeSellers [host], requireDeterministic |
Example request
curl -i -X POST https://agent402.tools/api/decide \
-H "Content-Type: application/json" \
-d '{"task":"Research the latest EU AI Act obligations for general-purpose models, with citations","depth":"plan"}'
Without payment this returns HTTP 402 Payment Required with the exact price for decide; any x402 v2 or MPP client pays it and retries.
Example response
{
"decisionId": "dec_2b1c9e0f4a7d4c3e9b8a1f00",
"task": "Research the latest EU AI Act obligations for general-purpose models, with citations",
"depth": "plan",
"plan": [
{
"step": 1,
"purpose": "search recent sources on the EU AI Act GPAI obligations",
"tool": {
"id": "a1b2",
"slug": "search",
"name": "Web search",
"seller": "agent402",
"firstParty": true,
"endpoint": "https://agent402.tools/api/search",
"method": "GET",
"rail": "x402",
"rails": [
"x402",
"mpp"
],
"networks": [
"eip155:8453"
],
"priceUsd": 0.02,
"executeViaAgent402Usd": 0.02,
"inputSchema": {
"type": "object",
"properties": {
"q": {
"type": "string"
}
},
"required": [
"q"
]
},
"exampleParams": {
"q": "EU AI Act general-purpose AI model obligations 2026"
},
"exampleParamsSource": "task"
},
"why": "fit 0.92, score 0.801",
"score": 0.801,
"fallbacks": [],
"dependsOn": []
}
],
"estimatedCostUsd": 0.02,
"estimatedCostViaAgent402Usd": 0.02,
"estimatedLatencyMs": 1500,
"confidence": 0.92,
"partial": false,
"gaps": [],
"cached": false,
"priceUsd": 0.02,
"ranking": {
"weights": {
"fit": 0.45,
"reliability": 0.2,
"price": 0.15,
"schema": 0.1,
"freshness": 0.1
},
"firstPartyWeight": 0
},
"neutrality": "Every candidate is scored by one formula with the same weights: fit to the step, observed reliability, price, schema quality and a freshness pass mark. It has no term for who sells the tool, and every tool carries firstParty. Fit is judged from the same bounded description for every tool; reliability counts one observation per payer per day. Outside tools are eligible when a live 402 was seen within the configured window and their input schema is known."
}
| Field | Type | Always present | In the example |
|---|---|---|---|
decisionId | string | yes | dec_2b1c9e0f4a7d4c3e9b8a1f00 |
task | string | yes | Research the latest EU AI Act obligations for general-purpose models, with ci... |
depth | string | yes | plan |
plan | array of objects | yes | 1 item in the example |
estimatedCostUsd | number | yes | 0.02 |
estimatedCostViaAgent402Usd | number | yes | 0.02 |
estimatedLatencyMs | number | yes | 1500 |
confidence | number | yes | 0.92 |
partial | boolean | yes | false |
gaps | array | yes | 0 items in the example |
cached | boolean | yes | false |
priceUsd | number | yes | 0.02 |
ranking | object | yes | 2 fields: weights, firstPartyWeight |
neutrality | string | yes | Every candidate is scored by one formula with the same weights: fit to the st... |
From an MCP client
catalog.call {
"slug": "decide",
"params": {
"task": "Research the latest EU AI Act obligations for general-purpose models, with citations",
"depth": "plan"
}
}
The hosted connector at https://agent402.tools/mcp needs a payment for decide; the stdio package pays it from a wallet or from AGENT402_CREDITS_KEY. Local install: npx -y agent402-mcp.
Errors and behavior
taskis required. An input the tool rejects returns an HTTP 4xx whose body carrieserror,tool,expected,requiredandexample, so the caller can correct it.- A paid call that ends in any status of 400 or above is not charged: settlement is cancelled when the tool fails.
- Wallet-only: this tool reaches the network or stored state, so it has no proof-of-work tier. A prepaid card-credits key (
Authorization: Bearer a402_...) also pays it. - Priced per request: the 402 quotes this body, between $0.005 and $0.05.
- A
GETorHEADto /api/decide returns the same 402 quote, so the price can be read without a body. - An
Idempotency-Keyheader makes a retried paid call replay the first 200 instead of charging again.
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/decide", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
"task": "Research the latest EU AI Act obligations for general-purpose models, with citations",
"depth": "plan"
}),
});
Related tools
Decide: execute a plan
POST /api/decide/executeRun a decision's plan through Agent402: first-party steps run directly, third-party steps are paid on your behalf (paid …
A2A Agent Card fetch
POST /api/a2a-card-fetchDiscover and fetch a site's A2A (Agent2Agent protocol) Agent Card - tries /.well-known/agent-card.json then /.well-known…
Agent402 bestsellers
GET /api/bestsellersWhat agents actually pay for on a 500+ tool x402 catalog - the paid intelligence layer over Agent402's own sales ledger,…
agent demand radar
GET /api/demand-radarWhat agents want that no one is serving yet - the paid intelligence layer over Agent402's agent-demand board, for x402 s…
x402 seller dossier
POST /api/seller-dossierEverything Agent402 knows about one x402 seller origin, in one read: identity and crawl history, the catalog with the pr…
Check an x402 seller's trust evidence
GET /api/x402/seller-trustTrust evidence for any x402 seller origin: is it indexed, does its manifest parse, how many tools does it publish, which…