agent-lily
v0.1.7
Published
<p align="center"> <img src="https://jjlqjzsxzjmkdyofaprn.supabase.co/storage/v1/object/public/image/lily.png" alt="Agent Lily" width="220" /> </p>
Readme
Agent Lily
Overview
Agent Lily monitors lending yield opportunities across chains, compares routes, explains decisions, and helps users rebalance USDC into stronger yield positions.
The app combines:
- A public landing page
- A wallet-gated dashboard
- Chat-driven yield analysis and route execution
- Policy controls for automation behavior
- Telegram delivery for run notifications
- Wallet-scoped persistence for config, runs, reports, and chats
What Lily Does
- Fetches live USDC yield data from supported markets
- Compares current position yield against better destinations
- Prices a bridge route through LI.FI
- Estimates route cost, projected net gain, and payback window
- Stores results per connected wallet
- Surfaces dry-runs, reports, chat history, and optional Telegram alerts
Core Features
Dashboard
- Wallet-gated user workspace
- Overview, approvals, reports, chat, policies, and Telegram setup
- User-scoped data tied to the connected wallet address
Chat Workspace
- Commands for yields, chains, routes, and rebalance analysis
- Wallet-aware route previews
- Bridge and rebalance execution flows from the connected wallet
Automation
- Dry-run recommendations
- Optional autonomous execution
- Cooldown, route-cost, net-gain, and chain policy controls
Persistence
- Supabase-backed config storage
- Run history and reporting
- Wallet-scoped chat history
- Encrypted Telegram credentials at rest
Telegram
- Outbound Lily notifications for
dry_run,executed, anderrorevents - Manual and cron-triggered automation updates
Tech Stack
- Next.js 16
- React 19
- LI.FI SDK
- Aave V3
- Kamino
- Dynamic
- Viem
- Supabase
- Gemini
CLI
Agent Lily also ships as an npm CLI package:
- npm package: https://www.npmjs.com/package/agent-lily
- CLI README: https://www.npmjs.com/package/agent-lily?activeTab=readme
Install globally:
npm install -g agent-lilyQuick Start
bun install
cp .env.example .env.local
bun run devOpen http://localhost:3000.
Environment
Use .env.local for local development.
Public browser-safe values:
NEXT_PUBLIC_DYNAMIC_ENV_IDNEXT_PUBLIC_LIFI_API_KEYNEXT_PUBLIC_SUPABASE_URL
Server-only values:
AGENT_API_SECRETCRON_SECRETAGENT_CONFIG_CIPHER_KEYSUPABASE_URLSUPABASE_SERVICE_ROLE_KEYAGENT_PRIVATE_KEYGEMINI_API_KEY
An example template is included in .env.example.
Demo Commands
In chat:
check yields
rebalance 100
bridge 10 usdc from arbitrum to polygon
check balance on baseAPI examples:
curl -X GET http://localhost:3000/api/agent/yields
curl -X POST http://localhost:3000/api/agent/rebalance \
-H "x-wallet-address: 0xYourWalletAddress"Supported Chains
EVM
| Chain | Chain ID | USDC Address |
|-------|----------|--------------|
| Ethereum | 1 | 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48 |
| Arbitrum | 42161 | 0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8 |
| Optimism | 10 | 0x7F5c764cBc14f9669B88837ca1490cCa17c31607 |
| Polygon | 137 | 0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174 |
| Base | 8453 | 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 |
| Avalanche | 43114 | 0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E |
Solana
| Chain | Chain ID | Token |
|-------|----------|-------|
| Solana | 1151111081099710 | USDC |
Project Structure
src/
├── app/
│ ├── dashboard/
│ ├── api/
│ └── page.tsx
├── components/
├── env/
├── lib/
└── constants/Key files:
src/lib/agent.ts- decision enginesrc/lib/automation.ts- autonomous rebalance flowsrc/lib/lifi.ts- LI.FI route and chain helperssrc/lib/yields.ts- yield aggregationsrc/lib/persistence.ts- wallet-scoped storagesrc/lib/telegram.ts- Telegram notifications
LI.FI Integration
Production integration uses the LI.FI SDK directly.
import { getQuote, createConfig, executeRoute } from "@lifi/sdk";The repo also includes LI.FI MCP configuration in mcp.json.
License
MIT
