sell — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited sell (Agent Skill) and scored it 96/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 1 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 1 flagged
The text {match} tells the agent to skip the normal "ask the user first" gate. Used adversarially it removes the human-in-the-loop check before destructive or sensitive actions, turning a normally-gated agent into a fire-and-forget executor.
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
This skill converts an existing HTTP API into a paid API using the x402 payment protocol on Solana (USDC). It configures ag402 as a reverse proxy that returns 402 Payment Required to unauthenticated requests, verifies on-chain USDC payments, and forwards paid requests to the backend.
Result: A gateway URL that any x402-compatible buyer (AI agent, CLI, SDK) can call and pay per-request.
Check that ag402 is installed. Run silently — only speak if something is missing.
ag402 --versionIf this fails, install it:
pip install ag402-core ag402-mcpVerify again after install. If it still fails, STOP and tell the user.
Treat the user as a beginner who prefers choosing over typing. Present choices, not open-ended questions. Use the defaults aggressively — only ask when truly needed.
Ask the user to choose:
http://localhost:8000 as placeholder)http://localhost:8000 (ag402 will auto-start a built-in demo backend)Most users pick B. Default to B if the user is unsure.
Present choices (1 USDC ≈ $1):
Default: B ($0.01) if the user doesn't pick.
Ask the user to choose:
DemoRecipientWa11et11111111111111111111 + test mode. Tell the user: "No real money involved. You can switch to production later."Default: A (test mode). Most new users should start here.
SAFETY CHECK: If the user pastes a string that looks like a private key (significantly longer than 44 chars, or they say "private key"), STOP immediately. Say: "That looks like a private key — never share it. I need your public wallet address (the one you give people to send you money)."
Default: A. Recommend A for first-time users.
Set configuration values using ag402 env set (writes to ~/.ag402/.env with safe quoting and 0600 permissions).
ag402 env set AG402_TARGET_API <backend_url>
ag402 env set AG402_API_PRICE <price>
ag402 env set AG402_RECEIVE_ADDRESS <wallet_address>If the user chose test mode (Question 3 = A):
ag402 env set AG402_RECEIVE_ADDRESS DemoRecipientWa11et11111111111111111111
ag402 env set X402_MODE testVerify the config was written:
ag402 env showConfirm the output shows the correct values for AG402_TARGET_API, AG402_API_PRICE, and AG402_RECEIVE_ADDRESS.
CRITICAL: `ag402 serve` is a foreground blocking process. You must run it in the background so you can continue to the verification step.
Start the gateway in background:
ag402 serve --target <backend_url> --price <price> --address <wallet_address> --port 4020 &Wait for the server to be ready (typically 2-3 seconds):
sleep 3Then immediately verify it started by checking the port:
curl -s -o /dev/null -w "%{http_code}" http://127.0.0.1:4020/healthIf this returns 200, the gateway is up. If it returns 000 or fails, wait another 2 seconds and retry once. If it still fails, check the background process output for errors.
What happens:
http://0.0.0.0:4020 by default402 Payment Required response until valid payment is providedProceed directly to Step 5 — do NOT ask the user to "open another terminal".
Generate a docker-compose.yml tailored to the user's configuration.
Ask the user: "Is your backend API also running in Docker?"
host.docker.internal to reach host APIsTemplate for option A (backend in Docker):
services:
backend:
image: <user_backend_image>
ports:
- "<backend_port>:<backend_port>"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:<backend_port>/"]
interval: 5s
retries: 3
x402-gateway:
build:
context: .
dockerfile_inline: |
FROM python:3.11-slim
RUN pip install --no-cache-dir ag402-core ag402-mcp
ENTRYPOINT ["ag402-gateway"]
command: >
--target http://backend:<backend_port>
--price <price>
--address <wallet_address>
--host 0.0.0.0
--port 4020
ports:
- "4020:4020"
environment:
- X402_MODE=test
depends_on:
backend:
condition: service_healthyTemplate for option B (external backend) or C (demo):
services:
x402-gateway:
build:
context: .
dockerfile_inline: |
FROM python:3.11-slim
RUN pip install --no-cache-dir ag402-core ag402-mcp
ENTRYPOINT ["ag402-gateway"]
command: >
--target <backend_url_or_http://localhost:8000>
--price <price>
--address <wallet_address>
--host 0.0.0.0
--port 4020
ports:
- "4020:4020"
environment:
- X402_MODE=testFor option B, replace localhost in --target with host.docker.internal.
docker compose up -d
docker compose psWait for the gateway container to be healthy, then proceed to Step 5.
For deploying to a remote server via SSH. Ask the user for <user>@<host>.
ssh <user>@<host> "pip install ag402-core ag402-mcp && ag402 --version"ssh <user>@<host> "ag402 env set AG402_TARGET_API <backend_url> && ag402 env set AG402_API_PRICE <price> && ag402 env set AG402_RECEIVE_ADDRESS <wallet_address>"Generate this file and copy it to the remote:
[Unit]
Description=Ag402 x402 Payment Gateway
After=network.target
[Service]
Type=simple
ExecStart=/usr/local/bin/ag402 serve --port 4020
Restart=on-failure
RestartSec=5
Environment=X402_MODE=test
[Install]
WantedBy=multi-user.targetscp ag402-gateway.service <user>@<host>:/tmp/
ssh <user>@<host> "sudo mv /tmp/ag402-gateway.service /etc/systemd/system/ && sudo systemctl daemon-reload && sudo systemctl enable --now ag402-gateway"Verify:
ssh <user>@<host> "sudo systemctl status ag402-gateway && curl -s http://127.0.0.1:4020/health"If systemd is not available (e.g., container environment), fall back to nohup:
ssh <user>@<host> "nohup ag402 serve --port 4020 > /tmp/ag402.log 2>&1 &"Run these checks. All three must pass. Since the gateway is already running (from Step 4), run these directly.
curl -s -o /dev/null -w "%{http_code}" http://127.0.0.1:4020/Expected: 402. If 000 or connection refused → gateway not running, re-check Step 4.
ag402 pay http://127.0.0.1:4020/Discovers price → creates payment → gets response. In test mode, payment is simulated. Expected: JSON response with HTTP 200.
curl -s http://127.0.0.1:4020/healthExpected: JSON with "status": "healthy" showing mode, target URL, and metrics.
If all three pass, tell the user: "Your API is live and accepting payments!"
After verification passes, present the user's gateway info and ask what they want to do next:
Gateway info:
http://<host>:4020$<price> USDC per callAsk the user:
ag402 pay http://<host>:4020/endpoint, remind them 127.0.0.1 is local-only and explain how to share externallyag402 upgrade (this is an interactive command that handles private key encryption, RPC URL, and daily limits). Note: ag402 upgrade uses interactive prompts (password input, confirmations) — let the user run it directly, do not try to automate the interactive prompts. AI agents cannot run this autonomously — it requires human input for private key and password.ag402 doctor to check the full environmentFor AI agent buyers, mention they can connect via ag402 mcp or the Python SDK.
| Error | Cause | Fix | |
|---|---|---|---|
ag402: command not found | Not installed | pip install ag402-core ag402-mcp | |
Missing dependency: ag402-mcp | Partial install | pip install ag402-mcp | |
No backend API URL specified | Missing --target and no .env | ag402 env set AG402_TARGET_API <url> | |
Gateway returns 502 | Backend unreachable | Check backend is running; in Docker use service name not localhost | |
Gateway returns 403 | Payment verification failed | Check wallet address; ensure X402_MODE=test for testing | |
Address already in use on port 4020 | Port conflict | Use --port <other> or kill existing: `lsof -ti:4020 \ | xargs kill` |
curl: (7) Failed to connect | Gateway not running | Re-run ag402 serve &; for Docker check docker compose ps | |
| Docker: backend unreachable | Docker networking | Use service name (not localhost) or host.docker.internal | |
ag402 serve hangs / no output | Foreground process | You ran it without &. Stop it (Ctrl+C) and re-run with & |
localhost or 127.0.0.1 used as --target inside Docker — STOP, explain Docker networkingDemoRecipientWa11et... — STOP, run ag402 upgrade first127.0.0.1 — use 0.0.0.0 or explain0 — ask: "Did you mean free? Verification still runs but no payment is collected."Minimal happy path — local test mode, no wallet needed:
# Install
pip install ag402-core ag402-mcp
# Configure
ag402 env set AG402_TARGET_API http://localhost:8000
ag402 env set AG402_API_PRICE 0.01
ag402 env set AG402_RECEIVE_ADDRESS DemoRecipientWa11et11111111111111111111
ag402 env set X402_MODE test
# Start gateway in background (auto-starts demo backend if needed)
ag402 serve &
sleep 3
# Verify
curl -s -o /dev/null -w "%{http_code}" http://127.0.0.1:4020/ # → 402
ag402 pay http://127.0.0.1:4020/ # → 200 + JSON
curl -s http://127.0.0.1:4020/health # → healthy
# When done testing, switch to production:
ag402 upgrade~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.