How MetaVault AI works
MetaVault AI operates through a coordinated system of smart contracts, yield strategies, and autonomous AI agents. This page explains how each component works together.Vault architecture
The vault is built on an ERC20 share-based architecture where users receive vault share tokens (VST) representing their portion of the total assets under management.Core vault contract
The mainVault.sol contract handles:
- Deposits: Users deposit LINK tokens and receive shares based on current share price
- Withdrawals: Users burn shares to receive underlying assets plus earned yield
- Share pricing: Dynamic pricing based on total managed assets vs total shares
- Fee management: Performance fees on profits and withdrawal fees
Strategy router
TheStrategyRouter.sol contract orchestrates fund allocation across multiple strategies:
- Maintains a list of active strategies with target allocation weights (in basis points)
- Rebalances funds to match target allocations
- Harvests yields from all strategies
- Handles withdrawals by pulling from strategies as needed
Yield strategies
MetaVault AI currently supports two complementary strategies that balance risk and return.All strategies currently operate on mock contracts that simulate Aave V3 behavior for predictable testing.
Aave V3 strategy (safe)
A conservative, low-risk strategy that supplies LINK tokens to Aave V3 to earn passive lending yield. How it works:- Receives LINK from the vault via
invest() - Supplies LINK to Aave’s lending pool
- Receives aTokens that accrue interest over time
- Harvests profits by withdrawing accrued interest back to vault
Aave leverage strategy (aggressive)
A high-yield strategy that uses leveraged looping to amplify returns through repeated borrow-swap-supply cycles. How it works:- Supplies LINK as collateral to Aave
- Borrows WETH against the LINK collateral
- Swaps borrowed WETH for LINK via Uniswap V2
- Supplies the swapped LINK back to Aave
- Repeats for
maxDepthiterations (default: 3)
maxDepth: Maximum loop iterations (1-6, default: 3)borrowFactor: Percentage of collateral to borrow per loop (0-8000 basis points, default: 6000 = 60%)paused: Emergency pause flag to stop new investments
AI agent system
MetaVault AI is powered by the ADK-TS (Agent Development Kit) framework, which provides conversation orchestration, tool management, and state management for TypeScript agents.Why ADK-TS?
ADK-TS enables:- Session memory: Maintains conversation context across interactions
- Tool orchestration: Structured tool calling and response formatting
- TypeScript-native: Fully typed agent logic and integrations
- Modular architecture: Specialized agents with distinct responsibilities
Agent team
The vault is managed by three specialized agents:1. Strategy Sentinel agent
Role: Portfolio guardian and risk manager Responsibilities:- Monitors strategy health (LTV, liquidation risk, deposited amounts)
- Fetches real-time token prices from CoinGecko API
- Manages leverage strategy parameters (
maxDepth,borrowFactor, pause state) - Adjusts target allocation weights between strategies
- Triggers rebalancing and harvesting operations
- Auto-deleverages when risk thresholds are exceeded
- Always checks LINK/WETH prices before making leverage decisions
- When LTV > 70% or high volatility → pause or reduce leverage
- When prices drop rapidly (>10%) → adjust strategy weights
- Default allocation: 80% leverage, 20% Aave safe strategy
2. Chat agent
Role: User assistant and interface Responsibilities:- Provides natural language interface for vault interactions
- Checks user balances and shares
- Facilitates deposits with approval flow management
- Handles withdrawals
- Displays public vault metrics (APY, total assets)
- Only accesses data for the requesting user’s wallet
- Never exposes admin functions or strategy internals
- Strictly enforces privacy between users
3. Yield Simulator agent
Role: Testing and validation Responsibilities:- Simulates yield accrual scenarios
- Validates profit distribution logic
- Helps with development and testing
Agent orchestration
The main agent (agent.ts) coordinates the specialized sub-agents using ADK-TS’s AgentBuilder:
Automation
The Strategy Sentinel agent runs on a cron schedule to continuously monitor and manage the vault:User interaction flow
Deposit flow
- User requests deposit via frontend or chat
- Chat agent checks LINK allowance
- If insufficient, agent prepares approval transaction
- User signs approval transaction
- Chat agent prepares deposit transaction
- User signs deposit transaction
- Vault mints shares and emits
Depositevent - Strategy Sentinel may trigger rebalance to invest funds
Withdrawal flow
- User requests withdrawal
- Chat agent prepares withdrawal transaction
- User signs transaction
- Vault burns shares and calculates assets owed
- If vault liquidity insufficient, router pulls from strategies
- Withdrawal fee applied (if configured)
- Assets transferred to user
Performance tracking
The vault tracks individual user performance:Next steps
Key features
Explore the unique features powered by AI agents
Getting started
Set up and run MetaVault AI locally