Overview
This agent skill manages which earn vaults a user’s collateral sits in, automatically rebalancing to maximize yield while keeping the credit line active and healthy.- Compares vault yields across supported strategies
- Rebalances from lower-yield to higher-yield vaults
- Protects the position by only rebalancing when health factor is safe
API Endpoints Used
| Endpoint | Purpose |
|---|---|
GET /credit/protocol | Get available earn strategies |
GET /credit/accounts/{account}/info | Check health factor and current position |
GET /credit/accounts/{account}/unlock | Build calldata to unlock collateral from current vault |
GET /credit/accounts/{account}/lock | Build calldata to lock collateral into new vault (with earn param) |
How It Works
Check Current Position
The agent checks the user’s credit position to ensure it’s healthy enough to rebalance:The agent only proceeds if
healthFactor > 1.5 — rebalancing temporarily changes the collateral composition, so a larger buffer is needed.Discover Available Strategies
The agent fetches the protocol config to get available earn strategies and their IDs:This returns the credit configuration including a
strategies field with available earn vaults. The agent compares the user’s current vault yield against alternatives.Implementation
Configuration
Poll Interval
Poll Interval
Default: every 1 hour. Vault yields change slowly, so frequent polling isn’t necessary. Hourly checks balance responsiveness with API usage.
Health Factor Threshold
Health Factor Threshold
Default: 1.5. Higher than the health monitor threshold (1.3) because rebalancing temporarily changes collateral composition. The extra buffer prevents accidental liquidation during the unwrap/wrap window.
Minimum Yield Improvement
Minimum Yield Improvement
Default: 0.5% APY. The agent only rebalances if the improvement exceeds this threshold. This prevents excessive on-chain transactions for marginal gains — each rebalance costs gas.
Supported Vaults
The agent can rebalance between any earn strategies returned by the protocol config:strategies field in the response contains available earn vaults with their IDs — use these as the earn param when calling /lock.
See Risk Management for the full collateral tier table and LTV details per vault type.
Related
Credit Engine
How collateral value and LTVs affect your credit line.
Health Monitor
Pair with the health monitor to protect positions during rebalancing.
Credit API Reference
Earn vault wrap/unwrap endpoints with interactive playground.