AI agents are pushing blockchain markets toward 24/7 algorithmic trading and payments. By April 2026, about 69,000 active agents had made over 165 million transactions through Coinbase's x402 payment protocol alone.
As agents gain access to wallets, tools, and financial infrastructure, security has to move to the moment before execution. One layer of it is checking the contracts and tokens an agent touches, because the agent acts on on-chain data without reading the code behind it. Honeypots and rug pulls have cost human traders plenty, and agents fall for the same traps, only faster.
A token risk API gives the agent a machine-readable signal to allow, limit, re-check, or block a transaction. GetBlock's Token Risks API, powered by Hexens' Glider engine, does this for EVM tokens in a single call.
Why AI agents need smart contract risk checks
Smart contracts do exactly what their code says. If the code is hostile, the contract still runs it. Before buying a token, a trader might notice suspicious behavior. LLMs executing trades don't automatically have that judgment. They operate on the data and rules available to them, without step-by-step human guidance.
So if an AI-driven system is going to interact with an arbitrary token contract, the agent needs a way to check whether the interaction is safe before it signs anything. Without a Web3 security API in the loop, it can't tell a normal token from a trap.
What makes AI agent transactions different
AI agents still send transactions to smart contracts, just like human-controlled wallets do. The difference is the decision and execution process around the transaction.
Agent-driven transactions:
Generated and signed programmatically, back-to-back or in parallel, especially on fast chains
Follow decisions made very quickly and at large scale
Go through without a human reviewing and approving each one
Repeat automatically

Two takeaways.
AI agents remove the human checkpoint from blockchain transactions, so security has to move into the transaction pipeline itself.
Because the agent is making these decisions automatically and at high speed, security checks need to happen automatically too.
How malicious smart contracts can exploit automated workflows
An AI agent can be attacked at multiple points: through the data it receives, the permissions it has, the transaction it creates, or the contracts it interacts with. Malicious smart contracts have always been a prominent attack surface in Web3. And automated workflows follow patterns, which makes them predictable targets.
Think of an autonomous trader. It discovers a trending token, checks a few trading conditions, and executes. If those conditions don't include a malicious contract check for code-level risks – honeypots, rug pull mechanics, balance manipulation, and similar tricks – the agent may buy a fraudulent token simply because it meets the strategy's criteria.
What is a Token Risk API?
A token risk API, also called a token security API, is a programmatic smart contract scanner. It takes a token contract address as input, analyzes the deployed contract code and logic, and returns an automated risk assessment. The agent doesn't need to understand the Solidity implementation itself.
GetBlock's Token Risks API works this way. Powered by Hexens' Glider, it parses the logic of each ERC-20 function and its dependencies and checks for 20+ threat types across major EVM chains: honeypots, hidden mint functions, blacklists, selfdestruct, hidden fees, backdoors, trading cooldowns, and more. The response is JSON, so an agent can branch on it directly.

