true402
guide · Coinbase AgentKit

Add a rug-check to your Coinbase AgentKit agent

If your Coinbase AgentKit agent can touch Base tokens, it can get rugged. Add a true402 action and it will simulate a real buy/sell before committing capital — proving a token can actually be sold instead of trusting a static scan.

Install and wire the rug-check action into a Coinbase AgentKit agent
npm i @true402.dev/agentkit @coinbase/agentkit

import { AgentKit } from '@coinbase/agentkit';
import { createTrue402ActionProviders } from '@true402.dev/agentkit';

const agentKit = await AgentKit.from({
  walletProvider, // your configured Base WalletProvider
  actionProviders: createTrue402ActionProviders({
    payerPrivateKey: process.env.PAYER_PRIVATE_KEY!, // Base wallet holding a little USDC
  }),
});
// Agent now has six actions: true402_token_report (primary pre-trade gate),
// true402_token_safety, true402_address_safety, true402_deployer_check,
// true402_tx_preflight (inspect an UNSIGNED tx before signing it) and
// true402_liquidity_history (removals already observed against the token).
// Surface them via getLangChainTools(agentKit) or getVercelAITools(agentKit).
§01 · the setup

Install the action provider

The @true402.dev/agentkit package exposes true402's safety stalls as ready-made AgentKit action providers. Install it alongside @coinbase/agentkit:

  1. Add the packages: npm i @true402.dev/agentkit @coinbase/agentkit
  2. Pin the SDK — AgentKit is pre-1.0 and the API still moves. The verified current release is @coinbase/agentkit 0.10.4; pin it so a minor bump doesn't reshape the action API under you.
  3. Set a PAYER_PRIVATE_KEY env var — a Base wallet the agent controls. In true402 the wallet is the identity: there is no account to create and no API key to store or rotate.
  4. Fund it later if you need volume — most safety stalls include a small free daily trial (deployer-check is the exception, see §05), so you can wire everything up and test before spending anything.

Under the hood each action call is an x402 request: USDC on Base, pay-per-call, settled from the payer key you pass in.

§02 · the wiring

Add the rug-check action to your agent

One factory call returns the array of action providers you drop straight into AgentKit.from. There is no separate register step — registration is just adding to the actionProviders array.

  1. Import the factory: import { createTrue402ActionProviders } from '@true402.dev/agentkit';
  2. Build the providers with your payer key: createTrue402ActionProviders({ payerPrivateKey: process.env.PAYER_PRIVATE_KEY! })
  3. Pass the result as actionProviders to AgentKit.from({ walletProvider, actionProviders: [...] }).
  4. Surface the actions to your LLM framework with an adapter — getLangChainTools(agentKit) or getVercelAITools(agentKit). That is the only extra step.

The agent now carries six actions: true402_token_report (the primary pre-trade gate), true402_token_safety, true402_address_safety, true402_deployer_check, true402_tx_preflight and true402_liquidity_history. They map to the stalls POST /v1/base/token-report (composite avoid/caution/ok verdict, ~$0.01), POST /v1/token-safety (structural score 0-100, ~$0.005), POST /v1/base/address-safety (~$0.005), POST /v1/base/deployer-check (~$0.008), POST /v1/base/tx-preflight (~$0.008) and POST /v1/base/liquidity-history (~$0.005), all off the API base https://true402.dev/api.

The last two are the ones most integrations miss. true402_tx_preflight takes the unsigned transaction your agent is about to sign — it receives no private key and no signature, so it cannot broadcast or front-run what it inspects — and returns three lenses: a simulation against current state (does it revert?), the decoded intent (is this an unlimited approval that outlives the trade?), and the counterparty's liquidity-removal history. true402_liquidity_history answers the question a live simulation structurally cannot, because it is about the past: every removal event observed against the token, with amount, block and transaction hash, plus the other tokens drained in the same transaction. A pool drained last month simulates perfectly today if someone re-seeded it. Neither action ever returns a verdict of safe — each answer carries the block range the index actually covers, so none observed is not a claim of safety.

§03 · roll your own

Or write the action by hand with customActionProvider

If you'd rather not add a dependency, AgentKit's customActionProvider factory wraps a plain HTTP fetch as an action — no class, no decorators, no tsconfig changes. It is the simplest way to call a single stall:

  1. Import the factory and Zod: import { customActionProvider, EvmWalletProvider } from '@coinbase/agentkit'; and import { z } from 'zod';
  2. Type it over the EVM wallet: customActionProvider<EvmWalletProvider>({ name, description, schema, invoke }). It is network-agnostic by default (supportsNetwork => true).
  3. Give schema a Zod object and .describe() each field so the LLM gets clean argument hints: z.object({ tokenAddress: z.string().describe('ERC-20 contract address') }).
  4. Write invoke: async (walletProvider, args) => string. walletProvider is always the first parameter even though the token-safety call ignores it. fetch the stall, then return JSON.stringify(json)invoke MUST return a Promise<string>; returning a raw object will not behave correctly.

