78trust / 100

Preflight Tool Call

by Agent Preflight in Weather & location

x402 APIPassing, checked 3 h ago

Pre-execution decision for a metered search or browse tool call. Evaluates the proposal; does not execute the external tool.

POST https://api.agent-preflight.com/v0.2/preflight/tool-call

Last 30 days

All checks passedSome failedAll failedNot checked
Uptime
100%
Response time
511 ms typical, 675 ms slowest 5%
Last check
3 h ago
Next check
any minute now

How to call it

# See the payment challenge (nothing is charged)
curl -i -X POST "https://api.agent-preflight.com/v0.2/preflight/tool-call" \
  -H "content-type: application/json" \
  -d '{"budget":{"maxToolCallsRemaining":4,"remainingUsd":0.08,"reservedUsd":0.02},"history":[],"runId":"settlement-check-01","stepId":"paid-call-01","task":{"goalHash":"settlement-verification"},"tool":{"estimatedExternalCostUsd":0.01,"estimatedModelCostUsd":0.002,"operation":"web_search","provider":"search","request":{"max_results":5,"query":"Acme Corp Series B funding"}}}'
import { wrapFetchWithPayment } from "@x402/fetch";
import { x402Client } from "@x402/core/client";
import { ExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";

const client = new x402Client().register(
  "eip155:8453",
  new ExactEvmScheme(privateKeyToAccount(process.env.AGENT_KEY)),
);
const pay = wrapFetchWithPayment(fetch, client);

// Not sure it's safe to pay? Preflight it first for $0.005:
// GET https://toolvet.app/api/v1/check?url=https%3A%2F%2Fapi.agent-preflight.com%2Fv0.2%2Fpreflight%2Ftool-call
const res = await pay("https://api.agent-preflight.com/v0.2/preflight/tool-call", {
  method: "POST",
  headers: { "content-type": "application/json" },
  body: JSON.stringify({"budget":{"maxToolCallsRemaining":4,"remainingUsd":0.08,"reservedUsd":0.02},"history":[],"runId":"settlement-check-01","stepId":"paid-call-01","task":{"goalHash":"settlement-verification"},"tool":{"estimatedExternalCostUsd":0.01,"estimatedModelCostUsd":0.002,"operation":"web_search","provider":"search","request":{"max_results":5,"query":"Acme Corp Series B funding"}}}),
});
console.log(await res.json());

Example input

{
  "budget": {
    "maxToolCallsRemaining": 4,
    "remainingUsd": 0.08,
    "reservedUsd": 0.02
  },
  "history": [],
  "runId": "settlement-check-01",
  "stepId": "paid-call-01",
  "task": {
    "goalHash": "settlement-verification"
  },
  "tool": {
    "estimatedExternalCostUsd": 0.01,
    "estimatedModelCostUsd": 0.002,
    "operation": "web_search",
    "provider": "search",
    "request": {
      "max_results": 5,
      "query": "Acme Corp Series B funding"
    }
  }
}

Example output

{
  "decision": "allow",
  "enforcement": "execute",
  "estimated": {
    "avoidableExternalCostUsd": 0,
    "avoidableModelCostUsd": 0,
    "billable": false,
    "confidence": 0.5,
    "netSavingsUsd": 0,
    "preflightCostUsd": 0,
    "priceChargedUsd": 0
  },
  "issues": [],
  "reasonCodes": [
    "NO_PROVEN_WASTE"
  ],
  "requestFingerprint": "f2aa17128536fec8262229a5654e49e9abc18f7f7387cb571a0d035906da9e0f"
}

Security scan

  • No findings. We scan names, descriptions and tool definitions for hidden instructions and other prompt-injection patterns.

Recent checks

WhenResultHTTPTimePrice
3 h agoPassed402381 ms$0.002
6 h agoPassed402385 ms$0.002
10 h agoPassed402511 ms$0.002
13 h agoPassed402583 ms$0.002
17 h agoPassed402600 ms$0.002
21 h agoPassed402675 ms$0.002
24 h agoPassed402422 ms$0.002
29 h agoPassed402335 ms$0.002
32 h agoPassed402445 ms$0.002
35 h agoPassed402620 ms$0.002
40 h agoPassed402808 ms$0.002