Token risk data vs manual contract review
A manual review goes deeper because an auditor reads the source code and understands intent. It's also slow, which doesn't work for an agent that must check many assets and decide in seconds.
A token risk API automates the process and answers the key security questions. Can the owner mint? Can holders sell? Can transfers be blocked? The agent reads the token risk data and applies its rules. It also covers the long tail of tokens no one has manually audited.
It should still be treated as screening, not as a replacement for a full audit or human review. The main benefits over manual checks:
automated first-pass screening,
protection for the assets the agent touches at runtime,
results in a machine-readable format.
Where Token Risk APIs fit in Web3 security architecture
A token security API belongs in the transaction-security pipeline, right before an application or AI agent interacts with a previously unknown contract.
The API checks whether the target contract itself shows warning signs before the agent proceeds. On-chain agents can use these signals to decide whether a transaction should be allowed, limited, or blocked.
Other controls belong to the same layer. API key security protects the services the agent can call. Transaction simulation shows the expected result of a specific action. Address screening gives information about the counterparty. Wallet and signing controls limit what the agent is allowed to approve or execute.
Together, these form a Web3 security layer around the agent, instead of relying on the model to judge every interaction itself.
How a Token Risk API helps detect malicious smart contracts
GetBlock's Token Risks API uses automated static analysis to check token contract code. Its underlying engine, Glider, developed by blockchain security firm Hexens, looks for known risk patterns in token functions.
How it works:
It parses ERC-20 functions and their dependencies.
It compares the code against known malicious patterns.
It returns all detected risks in one JSON response.
The scan runs on 20+ EVM chains, including Ethereum, BNB Smart Chain, Polygon, and Base. Each check returns three things:
a boolean value (true means the pattern was found)
severity level: critical, high, medium, or low
description and the relevant code snippet
These token risk checks cover several categories:
Category | Checks | What it means |
Exit risk | Honeypot, Cannot Sell All, Trading Cooldown, Anti Whale, Hidden Fees, Honeypot Cooldowns | Can you get out, at what cost, and when |
Supply control | Mint Function / Centralized Mint, Balance Manipulation | Someone can dilute or rewrite holdings |
Owner powers | Hidden Owner, Blacklist Function, Asset Withdrawal, Backdoors | What the admin can do to holders without asking |
Mutability | Proxy Contract / Upgradeable, Pausable Proxy, Selfdestruct | Whether today's verdict survives tomorrow |
Opacity | Assembly Usage in Transfer, External Call Risk, Unverified Source | How much of the behavior the scan could actually see |
The agent can then use these findings to decide its next step.
Honeypot detection and sell restrictions
A honeypot token lets users buy but stops them from selling. For an automated trading agent, that's one of the most expensive mistakes it can make.
A honeypot check in the Token Risks API inspects the logic behind the token's transfer functions to find patterns that may block or limit transfers.
It can also catch less obvious variations of the same problem:
transfer cooldowns that interfere with exits
limits that restrict sale size
transfer fees that can be raised to unusually high levels
blacklist or whitelist logic that controls who can transfer
mechanisms that allow a first exit but restrict later transfers

Honeypot detection at the code level matters for agents because a honeypot often looks perfectly normal from the outside: the chart moves, buys go through, and the trap only shows up on the sell.
Risk scores, contract signals, and suspicious patterns
The API returns a risk score from 0 to 100. A high score means fewer risks were detected, not that the contract is totally safe. A low score means risk factors were identified, not that the contract is outright malicious.
The score arrives from the API fully computed. It's useful as a quick summary but shouldn't be the only input for an AI agent. The more actionable part of the response is the individual checks and named signals.
One example.
The agent wants to buy a trending token. The scan finds no honeypot or minting risk, but it detects a medium-severity blacklist function and a low-severity proxy contract. Total score: 72. The system doesn't block the trade. It limits the position size and runs the check again before signing. If the scan had found a honeypot, the agent would stop the trade.
In other words, use the risk score for a quick view. Use the individual risk signals to decide what the agent should do.

Liquidity, ownership, and rug pull risk signals
he Token Risks API can show rug pull risk signals when they come from the contract's own logic: functions or permissions that could drain value, such as ETH Balance Sweep, Excessive Token Withdrawal, or Unauthorized Token Approvals.
Ownership checks show how much control the owner keeps: minting, burning, blacklisting, pausing, or upgrading the contract. Think of it as the blast radius, the worst the owner could do today if they chose to.
A contract scan doesn't tell you whether LP tokens are locked, for how long, or how deep the pool is.
What the code can't also show is who is behind the token. For that, pair the contract scan with an address-level rug check. GetBlock's Rug Pull Checker scores the token creator and liquidity providers based on their on-chain history. Together, they give an agent two layers of context: what the contract allows, and what is known about the addresses behind it.

