Skip to content

axonfi/examples

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Axon Examples

Working examples showing how AI agents use Axon — agentic finance with secure vaults — to make on-chain payments without holding funds or paying gas.

What is Axon?

Think of it like a corporate credit card for AI agents. You (the owner) set up a vault with USDC, register your bot with spending limits ($50/day, $10 per transaction), and the bot can pay for things on its own. If it tries to spend too much, it gets blocked. You can watch everything from a dashboard and approve/reject suspicious payments.

Examples

Example Lang What it does (plain English)
vault-setup Python Deploy everything from code. Deploys a vault, generates a bot key, sets spending limits, deposits ETH, and makes a test payment. No dashboard needed.
vault-setup TypeScript Deploy everything from code. Same flow as above — vault deploy, bot setup, deposit, test payment.
aave-lending Python Earn yield on Aave. Supplies USDC to Aave V3, gets aTokens back in the vault. Shows how to use tokens NOT in Axon's built-in list (Aave's own test USDC).
aave-lending TypeScript Earn yield on Aave. Supply/withdraw USDC via Aave V3 Pool. Demonstrates working with arbitrary token addresses.
swap-and-pay Python Pay USDC when vault only has WETH. The relayer auto-swaps via Uniswap and sends the payment in one transaction. Bot code is identical to a direct payment.
swap-and-pay TypeScript Pay USDC when vault only has WETH. Same auto-swap pattern in TypeScript.
langchain-api-agent Python A chatbot that can send money. You talk to it in natural language ("pay 5 USDC to 0xABC for the weather data") and it sends the payment from your vault. Built with LangChain + Claude.
langchain-api-agent TypeScript Same chatbot-that-pays, but in TypeScript. LangChain.js + Claude + @axonfi/sdk.
cli-payments Python Venmo from the command line. python cli.py pay 0xABC USDC 5 sends 5 USDC. Also checks balances and payment status. Simplest possible Axon integration.
defi-trading-agent Python Auto-buys ETH when the price dips. Watches ETH/USD on CoinGecko every 30 seconds. When ETH drops below $2,000, it swaps USDC to WETH inside the vault via Uniswap on Base. Like a DCA bot, but the funds never leave the vault.
uniswap-lp Python Provide liquidity on Uniswap V3. Mints a USDC/WETH LP position — the vault holds the NFT. Shows the multi-token approval pattern: persistent WETH approval + auto USDC approval in one flow.
uniswap-lp TypeScript Provide liquidity on Uniswap V3. Same LP flow in TypeScript — mint, remove, collect. Demonstrates amount=0 for persistent approvals and no-approval protocol calls.
scheduled-payments Python Recurring payments on autopilot. Define a schedule in JSON (who, how much, how often) and the bot sends payments automatically. Payroll, subscriptions, API credits — with spending limits enforced by the vault.
ostium-perps-trader Python Opens perpetual futures from a vault. The vault itself is the trader on Ostium — it approves USDC, calls openTrade, and the position belongs to the vault. Gains stay under owner control, not the bot.
batch-payments TypeScript Pay a list of people at once. Load a JSON or CSV of recipients and amounts, bot pays them sequentially. Bounty payouts, revenue splits, airdrops — with spending limits on each.
elizaos-agent TypeScript An ElizaOS character that can tip people. Uses @axonfi/plugin-elizaos. Say "tip @alice 10 USDC" and it pays from the vault. (Coming soon)
vault-rebalance Python Swap tokens inside the vault. Demonstrates executeSwap() with bot-signed fromToken and maxFromAmount — the bot controls which token is sold and caps the cost. Output stays in the vault.
vault-rebalance TypeScript Swap tokens inside the vault. Same rebalancing flow in TypeScript. Bot signs both sides of the swap — relayer cannot substitute the input token or overspend.
express-402-server TypeScript A paywall for APIs. Your server returns HTTP 402 ("Payment Required"). The bot detects it, pays via x402, retries with a payment signature, and gets the data.

Prerequisites

  1. Deploy a vault on Base Sepolia (free testnet — no real money)
  2. Get test USDC from Circle Faucet and deposit it into your vault
  3. Register a bot in the dashboard — this gives you a bot private key

Quick Start

# Python
cd python/langchain-api-agent
pip install -r requirements.txt
cp .env.example .env  # Put your vault address, bot key, and Anthropic key
python agent.py

# TypeScript
cd typescript/langchain-api-agent
npm install
cp .env.example .env
npx tsx agent.ts

Links

About

Working examples — AI agents making on-chain payments with Axon (LangChain, CLI, DeFi)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors