smart402 evaluates every x402 payment request against your policy rules. Deterministically, in under 100ms, before any funds move.
Deterministic x402 payments risk engine
Your AI agent encounters an x402-protected resource and initiates a payment request. The smart402 hook intercepts it before any funds move.
13 policy types are checked in order: amount limits, budget windows, allowed tokens and chains, counterparty rules, time restrictions, on-chain risk score. Pure logic. No model inference.
The response arrives in <10ms with a clear decision and full audit trail.
Install the SDK, add one hook, set your policies. First evaluation in under five minutes.
from smart402 import Smart402Guard
guard = Smart402Guard(
api_key="ag_live_...", # dashboard → Settings → API Keys
agent_id="agent_abc123",
wallet_address="0x...", # your agent's EVM address
fail_mode="fail_open", # or "fail_closed" to block when API is down
)
# register once — fires before every payment
x402_client.on_before_payment_creation(guard.as_hook())
import { createSmart402Guard } from 'smart402';
const guard = createSmart402Guard({
apiKey: 'ag_live_...', // dashboard → Settings → API Keys
agentId: 'agent_abc123',
agentWalletAddress: '0x...', // optional: for audit trail
failMode: 'fail_open', // or 'fail_closed' to block when API is down
});
// In your x402 payment flow, before signing:
const result = await guard.evaluate({
amount: req.amount, // raw USDC units from x402 PaymentRequirements
token: 'USDC',
network: req.network,
pay_to: req.payTo,
});
if (result.decision === 'deny') {
console.log('Blocked by:', result.triggeredRules);
return; // agent skips, nothing moves
}
// approved — proceed to sign
Configure any combination. Each policy is a pure predicate: same inputs, same result, every time.
What smart402 is and isn't. Read this before you integrate.
Every decision is made by deterministic rules, not model inference. Same inputs always produce the same output (no hallucinations, no model drift, no API dependency in the hot path). Read why →
Every evaluation returns triggered_rules: the exact list of policies that fired.
You can reproduce any decision by replaying the inputs. You can write tests for it.
You can explain it to a user whose payment was blocked.
Every evaluation is recorded: agent, amount, token, chain, counterparty, decision, triggered rules, latency. Nothing happens without a trace. All logs are accessible via API or the dashboard.
Both SDKs are open source under Apache 2.0. Read every line of code that runs in your agent. Verify what data leaves your machine. The SDK is ~200 lines per language. No obfuscation, no minification, no telemetry.
The dashboard shows live transaction feeds, per-agent spend stats, and full key management.
Writing about AI agent infrastructure and x402.
What happens after a prompt injection attack succeeds? smart402 sits outside the blast radius: deterministic policy checks, no LLM, no attack surface that text can reach.
Read post →No. smart402's policy engine runs in a separate process from your agent. A compromised agent can attempt a payment, but the decision is made by a deterministic rule engine that the agent cannot influence or reason past. There is no LLM in the decision path, which means there is no prompt injection surface to exploit.
Any framework that supports Python or TypeScript: LangChain, CrewAI, AutoGen, Coinbase AgentKit, or a custom agent. Integration is a single lifecycle hook before payment execution (framework-agnostic by design).
You choose the failure mode at configuration time. fail_open
(default) lets payments proceed with a warning log if the policy engine is
unreachable. fail_closed blocks all payments until the engine is
available. No upstream model provider is involved.
Both SDKs (Python and TypeScript) are open source under Apache 2.0. You can read every line of code that runs in your agent. The API and dashboard are proprietary. View on GitHub →
LLM-based guardrails use a model to evaluate whether an action is safe, which means the same inputs can produce different outputs on different runs and a sufficiently creative prompt can change the decision. smart402 uses deterministic policy rules: same inputs, same output, every time. For decisions that control money movement, determinism is not optional.
Every evaluation returns a triggered_rules array: the exact list
of policies that fired. Every evaluation is logged with agent, amount, token,
chain, counterparty, decision, and latency. A human can read the policy config
and the evaluation log and independently verify that the right decision was made
(no code required).