How AI agents can use transaction risk APIs before execution
The safest pattern is to run both token and transaction risk checks before the agent signs anything. A token risk API answers "is this asset safe to touch?" A transaction risk API, or a simulation step in your own stack, answers "does this exact call do what the agent expects?"
The implementation depends on the application, but the basic flow is:
screen the token contract,
validate the transaction,
decide what to do with that context.
Screening tokens before interaction
The first step is automatic token screening. Before an agent quotes, buys, or accepts a token as payment, it sends the address to a token scanner API. This filters out many obvious scams before any funds move.
A sample call to GetBlock's EVM Token Risks API:
1
2
3
4
5
6
7
curl -X POST 'https://services.getblock.io/v1/token-risks/check' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"network": "ETH",
"contract_address": "0xTOKEN_CONTRACT_ADDRESS"
}'
Then pair the code check with a behavioral one:
1
2
3
4
curl -X POST 'https://services.getblock.io/v1/rug-pull/check' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{"network":"ETH","contract_address":"0xTOKEN_CONTRACT_ADDRESS"}'
Note: the Token Risks API covers EVM tokens. Solana token security needs separate tooling, since SPL tokens run on a different program model, with mint and freeze authorities instead of ERC-20 functions.
Simulating or validating transactions before signing
Next, check the call itself. Start by decoding the calldata. It shows which function the agent is about to call and with what parameters, so unexpected approvals, unlimited allowances, or unknown recipients stand out before signing.
Then simulate the transaction against the current state to see whether it succeeds and what it changes. Reading the outcome – balance changes, internal calls, where the funds actually land – requires trace-capable RPC methods such as debug_traceCall or eth_simulateV1.
These transaction risk checks catch problems a token scan can't: a swap that routes output to the wrong address, or an approval far larger than the trade needs
Blocking or escalating high-risk actions
The final step is to turn risk signals into policy.
An AI agent shouldn't treat every flagged behavior as an automatic rejection. Map outcomes to actions: allow, block, or escalate to a human.
For example, a confirmed honeypot or a sanctioned counterparty means block. A medium-severity finding or an unverified contract might mean a smaller position or human approval. Write these rules in code outside the model, so a prompt injection can't talk the agent out of them.
Some tokens also have no verified source code, so agents need a clear rule for "no data" results.
API security for AI agents: Protecting the agent itself
Checking the token and the transaction is only half the job. An AI agent also needs access to the APIs and services it uses to make decisions and carry out actions: RPC endpoints, market data, and wallet infrastructure.
Each connection is another key, permission, or credential to protect. This is the practical side of API security in Web3: give the agent only the access it needs, protect its credentials, and put limits on what it can do. The goal is secure Web3 interactions even if one component of the system is compromised.
API keys, permissions, and least-privilege access
API key security should be part of the agent's architecture from the start.
Use separate credentials for different services, and give each agent only the access it needs.
Where possible, isolate read-only data services from transaction-signing infrastructure. The component that retrieves token risk data doesn't need permission to move funds.
Store keys in a secrets manager, never in the prompt context or a config file the model can read back.
Signing keys need harder limits: session keys, spending caps, and allowlisted contracts.
Separating these capabilities limits the damage if one part of the system is compromised.
Rate limits, logging, and abuse detection
Rate limits are not just a billing feature. They put a ceiling on how many requests an agent can make and limit the damage if a credential leaks.
Logging is equally important. Record which agent made the request, which contract or service it accessed, and what happened next. This makes unusual activity easier to investigate.
For high-value workflows, developers can also monitor for changes in behavior. Unexpected API usage, sudden request spikes, or unusual transaction patterns may mean that an agent or one of its inputs has been compromised.
Token Risk API use cases for AI agents
Any blockchain-based agent that handles tokens can benefit from a token risk API. The three most common setups are trading, payments, and DeFi automation.
Crypto trading agents
A token risk check is one of the tools that help build secure AI assistants for crypto trading.
Trading agents often chase new listings and fast-moving tokens, which is exactly where scams live. Before buying an unfamiliar asset, the agent can run a contract check.
GetBlock's Token Risks API can help identify hidden minting, blacklist mechanisms, blockable transfers, upgradeability, and other potentially dangerous behavior.
The agent then combines those results with market data, liquidity information, and its trading strategy before deciding whether the trade goes ahead.
Payment and treasury agents
Payment and treasury agents can screen a token before accepting it, holding it, or using it for automated payments. The Token Risks API can flag transfer restrictions, blacklist controls, or asset-withdrawal mechanisms. If the token passes these transaction risk checks, the agent continues with its payment workflow.
The other side of the payment is the recipient. For that, GetBlock's Wallet Risk Check or Crypto AML screening can check the counterparty address for sanctions exposure, phishing, money laundering links, and other AML risk categories.
DeFi automation and portfolio rebalancing
Before adding an unfamiliar ERC-20 to a portfolio or using it in a strategy, the agent can run a token contract check. The scan can flag transfer restrictions, blacklist controls, hidden fees, centralized minting, or upgradeable logic.
The agent can then reject the token, limit its allocation, or request manual approval. The same check can run whenever a strategy discovers a new asset for a swap or liquidity position.
The Token Risks API adds a contract-level safety check to DeFi automation. It doesn't replace transaction- or protocol-level checks, which are still needed before execution.
Limitations of Token Risk APIs
A token risk API is built for automated screening, not full audits. Its token risk assessment is fast enough for an agent to act on and catches known risk patterns early. That's the main value.
It doesn't cover every possible vulnerability, and it doesn't replace a complete smart contract audit, economic analysis, or broader due diligence.
Why risk scores should not be treated as guarantees
Risk scoring compresses many findings into one number. That's useful when you're screening large numbers of assets and need to sort or prioritize them quickly. The individual findings are more useful for decisions: they show which patterns were detected and how severe they are.
The general rule: a high score doesn't guarantee an asset is safe. Likewise, a low score doesn't automatically mean a token is malicious.
False positives, new threats, and missing data
There are three reasons a screening result isn't a guarantee:
Legitimate contracts use mechanisms that resemble risk patterns, such as an owner-only function or an upgradeable proxy. That can be an intentional design choice.
The API checks for patterns it knows how to detect. An attacker can build a new mechanism that the checks don't cover yet.
Some risks don't show up in the code at all: the deployer's reputation, the sustainability of the tokenomics, or the actual state of market liquidity. Those require other data or tools.
For reliable malicious token detection, combine multiple signals, especially when the value at stake is high.
Building a safer AI agent workflow with token risk checks
One API doesn't and shouldn't solve every problem. The workflow that survives real attackers is layered: code-level screening at discovery, counterparty screening and behavioral risk data before payouts, simulation before signing, and hard limits at the key. Token security API features cover the first step: finding the trap in the code.
A practical pre-transaction safety checklist
A token risk check can become a normal part of the agent's execution path like this:
Screen the contract at discovery. One Token Risks API call surfaces risk signals early.
Check which mechanisms were flagged and how they relate to the intended action. Don't rely on the overall score alone.
Apply application rules. Block critical findings, allow predefined patterns, and send uncertain cases for human approval.
Where appropriate, simulate or otherwise validate the exact transaction before signing.
For higher-value actions, add liquidity, ownership, deployer, counterparty, or other on-chain risk signals.
Keep API credentials and transaction permissions separate, and limit what the agent can do automatically.
Log every verdict and transaction, and alert on patterns that break the baseline.
Run any EVM token through GetBlock's free Token Risks API scanner before wiring it into your agent: five free checks a day, no signup, and contract-level analysis across 20+ EVM chains.
The rest of the risk layer runs on the same GetBlock key:
Rug Pull Check – creator and LP trust scores and a 0–100 risk score, from a model trained on 336K contracts.
Wallet Risk Check – counterparty screening in under 100 ms: predicted trust score, 18 AML categories, and sanctions.
Full Wallet Audit – adds predicted intentions, experience and risk-capability profile, protocol interaction history, and a transaction breakdown.
Crypto AML – scores wallet and transaction exposure to risky counterparties, with banded risk thresholds.
Add these to the RPC calls your agent already makes: EVM Data Streams for event-driven triggers, and the Token Insight API for metadata and liquidity context.
Building agent infrastructure at volume? GetBlock also covers shared RPC with volume pricing, dedicated nodes with higher rate limits and SLAs, and limitless nodes, which are a perfect fit for automated trading strategies.
Researcher
September 26, 2026
18 min read
Writer and researcher at GetBlock. Five years deep in blockchain and still curious about the next thing she hasn't figured out yet.
Popular Posts
December 4, 2026
8 min read
September 14, 2026
4 min read
September 11, 2026
10 min read
August 25, 2026
4 min read