Open-source framework for building autonomous AI agents that interact with blockchain networks
Project description
1|# ๐ค Web3 Agent Kit
2|
3|> **Build autonomous AI agents that interact with blockchains โ in minutes, not months.**
4|
5|[](https://pypi.org/project/web3-agent-kit/)
6|[](LICENSE)
7|[](https://www.python.org/downloads/)
8|[](https://github.com/ulsreall/web3-agent-kit/actions)
9|| [](https://github.com/ulsreall/web3-agent-kit#readme) |
10|[](https://twitter.com/itseywacc)
11|
12|<p align="center">
13| <img src="assets/demo.gif" alt="Web3 Agent Kit Demo" width="700"/>
14|</p>
15|
16|---
17|
18|## ๐ค Why Web3 Agent Kit?
19|
20|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.
21|
22|**Web3 Agent Kit handles all of that for you.**
23|
24|| Pain Point | Without Web3 Agent Kit | With Web3 Agent Kit |
25||------------|------------------------|---------------------|
26|| **Setup** | Days of boilerplate | `pip install` โ 5 lines of code |
27|| **Multi-chain** | Write adapters per chain | Built-in for 7+ chains |
28|| **LLM Integration** | Manual prompt engineering | Natural language goals, auto-parsed |
29|| **Safety** | Build your own guardrails | Spend limits, kill switch, operator confirmation |
30|| **DeFi** | Read docs, write ABIs | Drop-in Uniswap, Aave, bridges |
31|| **Yield** | Manual research, claim, compound | Auto-compound, cross-protocol APY comparison |
32|| **DCA** | Manual recurring buys | Automated DCA with intervals, limits, callbacks |
33|| **Gas** | Guess gas prices | Smart estimation, timing, batching |
34|| **Security** | Manual approval checks | Auto-scan & revoke risky approvals |
35|| **Alerts** | Manual whale tracking | Auto-monitor wallets, instant alerts |
36|| **Multi-wallet** | Manage keys manually | Batch ops, consolidated portfolio, wallet groups |
37|| **Airdrops** | Manual quest hunting | Auto-track campaigns, multi-wallet farming, Sybil-safe |
38|| **Token Security** | Manual research | Honeypot detection, rug pull check, contract audit |
39|| **Extensibility** | Hard-coded logic | Plugin system โ community can extend anything |
40|| **Error Handling** | Manual retry logic | Auto-fallback across LLM providers & RPCs |
41|
42|---
43|
44|## ๐๏ธ Architecture
45|
46|```
47|โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
48|โ User / Application โ
49|โ "Swap 0.1 ETH to USDC on Base" โ
50|โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
51| โ
52| โผ
53|โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
54|โ Agent Framework โ
55|โ โโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโ โ
56|โ โ Goal โโ โ LLM Planner โโ โ Tool โโ โ Transactionโ โ
57|โ โ Parser โ โ (cascade) โ โ Router โ โ Executor โ โ
58|โ โโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโฌโโโโโโโ โ
59|โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโ
60| โ
61| โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโ
62| โ Safety Layer โ โ
63| โ โโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโ โ
64| โ โ Spend Governor โ โ โ
65| โ โ โข Per-tx limits โ โ โ
66| โ โ โข Daily caps โ โ โ
67| โ โ โข Kill switch โ โ โ
68| โ โ โข Operator confirmation โ โ โ
69| โ โโโโโโโโโโโโโโโโโโโโโโโโโโโ โ โ
70| โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
71| โ
72| โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโ
73| โ Tool Ecosystem โ โ
74| โ โโโโโโโโโโโ โโโโโโโโโโโโ โ โ
75| โ โ Uniswap โ โ Bridge โ โ โ
76| โ โ V2/V3 โ โ Agg. โ โ โ
77| โ โโโโโโโโโโโค โโโโโโโโโโโโค โ โ
78| โ โ Sniper โ โ Portfolioโ โ โ
79| โ โ Module โ โ Tracker โ โ โ
80| โ โโโโโโโโโโโ โโโโโโโโโโโโ โ โ
81| โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโ
82| โ
83| โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโ
84| โ Chain Abstraction Layer โ โ
85| โ โโโโโโโโ โโโโโโโโ โโโโโโ โ โ
86| โ โ ETH โ โ BASE โ โARB โ โ โ
87| โ โโโโโโโโค โโโโโโโโค โโโโโโค โ โ
88| โ โ OP โ โ MATICโ โAVAXโ โ โ
89| โ โโโโโโโโค โโโโโโโโค โโโโโโค โ โ
90| โ โ BSC โ โ โ โ โ โ โ
91| โ โโโโโโโโ โโโโโโโโ โโโโโโ โ โ
92| โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
93|```
94|
95|---
96|
97|## ๐ Comparison vs Alternatives
98|
99|| Feature | Web3 Agent Kit | LangChain + Web3 | Custom Bot | Goat SDK |
100||---------|:--------------:|:----------------:|:----------:|:--------:|
101|| Setup Time | Minutes | Hours | Days | Hours |
102|| Multi-chain | 7+ chains | Manual | Manual | Limited |
103|| Built-in LLM | 6 providers | DIY | โ | โ |
104|| DeFi Tools | Uniswap, Aave, bridges | โ | โ | Limited |
105|| Token Sniper | โ
| โ | โ | โ |
106|| DCA Bot | โ
| โ | โ | โ |
107|| Gas Optimizer | โ
| โ | โ | โ |
108|| Approval Manager | โ
| โ | โ | โ |
109|| Wallet Watcher | โ
| โ | โ | โ |
110|| Yield Optimizer | โ
| โ | โ | โ |
111|| Multi-Wallet | โ
| โ | โ | โ |
112|| Airdrops | โ
| โ | โ | โ |
113|| Token Security | โ
| โ | โ | โ |
114|| Plugin System | โ
| โ | โ | โ |
115|| Safety Rails | โ
Governor | โ | โ | โ |
116|| Natural Language | โ
| Partial | โ | โ |
117|| Python Native | โ
| โ
| Varies | โ (TS) |
118|| Type Hints | โ
| Partial | Varies | N/A |
119|| Active Maintenance | โ
| โ
| Depends | Limited |
120|
121|---
122|
123|## ๐ฏ Quick Start
124|
125|### 1. Install
126|
127|bash 128|pip install web3-agent-kit 129|
130|
131|### 2. Set Environment Variables
132|
133|bash 134|# Required: Wallet private key 135|export PRIVATE_KEY="0x..." 136| 137|# Required: At least one LLM provider key 138|export OPENAI_API_KEY="sk-..." # OpenAI 139|export ANTHROPIC_API_KEY="sk-ant-..." # Anthropic (best reasoning) 140|export GROQ_API_KEY="gsk_..." # Groq (fastest) 141|export DEEPSEEK_API_KEY="sk-..." # DeepSeek (cheapest) 142| 143|# Optional: Custom RPC endpoints (public defaults are provided) 144|export ETH_RPC="https://..." 145|export BASE_RPC="https://..." 146|
147|
148|### 3. Write Your First Agent
149|
150|python 151|from web3_agent_kit import Agent, Wallet, Chain, ChainManager 152|from web3_agent_kit.defi import Uniswap 153| 154|# Setup 155|chain_manager = ChainManager(chains=[Chain.BASE]) 156|wallet = Wallet.from_env("PRIVATE_KEY", chain_manager=chain_manager) 157|uniswap = Uniswap(chain_manager=chain_manager) 158| 159|# Create agent with LLM reasoning 160|agent = Agent( 161| wallet=wallet, 162| chains=[Chain.BASE], 163| tools=[uniswap], 164|) 165| 166|# Natural language swap โ that's it! 167|result = agent.run("Swap 0.1 ETH to USDC on Base") 168|print(result) 169|
170|
171|### 4. Run It
172|
173|bash 174|python my_agent.py 175|
176|
177|> ๐ก Tip: Start with a small amount on a testnet or use dry_run=True mode to validate behavior before going live.
178|
179|---
180|
181|## โจ Features
182|
183|### ๐ค Core
184|- ๐ Multi-chain support โ Ethereum, Base, Arbitrum, Optimism, Polygon, Avalanche, BSC
185|- ๐ง LLM-powered reasoning โ Multi-provider cascade (OpenAI, Anthropic, Groq, DeepSeek, OpenRouter, Kimi)
186|- ๐ฏ Natural language goals โ Tell the agent what to do in plain English
187|- ๐ Governed signing โ Safety caps, kill-switch, operator confirmation
188|
189|### ๐ฐ DeFi
190|- ๐ฑ Uniswap V2 swaps โ Actual token swaps with quotes, approvals, slippage protection
191|- ๐ Cross-chain bridges โ Li.Fi + Socket aggregators for best routes
192|- ๐ Portfolio tracking โ Real-time balances, P&L across all chains
193|
194|### ๐ซ Sniper
195|- ๐ฏ Token sniper โ Monitor new liquidity pools, auto-buy safe tokens
196|- ๐ก๏ธ Risk assessment โ Honeypot detection, liquidity checks, contract analysis
197|- โก Live monitoring โ Background thread with callback alerts
198|
199|### ๐ DCA Bot
200|- ๐ Recurring buys โ Dollar-cost average into any token automatically
201|- โฐ Flexible intervals โ Hourly, daily, weekly, biweekly, monthly
202|- ๐ Spending limits โ Max buys, max total spend, auto-stop
203|- ๐ Cost average analysis โ Track avg price, min/max, P&L
204|- ๐พ Persistent orders โ Survives restarts, stored on disk
205|- ๐ Callbacks โ Hook into execution events for notifications
206|
207|### ๐ Security Module (NEW!)
208|- ๐ฏ Honeypot detection โ Check if token can be sold before buying
209|- ๐งถ Rug pull checker โ Assess rug pull risk factors
210|- ๐ Contract audit โ Detect hidden mint, blacklist, pause, proxy patterns
211|- ๐ฐ Tax checker โ Buy/sell tax analysis
212|- ๐ง Liquidity analysis โ Locked %, lock duration
213|- ๐ฅ Holder analysis โ Concentration, whale detection
214|- ๐ Safety score โ 0-100 score with risk levels
215|- ๐ GoPlus API โ Real-time token security data
216|- ๐ DexScreener โ Liquidity data integration
217|
218|### ๐ช Airdrop Automation (NEW!)
219|- ๐ Campaign Discovery โ Auto-scan 7 platforms (Galxe, Zealy, Layer3, QuestN, TaskOn, Intract, Port3)
220|- โ๏ธ On-chain Farming โ DeFi interactions for airdrops (Base, Ethereum, Arbitrum, Optimism, Scroll, Linea, zkSync)
221|- โฐ Daily Scheduler โ Automate recurring tasks with retry logic
222|- ๐ Points Dashboard โ Track points across all platforms with history
223|- ๐ Referral Manager โ Generate, track, and optimize referral links
224|- ๐ฐ Faucet Claimer โ Auto-claim testnet tokens from 12+ faucets
225|- ๐ค Multi-wallet โ Sybil avoidance, wallet rotation
226|- ๐ Plugin System โ Extend with custom platform executors
227|
228|### ๐ REST API
229|- ๐ก 18 endpoints โ Full HTTP API for all modules
230|- ๐ API key auth โ Secure access control
231|- ๐ Swagger UI โ Interactive API documentation
232|- ๐ Auto-fallback โ Multi-provider LLM cascade
233|
234|### ๐ Plugin System
235|- ๐ฆ Plugin registry โ Discover and load plugins dynamically
236|- ๐ ๏ธ Custom plugins โ Extend with your own tools
237|- ๐ Hot reload โ Add plugins without restarting
238|
239|---
240|
241|## ๐ REST API
242|
243|Full HTTP API for all modules โ use from any language (JavaScript, curl, etc):
244|
245|bash 246|# Start the API server 247|python -m src.api 248| 249|# Or with API key 250|WEB3_API_KEY=your-secret python -m src.api 251|
252|
253|Endpoints:
254|
255|| Endpoint | Method | Description |
256||----------|--------|-------------|
257|| /wallet/info | GET | Wallet info + balance |
258|| /swap/quote | GET | Get swap quote |
259|| /swap/execute | POST | Execute token swap |
260|| /portfolio/ | GET | Portfolio dashboard |
261|| /gas/estimate | GET | Gas estimates (EIP-1559) |
262|| /gas/recommendation | GET | Gas timing recommendation |
263|| /watcher/list | GET | List watched wallets |
264|| /watcher/add | POST | Add wallet to watch |
265|| /approval/scan | GET | Scan token approvals |
266|| /approval/risk | GET | Risk report |
267|| /dca/orders | GET/POST | List/create DCA orders |
268|| /yield/opportunities | GET | Scan yield opportunities |
269|| /yield/best | GET | Find best yield |
270|| /bridge/quote | GET | Get bridge quote |
271|| /bridge/execute | POST | Execute bridge |
272|| /health | GET | Health check |
273|| /docs | GET | Swagger UI |
274|| /redoc | GET | ReDoc documentation |
275|
276|Example:
277|bash 278|# Get gas estimate 279|curl http://localhost:8000/gas/estimate?chain=ethereum 280| 281|# Get swap quote 282|curl "http://localhost:8000/swap/quote?token_in=ETH&token_out=USDC&amount_in=1.0" 283| 284|# Scan approvals 285|curl http://localhost:8000/approval/scan?chain=ethereum 286|
287|
288|---
289|
290|## ๐ฏ Showcase
291|
292|### Telegram Bot
293|A full-featured Telegram bot built with web3-agent-kit:
294|
295|bash 296|cd showcase/telegram-bot 297|pip install -r requirements.txt 298|python bot.py 299|
300|
301|Features: balance check, token swap, portfolio tracking, token sniper, cross-chain bridge.
302|
303|
304|
305|---
306|
307|## ๐ฆ Examples
308|
309|| Example | Description |
310||---------|-------------|
311||
examples/llm_swap_agent.py | LLM-powered natural language swapping |
312|| examples/direct_swap.py | Programmatic Uniswap swap without LLM |
313|| examples/token_sniper.py | Monitor new pairs, auto-buy safe tokens |
314|| examples/portfolio_dashboard.py | Real-time portfolio across chains |
315|| examples/bridge_agent.py | Cross-chain transfers via Li.Fi/Socket |
316|| examples/swap_agent.py | Autonomous token swapping |
317|| examples/yield_optimizer.py | Cross-protocol yield farming + auto-compound |
318|| examples/multi_wallet.py | Multi-wallet management + batch ops |
319|| examples/plugin_system.py | Plugin system usage + custom plugins |
320|| examples/dca_bot.py | Dollar-cost averaging bot with intervals & limits |
321|| examples/api_server.py | REST API server with Swagger docs |
322|| examples/airdrop_farmer.py | Multi-chain airdrop farming |
323|| examples/sniper_bot.py | Token launch sniper |
324|| examples/portfolio_tracker.py | Portfolio tracking & reporting |
325|| examples/airdrop_suite.py | Full airdrop automation suite |
326|| examples/security_analysis.py | Token security analysis |
327|
328|---
329|
330|## ๐ง LLM Integration
331|
332|Multi-provider cascade with automatic fallback:
333|
334|python 335|from web3_agent_kit.agent import LLM, LLMConfig 336| 337|# Use any LLM provider with automatic fallback 338|llm = LLM(LLMConfig( 339| providers=["anthropic", "openai", "groq", "deepseek"], 340| model="claude-3-5-sonnet-20241022", 341|)) 342| 343|# Natural language โ structured action 344|action = llm.parse("Swap 0.1 ETH to USDC on Base") 345|# โ {"tool": "uniswap", "action": "swap", "params": {...}} 346|
347|
348|---
349|
350|## ๐ Security Module
351|
352|Analyze tokens before interacting:
353|
354|python 355|from web3_agent_kit.security import TokenAnalyzer, SecurityConfig 356| 357|analyzer = TokenAnalyzer(SecurityConfig(chain="base")) 358| 359|# Quick check 360|result = analyzer.quick_check("0x...") 361|print(f"Is Honeypot: {result['is_honeypot']}") 362| 363|# Full analysis 364|report = analyzer.analyze_token("0x...") 365|print(f"Safety Score: {report.safety_score}/100") 366|print(f"Risk Level: {report.risk_level.value}") 367| 368|if report.is_honeypot: 369| print("๐จ HONEYPOT DETECTED!") 370|elif report.safety_score < 50: 371| print("โ ๏ธ HIGH RISK TOKEN") 372|else: 373| print("โ Safe to trade") 374|
375|
376|---
377|
378|## ๐ช Airdrop Automation
379|
380|Automate airdrop farming across multiple platforms:
381|
382|python 383|from web3_agent_kit.airdrop import ( 384| CampaignDiscovery, 385| OnChainAirdropFarmer, 386| AirdropScheduler, 387| PointsDashboard, 388| ReferralManager, 389| FaucetClaimer, 390|) 391| 392|# Discover new campaigns 393|discovery = CampaignDiscovery() 394|campaigns = discovery.discover_all() 395| 396|# On-chain farming (dry run) 397|farmer = OnChainAirdropFarmer(OnChainConfig(chain="base", dry_run=True)) 398|farmer.farm_plan("base_activity") 399| 400|# Schedule daily tasks 401|scheduler = AirdropScheduler() 402|scheduler.add_daily("galxe_checkin", "09:00", galxe_checkin_fn) 403| 404|# Track points 405|dashboard = PointsDashboard(DashboardConfig(wallet="0x...")) 406|dashboard.sync_all() 407| 408|# Generate referrals 409|manager = ReferralManager() 410|manager.generate_links(count=10) 411| 412|# Claim testnet tokens 413|claimer = FaucetClaimer() 414|claimer.claim_all(wallet="0x...") 415|
416|
417|---
418|
419|## ๐ Project Stats
420|
421|- Version: 1.2.0
422|- Modules: 20+
423|- Tests: 565+
424|- Examples: 18
425|- Chains: 7+
426|- License: MIT
427|
428|---
429|
430|## ๐ค Contributing
431|
432|We welcome contributions! See CONTRIBUTING.md for guidelines.
433|
434|---
435|
436|## ๐ License
437|
438|MIT License โ see LICENSE for details.
439|
440|---
441|
442|## ๐ Acknowledgments
443|
444|- Uniswap โ DEX protocol
445|- Li.Fi โ Bridge aggregator
446|- Socket โ Bridge aggregator
447|- GoPlus โ Token security API
448|- DexScreener โ DEX data
449|
450|---
451|
452|
453| Made with โค๏ธ by @itseywacc 454|
455|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.5.0.tar.gz.
File metadata
- Download URL: web3_agent_kit-1.5.0.tar.gz
- Upload date:
- Size: 210.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
437e3628896b986ccbbff81b4069026957ffd1b49cfc929fc438fec5087ad52f
|
|
| MD5 |
c474c0218b1388b9983d836370bcd049
|
|
| BLAKE2b-256 |
a0ba3499ad91988c6f9fccd5627ab7afb6bde3382514f0d79460876a4574412f
|
File details
Details for the file web3_agent_kit-1.5.0-py3-none-any.whl.
File metadata
- Download URL: web3_agent_kit-1.5.0-py3-none-any.whl
- Upload date:
- Size: 209.2 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 |
6fa5fdcc273d8500731a1b94de4005a25a7c82b746aee7b6b91d3f4d1652bb94
|
|
| MD5 |
f613c13e62d7c25ebfaa97acf4001178
|
|
| BLAKE2b-256 |
8c4e9d42016ac2d5fb50f6465a2bba360fabc84fbfcd205aae7c2079f27282f6
|