The class form (extend ActionProvider, decorate a method with @CreateAction, implement supportsNetwork) also works, but it requires experimentalDecorators: true and emitDecoratorMetadata: true in tsconfig.json or the decorator silently fails to register the action. For a pure HTTP wrapper, prefer the function form and skip the decorators entirely. In Python the equivalent is a @create_action method on an ActionProvider subclass with a Pydantic schema — don't mix the two APIs.

§04 · the pattern

The pre-trade gate: check the verdict before you buy

Don't let the model decide in prose whether a token is safe. Make the rug-check a hard gate in your trade path: the agent must obtain a verdict from true402_token_report and abort on anything that isn't ok.

  1. Before any buy, call token-report with the token address.
  2. Read the composite verdict: avoid → refuse the trade; caution → require an explicit override or downsize the position; ok → proceed.
  3. For a cheaper first pass, gate on token-safety's 0-100 structural score, then escalate to token-report only for borderline tokens. Screen a spender or router with address-safety before an approve or call.

What makes the verdict trustworthy is that token-report runs a real on-chain buy/sell honeypot simulation via state-override eth_call — it actually proves the token can be sold, rather than pattern-matching source code. It also folds in liquidity, ownership/mint authority, and deployer reputation. A static scanner can be fooled by a token that looks clean but blocks sells; a simulated sell cannot.

§05 · paying

Free trial, then per-call over x402

There is no billing dashboard and no key to rotate. Payment settles per call straight from the payer wallet:

  1. Free daily trial — most safety stalls grant a small number of free calls per day, enough to build and test the gate without spending: token-report, token-safety, address-safety, tx-preflight and liquidity-history. deployer-check is excluded — it depends on a keyed third-party explorer API, so it is paid from the first call.
  2. Per-call over x402 — beyond the trial, each call costs a few tenths of a cent in USDC on Base (~$0.005–$0.01 depending on the stall). The factory handles the 402 → pay → retry flow using PAYER_PRIVATE_KEY.
  3. No account, no API key — the wallet is the identity, so onboarding a new agent is just funding a Base key with a little USDC.

See per-stall pricing and payloads in the API docs.

§06 · try it now

Zero-setup smoke test

Before touching your agent code, sanity-check any Base token — paste an address into the hosted checker at true402.dev/check to see the same verdict your agent will receive.

  1. Run a token you already hold or are watching through the checker.
  2. Confirm the composite verdict and the honeypot simulation result look right.
  3. Then drop createTrue402ActionProviders into AgentKit.from and make token-report the gate in front of every buy.

Once wired, your AgentKit agent proves sellability on-chain before it ever spends capital.

§ questions

Answered for machines.

How is this different from a static token scanner?

A static scanner reads the contract and guesses. The true402 token-report runs a real on-chain buy/sell honeypot simulation using state-override eth_call, so it proves the token can actually be sold. It also weighs liquidity, ownership and mint authority, and deployer reputation into one composite verdict.

Do I need an API key or a Coinbase Developer account for this?

No. true402 uses x402 payments where the wallet is the identity. You pass a PAYER_PRIVATE_KEY to createTrue402ActionProviders and each call settles in USDC on Base. There is no signup, no dashboard, and no API key to store or rotate — funding a Base wallet is the entire onboarding step. It is separate from your AgentKit walletProvider.

customActionProvider or the @CreateAction class form — which should I use?

For wrapping true402's HTTP call, use the customActionProvider function form: name, description, a Zod schema, and an async invoke(walletProvider, args) that returns a string. It needs no class and no tsconfig changes. The @CreateAction class form requires experimentalDecorators and emitDecoratorMetadata in tsconfig.json, or the decorator silently fails to register the action.

What does a rug check cost per call?

Most safety stalls carry a small free daily trial, so you can build and test for free — token-report, token-safety, address-safety, tx-preflight and liquidity-history are all in it. deployer-check is deliberately not: it needs a keyed third-party explorer API, so it is paid from the very first call. Beyond the trial you pay per call in USDC on Base: token-report is about $0.01; token-safety, address-safety and liquidity-history about $0.005; deployer-check and tx-preflight about $0.008. The factory handles the 402 payment flow from your payer key.

How do I make the verdict an actual trade gate instead of a suggestion?

Call token_report before any buy and branch on its composite verdict in code, not in the prompt. Treat avoid as a hard refusal, caution as requiring an override or a smaller position, and ok as clear to proceed. Making it a code-level gate is what actually stops the agent buying a honeypot.