Key features
MetaVault AI combines cutting-edge AI agent technology with battle-tested DeFi protocols to deliver a vault that actively manages your capital.Autonomous strategy monitoring
The Strategy Sentinel agent continuously monitors vault health without human intervention.Real-time health checks
- Strategy balances: Tracks deposited amounts, borrowed positions, and net exposure
- Loan-to-Value (LTV) monitoring: Calculates current LTV ratio for leveraged positions
- Liquidation risk detection: Identifies positions approaching danger zones
- Price tracking: Fetches live LINK and WETH prices from CoinGecko API
Intelligent alerting
The agent evaluates multiple risk factors:- LTV exceeding 70% threshold
- Rapid price movements (>10% change)
- Divergence from target allocations
- Low buffer to liquidation threshold
- Excessive leverage ratios
The Strategy Sentinel uses rule-based decision logic, not guesses. All actions are based on on-chain data and real market prices.
Dynamic risk management
MetaVault AI actively manages risk through multiple mechanisms.Automatic deleveraging
When liquidation risk is detected, the system automatically reduces leverage:- Withdraw LINK collateral from Aave
- Swap LINK → WETH via Uniswap
- Repay WETH debt
- Repeat until LTV is safe
Leverage parameter tuning
The Strategy Sentinel can adjust leverage aggressiveness based on market conditions: Parameters:maxDepth(1-6): Number of leverage loopsborrowFactor(0-8000 bps): Percentage to borrow per looppaused(bool): Emergency pause flag
- High volatility → reduce
maxDepthandborrowFactor - Stable markets → maintain or increase parameters
- Extreme risk → set
paused = true
Strategy pause mechanism
The leverage strategy can be paused instantly to prevent new risky investments:Intelligent portfolio rebalancing
MetaVault AI maintains optimal allocation across strategies based on risk profile and market conditions.Target weight management
Default allocation:- Leverage strategy: 80% (high yield, high risk)
- Aave safe strategy: 20% (stable yield, low risk)
Automatic rebalancing
Therebalance() function reallocates funds to match target weights:
- Calculate total managed assets
- Pull excess from overweight strategies
- Push funds to underweight strategies
- Update bookkeeping
Rebalancing triggers
The agent triggers rebalancing when:- Allocation drift exceeds 5%
- Market conditions change significantly
- New deposits increase vault balance
- After updating target weights
Automated yield harvesting
The vault automatically compounds profits back into strategies.Harvest mechanism
Each strategy implements aharvest() function:
Performance fee application
The vault takes a configurable performance fee on harvested profits:Harvest all strategies
The router can harvest all strategies in a single transaction:Natural language interface
The Chat agent provides an intuitive way to interact with the vault.User-friendly commands
Users can chat naturally:- “What’s my balance?”
- “Deposit 10 LINK”
- “Show me the current APY”
- “Withdraw all my funds”
- “How much is LINK worth?”
Smart transaction preparation
The agent handles the complex approval flow:- Check if user has approved LINK spending
- If not, prepare approval transaction
- After approval, prepare deposit transaction
- Return unsigned transactions for wallet signature
Privacy and security
The Chat agent enforces strict boundaries:- Only accesses data for the requesting user’s wallet
- Never exposes admin functions (rebalance, harvest, risk parameters)
- Cannot view other users’ balances or positions
- Returns only public vault information (total assets, APY)
The Chat agent responds in JSON format for transactional operations, making it easy to integrate with frontend wallets.
Transparent performance tracking
Every user can track their individual performance.User growth calculation
The vault maintains detailed accounting:Share-based accounting
The vault uses ERC20 shares for fair profit distribution:- New deposits receive shares at current price
- Yields increase total assets, raising share price
- Withdrawals burn shares at current price
- All users benefit proportionally from yields
Built with ADK-TS
MetaVault AI showcases the power of the Agent Development Kit for TypeScript.Key ADK-TS features used
Conversation orchestration:- Session memory across interactions
- Context state management for caching APY updates
- Tool response formatting and guidance
- Fully typed agent logic and tools
- Seamless Next.js/React integration
- Developer-friendly experience
Benefits of ADK-TS
- Reduced complexity: Frontend doesn’t need complex state management
- Type safety: Compile-time checks for agent logic and tools
- Tool orchestration: Structured calling conventions and error handling
- Conversation memory: Agents remember context across messages
- Modular design: Easy to add new specialized agents
Error handling and safety
MetaVault AI includes comprehensive error handling.Strategy operation safety
All strategy operations use try-catch blocks:Withdrawal protection
The vault ensures users can always withdraw (if liquidity exists):Leverage safety mechanisms
The leverage strategy includes multiple safeguards:- Maximum depth capped at 6 iterations
- Borrow factor limited to 80% (8000 bps)
- Conservative borrowing based on pool liquidity
- Automatic loop breaking on swap failures
- Try-catch on all Aave interactions
Next steps
Getting started
Set up and run MetaVault AI locally
API reference
Explore smart contract interfaces and agent tools