Skip to content

feat: add AgentForge action provider - #1619

Open
acarchidi wants to merge 1 commit into
coinbase:mainfrom
acarchidi:feat/agentforge-action-provider
Open

acarchidi wants to merge 1 commit into
coinbase:mainfrom
acarchidi:feat/agentforge-action-provider

Conversation

@acarchidi

Copy link
Copy Markdown

Description

Adds an AgentForge action provider: DeFi safety checks that agents pay for per call in USDC on Base over x402, from the agent's own wallet. No API key.

Action What it does Price
simulate_transaction Simulates 1-5 EVM transactions before signing (via eth_simulateV1): decoded revert reasons, net asset changes for the sender, approvals granted, counterparty sanctions/scam screening, proceed/caution/avoid verdict $0.005
check_addresses Screens 1-100 EVM or Solana addresses against OFAC sanctions, scam/phishing wallets, and fresh address-poisoning wallets $0.003 + $0.001/extra
check_token_before_trade Rug-check metrics + AI risk assessment + gas for an ERC-20, with a verdict $0.025
get_new_token_launches Newly launched tokens on Base, Ethereum, or Arbitrum, already risk-scored; poll with since $0.005
score_tokens Risk scores for 2-25 tokens in one call $0.004/token
check_lending_health Aave v3 liquidation risk on five chains $0.003

Design notes:

  • Payments. These use the same x402 client setup as the existing x402 provider: registerExactEvmScheme with walletProvider.toSigner(). A registerPolicy filter drops any payment option above maxPaymentUsdc (default 0.05, or the AGENTFORGE_MAX_PAYMENT_USDC env var) before anything is signed.
  • Defaults. simulate_transaction.from and check_lending_health.address default to the agent's own wallet.
  • Errors. Failures return a JSON error string instead of throwing, matching the x402 provider.
  • Network. supportsNetwork is base-mainnet, because payments settle there. The checked transactions and tokens can be on Ethereum, Base, Arbitrum, Optimism, or Polygon via each action's chain argument.

The API is live at https://agentforge-taupe.vercel.app and listed in the CDP x402 Bazaar. Every paid route answers an unpaid request with 402 and its exact price, and failed calls (4xx/5xx) are never settled.

Tests

  • jest src/action-providers/agentforge: 5/5 passing. Covers the request shape per action, defaulting to the wallet address, GET query encoding, the spending-cap policy (filters 50001 atomic units at a 0.05 cap), and JSON errors for both HTTP failures and thrown errors.
  • tsc --noEmit, eslint, and prettier -c are clean for the new files.
  • Live check against production: a compiled build with a real ViemWalletProvider on base-mainnet and a fresh empty wallet.
Network: base-mainnet
Setup: ViemWalletProvider, fresh empty wallet, compiled with tsc

check_lending_health (cap 0.05) ->
{ "error": true, "status": 402, "message": "AgentForge request failed with status 402" }
  # the payment was signed and submitted; settlement rejected it because the wallet holds no USDC

check_token_before_trade (cap 0.001, price 0.025) ->
{ "error": true, "details": "Failed to create payment payload: All payment requirements were filtered out by policies for x402 version: 2" }
  # the spending cap blocked the payment before any signature

I haven't run a funded end-to-end session through the example chatbots. Happy to add one if reviewers want it.

Checklist

  • Added a changeset (@coinbase/agentkit minor)
  • Added the provider README
  • Exported from action-providers/index.ts (alphabetical)
  • Commit is signed (created via GitHub, verified)

🤖 Generated with Claude Code

x402-paid DeFi safety checks: pre-sign transaction simulation, sanctions and scam address screening, pre-trade token checks, a risk-scored new-launch feed, batch token risk scoring, and Aave liquidation risk.
@github-actions github-actions Bot added documentation Improvements or additions to documentation action provider New action provider typescript labels Nov 3, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action provider New action provider documentation Improvements or additions to documentation typescript

Development

Successfully merging this pull request may close these issues.

1 participant