Open-source framework for building autonomous AI agents that interact with blockchain networks
Project description
๐ค Web3 Agent Kit
Build autonomous AI agents that interact with blockchains โ in minutes, not months.
๐ค Why Web3 Agent Kit?
Building AI agents that interact with blockchains is hard. You need to juggle RPC providers, wallet management, transaction signing, gas estimation, DeFi protocol ABIs, LLM integration, and safety rails โ all before writing a single line of business logic.
Web3 Agent Kit handles all of that for you.
| Pain Point | Without Web3 Agent Kit | With Web3 Agent Kit |
|---|---|---|
| Setup | Days of boilerplate | pip install โ 5 lines of code |
| Multi-chain | Write adapters per chain | Built-in for 7+ chains |
| LLM Integration | Manual prompt engineering | Natural language goals, auto-parsed |
| Safety | Build your own guardrails | Spend limits, kill switch, operator confirmation |
| DeFi | Read docs, write ABIs | Drop-in Uniswap, Aave, bridges |
| Yield | Manual research, claim, compound | Auto-compound, cross-protocol APY comparison |
| DCA | Manual recurring buys | Automated DCA with intervals, limits, callbacks |
| Gas | Guess gas prices | Smart estimation, timing, batching |
| Security | Manual approval checks | Auto-scan & revoke risky approvals |
| Alerts | Manual whale tracking | Auto-monitor wallets, instant alerts |
| Multi-wallet | Manage keys manually | Batch ops, consolidated portfolio, wallet groups |
| Airdrops | Manual quest hunting | Auto-track campaigns, multi-wallet farming, Sybil-safe |
| Token Security | Manual research | Honeypot detection, rug pull check, contract audit |
| Extensibility | Hard-coded logic | Plugin system โ community can extend anything |
| Error Handling | Manual retry logic | Auto-fallback across LLM providers & RPCs |
๐๏ธ Architecture
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ User / Application โ
โ "Swap 0.1 ETH to USDC on Base" โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Agent Framework โ
โ โโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโ โ
โ โ Goal โโ โ LLM Planner โโ โ Tool โโ โ Transactionโ โ
โ โ Parser โ โ (cascade) โ โ Router โ โ Executor โ โ
โ โโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโฌโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโ
โ Safety Layer โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโ โ
โ โ Spend Governor โ โ โ
โ โ โข Per-tx limits โ โ โ
โ โ โข Daily caps โ โ โ
โ โ โข Kill switch โ โ โ
โ โ โข Operator confirmation โ โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโ โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโ
โ Tool Ecosystem โ โ
โ โโโโโโโโโโโ โโโโโโโโโโโโ โ โ
โ โ Uniswap โ โ Bridge โ โ โ
โ โ V2/V3 โ โ Agg. โ โ โ
โ โโโโโโโโโโโค โโโโโโโโโโโโค โ โ
โ โ Sniper โ โ Portfolioโ โ โ
โ โ Module โ โ Tracker โ โ โ
โ โโโโโโโโโโโ โโโโโโโโโโโโ โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโ
โ Chain Abstraction Layer โ โ
โ โโโโโโโโ โโโโโโโโ โโโโโโ โ โ
โ โ ETH โ โ BASE โ โARB โ โ โ
โ โโโโโโโโค โโโโโโโโค โโโโโโค โ โ
โ โ OP โ โ MATICโ โAVAXโ โ โ
โ โโโโโโโโค โโโโโโโโค โโโโโโค โ โ
โ โ BSC โ โ โ โ โ โ โ
โ โโโโโโโโ โโโโโโโโ โโโโโโ โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ Comparison vs Alternatives
| Feature | Web3 Agent Kit | LangChain + Web3 | Custom Bot | Goat SDK |
|---|---|---|---|---|
| Setup Time | Minutes | Hours | Days | Hours |
| Multi-chain | 7+ chains | Manual | Manual | Limited |
| Built-in LLM | 6 providers | DIY | โ | โ |
| DeFi Tools | Uniswap, Aave, bridges | โ | โ | Limited |
| Token Sniper | โ | โ | โ | โ |
| DCA Bot | โ | โ | โ | โ |
| Gas Optimizer | โ | โ | โ | โ |
| Approval Manager | โ | โ | โ | โ |
| Wallet Watcher | โ | โ | โ | โ |
| Yield Optimizer | โ | โ | โ | โ |
| Multi-Wallet | โ | โ | โ | โ |
| Airdrops | โ | โ | โ | โ |
| Token Security | โ | โ | โ | โ |
| Plugin System | โ | โ | โ | โ |
| Safety Rails | โ Governor | โ | โ | โ |
| Natural Language | โ | Partial | โ | โ |
| Python Native | โ | โ | Varies | โ (TS) |
| Type Hints | โ | Partial | Varies | N/A |
| Active Maintenance | โ | โ | Depends | Limited |
๐ฏ Quick Start
1. Install
pip install web3-agent-kit
2. Set Environment Variables
# Required: Wallet private key
export PRIVATE_KEY="0x..."
# Required: At least one LLM provider key
export OPENAI_API_KEY="sk-..." # OpenAI
export ANTHROPIC_API_KEY="sk-ant-..." # Anthropic (best reasoning)
export GROQ_API_KEY="gsk_..." # Groq (fastest)
export DEEPSEEK_API_KEY="sk-..." # DeepSeek (cheapest)
# Optional: Custom RPC endpoints (public defaults are provided)
export ETH_RPC="https://..."
export BASE_RPC="https://..."
3. CLI Tool (Optional)
# Check environment
wak doctor
# Show library info & capabilities
wak info
# List available examples
wak examples
# Check wallet balance
wak wallet balance --address 0x... --chain ethereum
# Token safety check
wak token check --address 0x...
# Gas prices
wak gas --chain ethereum
# Run an AI agent
wak agent --goal "swap 0.1 ETH to USDC on Base" --wallet 0x... --chain base
4. Write Your First Agent
from web3_agent_kit import Agent, Wallet, Chain, ChainManager
from web3_agent_kit.defi import Uniswap
# Setup
chain_manager = ChainManager(chains=[Chain.BASE])
wallet = Wallet.from_env("PRIVATE_KEY", chain_manager=chain_manager)
uniswap = Uniswap(chain_manager=chain_manager)
# Create agent with LLM reasoning
agent = Agent(
wallet=wallet,
chains=[Chain.BASE],
tools=[uniswap],
)
# Natural language swap โ that's it!
result = agent.run("Swap 0.1 ETH to USDC on Base")
print(result)
4. Run It
python my_agent.py
๐ก Tip: Start with a small amount on a testnet or use
dry_run=Truemode to validate behavior before going live.
โจ Features
๐ค Core
- ๐ Multi-chain support โ Ethereum, Base, Arbitrum, Optimism, Polygon, Avalanche, BSC
- ๐ง LLM-powered reasoning โ Multi-provider cascade (OpenAI, Anthropic, Groq, DeepSeek, OpenRouter, Kimi)
- ๐ฏ Natural language goals โ Tell the agent what to do in plain English
- ๐ Governed signing โ Safety caps, kill-switch, operator confirmation
๐ฐ DeFi
- ๐ฑ Uniswap V2 swaps โ Actual token swaps with quotes, approvals, slippage protection
- ๐ Cross-chain bridges โ Li.Fi + Socket aggregators for best routes
- ๐ Portfolio tracking โ Real-time balances, P&L across all chains
๐ซ Sniper
- ๐ฏ Token sniper โ Monitor new liquidity pools, auto-buy safe tokens
- ๐ก๏ธ Risk assessment โ Honeypot detection, liquidity checks, contract analysis
- โก Live monitoring โ Background thread with callback alerts
๐ DCA Bot
- ๐ Recurring buys โ Dollar-cost average into any token automatically
- โฐ Flexible intervals โ Hourly, daily, weekly, biweekly, monthly
- ๐ Spending limits โ Max buys, max total spend, auto-stop
- ๐ Cost average analysis โ Track avg price, min/max, P&L
- ๐พ Persistent orders โ Survives restarts, stored on disk
- ๐ Callbacks โ Hook into execution events for notifications
๐ Security Module (NEW!)
- ๐ฏ Honeypot detection โ Check if token can be sold before buying
- ๐งถ Rug pull checker โ Assess rug pull risk factors
- ๐ Contract audit โ Detect hidden mint, blacklist, pause, proxy patterns
- ๐ฐ Tax checker โ Buy/sell tax analysis
- ๐ง Liquidity analysis โ Locked %, lock duration
- ๐ฅ Holder analysis โ Concentration, whale detection
- ๐ Safety score โ 0-100 score with risk levels
- ๐ GoPlus API โ Real-time token security data
- ๐ DexScreener โ Liquidity data integration
๐ช Airdrop Automation (NEW!)
- ๐ Campaign Discovery โ Auto-scan 7 platforms (Galxe, Zealy, Layer3, QuestN, TaskOn, Intract, Port3)
- โ๏ธ On-chain Farming โ DeFi interactions for airdrops (Base, Ethereum, Arbitrum, Optimism, Scroll, Linea, zkSync)
- โฐ Daily Scheduler โ Automate recurring tasks with retry logic
- ๐ Points Dashboard โ Track points across all platforms with history
- ๐ Referral Manager โ Generate, track, and optimize referral links
- ๐ฐ Faucet Claimer โ Auto-claim testnet tokens from 12+ faucets
- ๐ค Multi-wallet โ Sybil avoidance, wallet rotation
- ๐ Plugin System โ Extend with custom platform executors
๐ REST API
- ๐ก 18 endpoints โ Full HTTP API for all modules
- ๐ API key auth โ Secure access control
- ๐ Swagger UI โ Interactive API documentation
- ๐ Auto-fallback โ Multi-provider LLM cascade
๐ Plugin System
- ๐ฆ Plugin registry โ Discover and load plugins dynamically
- ๐ ๏ธ Custom plugins โ Extend with your own tools
- ๐ Hot reload โ Add plugins without restarting
๐ REST API
Full HTTP API for all modules โ use from any language (JavaScript, curl, etc):
# Start the API server
python -m src.api
# Or with API key
WEB3_API_KEY=your-secret python -m src.api
Endpoints:
| Endpoint | Method | Description |
|---|---|---|
/wallet/info |
GET | Wallet info + balance |
/swap/quote |
GET | Get swap quote |
/swap/execute |
POST | Execute token swap |
/portfolio/ |
GET | Portfolio dashboard |
/gas/estimate |
GET | Gas estimates (EIP-1559) |
/gas/recommendation |
GET | Gas timing recommendation |
/watcher/list |
GET | List watched wallets |
/watcher/add |
POST | Add wallet to watch |
/approval/scan |
GET | Scan token approvals |
/approval/risk |
GET | Risk report |
/dca/orders |
GET/POST | List/create DCA orders |
/yield/opportunities |
GET | Scan yield opportunities |
/yield/best |
GET | Find best yield |
/bridge/quote |
GET | Get bridge quote |
/bridge/execute |
POST | Execute bridge |
/health |
GET | Health check |
/docs |
GET | Swagger UI |
/redoc |
GET | ReDoc documentation |
Example:
# Get gas estimate
curl http://localhost:8000/gas/estimate?chain=ethereum
# Get swap quote
curl "http://localhost:8000/swap/quote?token_in=ETH&token_out=USDC&amount_in=1.0"
# Scan approvals
curl http://localhost:8000/approval/scan?chain=ethereum
๐ฏ Showcase
Telegram Bot
A full-featured Telegram bot built with web3-agent-kit:
cd showcase/telegram-bot
pip install -r requirements.txt
python bot.py
Features: balance check, token swap, portfolio tracking, token sniper, cross-chain bridge.
๐ฆ Examples
| Example | Description |
|---|---|
examples/llm_swap_agent.py |
LLM-powered natural language swapping |
examples/direct_swap.py |
Programmatic Uniswap swap without LLM |
examples/token_sniper.py |
Monitor new pairs, auto-buy safe tokens |
examples/portfolio_dashboard.py |
Real-time portfolio across chains |
examples/bridge_agent.py |
Cross-chain transfers via Li.Fi/Socket |
examples/swap_agent.py |
Autonomous token swapping |
examples/yield_optimizer.py |
Cross-protocol yield farming + auto-compound |
examples/multi_wallet.py |
Multi-wallet management + batch ops |
examples/plugin_system.py |
Plugin system usage + custom plugins |
examples/dca_bot.py |
Dollar-cost averaging bot with intervals & limits |
examples/api_server.py |
REST API server with Swagger docs |
examples/airdrop_farmer.py |
Multi-chain airdrop farming |
examples/sniper_bot.py |
Token launch sniper |
examples/portfolio_tracker.py |
Portfolio tracking & reporting |
examples/airdrop_suite.py |
Full airdrop automation suite |
examples/security_analysis.py |
Token security analysis |
๐ง LLM Integration
Multi-provider cascade with automatic fallback:
from web3_agent_kit.agent import LLM, LLMConfig
# Use any LLM provider with automatic fallback
llm = LLM(LLMConfig(
providers=["anthropic", "openai", "groq", "deepseek"],
model="claude-3-5-sonnet-20241022",
))
# Natural language โ structured action
action = llm.parse("Swap 0.1 ETH to USDC on Base")
# โ {"tool": "uniswap", "action": "swap", "params": {...}}
๐ Security Module
Analyze tokens before interacting:
from web3_agent_kit.security import TokenAnalyzer, SecurityConfig
analyzer = TokenAnalyzer(SecurityConfig(chain="base"))
# Quick check
result = analyzer.quick_check("0x...")
print(f"Is Honeypot: {result['is_honeypot']}")
# Full analysis
report = analyzer.analyze_token("0x...")
print(f"Safety Score: {report.safety_score}/100")
print(f"Risk Level: {report.risk_level.value}")
if report.is_honeypot:
print("๐จ HONEYPOT DETECTED!")
elif report.safety_score < 50:
print("โ ๏ธ HIGH RISK TOKEN")
else:
print("โ Safe to trade")
๐ช Airdrop Automation
Automate airdrop farming across multiple platforms:
from web3_agent_kit.airdrop import (
CampaignDiscovery,
OnChainAirdropFarmer,
AirdropScheduler,
PointsDashboard,
ReferralManager,
FaucetClaimer,
)
# Discover new campaigns
discovery = CampaignDiscovery()
campaigns = discovery.discover_all()
# On-chain farming (dry run)
farmer = OnChainAirdropFarmer(OnChainConfig(chain="base", dry_run=True))
farmer.farm_plan("base_activity")
# Schedule daily tasks
scheduler = AirdropScheduler()
scheduler.add_daily("galxe_checkin", "09:00", galxe_checkin_fn)
# Track points
dashboard = PointsDashboard(DashboardConfig(wallet="0x..."))
dashboard.sync_all()
# Generate referrals
manager = ReferralManager()
manager.generate_links(count=10)
# Claim testnet tokens
claimer = FaucetClaimer()
claimer.claim_all(wallet="0x...")
๐ Project Stats
- Version: 1.2.0
- Modules: 20+
- Tests: 565+
- Examples: 18
- Chains: 7+
- License: MIT
๐ค Contributing
We welcome contributions! See CONTRIBUTING.md for guidelines.
๐ License
MIT License โ see LICENSE for details.
๐ Acknowledgments
- Uniswap โ DEX protocol
- Li.Fi โ Bridge aggregator
- Socket โ Bridge aggregator
- GoPlus โ Token security API
- DexScreener โ DEX data
Made with โค๏ธ by @itseywacc
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file web3_agent_kit-1.6.0.tar.gz.
File metadata
- Download URL: web3_agent_kit-1.6.0.tar.gz
- Upload date:
- Size: 214.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8cdcebf76235dc3f2e8138420b4c10c089102b75e2a8493d6ffb3adeb40ba957
|
|
| MD5 |
e09a6c5306c2145c09413a050750868f
|
|
| BLAKE2b-256 |
a4cdebee026a13740a88a180b73b3317131d5b8686abac8d4edaff936880eb0a
|
File details
Details for the file web3_agent_kit-1.6.0-py3-none-any.whl.
File metadata
- Download URL: web3_agent_kit-1.6.0-py3-none-any.whl
- Upload date:
- Size: 217.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
98b41c08ce722645868e636ac0f3d9675c8435f1967a8093fc51729b19126dd0
|
|
| MD5 |
6aca59ca6bf5466ca3fa6a9996d88bb7
|
|
| BLAKE2b-256 |
71db65c1fad5780f97a6115e3e1235b9171925e79baddf26f7a0126444e7a895
|