Check the token, then check the transaction
A rug-check tells your bot whether a token looks dangerous. It says nothing about the transaction your bot is about to sign. That is a second, separate risk, and it is the one that empties wallets.
Two different questions
Before a bot buys a token, there are two things that can go wrong:
- The token is bad. Someone can still mint more, freeze your account, or one wallet holds enough to dump on you. A rug-check answers this from on-chain data.
- The transaction is bad. The bytes your bot signs do something else than "buy this token": they send funds to a different address, or include instructions you did not ask for. This happens when a bot builds its transaction from data it got from someone else, such as a third-party swap API, a copied route or a message from another agent.
A clean token in a malicious transaction still loses your money. A clean transaction for a rigged token does too. So the safest moment to ask is right before signing, about both.
One call: safe_buy
safe_buy runs both checks and gives one answer. You send the mint address and the unsigned transaction. We run our rug-check on the token, and pass the transaction to Presign Guard by Fizzl, which reads what it would actually do before anything is signed.
// POST https://api.agentfuel.eu/v1/safe-buy · 0.01 USDC via x402 { "mint": "<token mint>", "transaction": "<unsigned transaction, base64>", "intent": "buy 0.1 SOL of this token" }
The intent field is optional but useful: it tells the transaction check what the bot means to do, so it can spot a transaction that does something else.
How the verdict is built
Each check gives a colour, and the worst one wins.
| Token rug-check | Becomes |
|---|---|
level low (score below 15) | green |
level medium (15 to 39) | orange |
level high (40 or more) | red |
Presign Guard answers green, orange or red on the transaction itself. If one of the two checks cannot run, for example because a service times out, the answer is never better than orange. We would rather make your bot ask than let it buy on half the information.
| Verdict | Advice in the response |
|---|---|
| green | No red flags found in the token or the transaction. |
| orange | Ask your user before signing. |
| red | Do not sign this transaction. |
The response also lists the reasons, so a human or your agent can see why: for example "Token: The largest holder owns 21.4% of the supply."
In your bot
The check fits in the gap between building the transaction and signing it:
const tx = await buildBuyTransaction(mint, amount); // your existing code, unsigned const check = await safeBuy({ mint, transaction: toBase64(tx), intent: `buy ${amount} SOL of ${mint}` }); if (check.verdict === "red") return skip(check.reasons); if (check.verdict === "orange") return askHuman(check.reasons); await signAndSend(tx);
Here safeBuy is a POST to /v1/safe-buy with the x402 retry shown in the docs. A malformed request gets a 400 and is not charged. For AI agents, the same check is the safe_buy tool on our MCP server, inside the free trial of 50 calls a day:
claude mcp add --transport http agentfuel https://api.agentfuel.eu/mcp
What it does not do
Green means neither check found a red flag. It does not mean the token will hold its price, or that the people behind it are honest. Both checks are automated and read what is on-chain and in the transaction right now. Use the verdict as a brake, not as a reason to buy.