
AgentKit Aave
Added Aave actions support to the AgentKit [PR Contribution]
Demo
About
The Aave Action Provider integrates Aave V3 lending protocol with AgentKit, enabling AI agents to perform DeFi operations through natural language commands. Currently supports Base network operations for USDC and ETH. Using Aave sdk for protocol interactions and agentkit chatbot for interacting with the ai agent.
How it's made
# Aave Action Provider for AgentKit ## Overview The Aave Action Provider integrates Aave V3 lending protocol with AgentKit, enabling AI agents to perform DeFi operations through natural language commands. Currently supports Base network operations for USDC and ETH. ## File Structure ``` agentkit/src/action-providers/aave/ ├── aaveActionProvider.ts # Main provider implementation ├── aaveActionProvider.test.ts # Test suite ├── constants.ts # Protocol addresses & configs ├── schemas.ts # Zod validation schemas └── index.ts # Public exports ``` ## Core Features ### Supply Action ```typescript @CreateAction({ name: "supply", description: "Supply assets to Aave protocol", schema: SupplySchema, }) ``` - Supports USDC and ETH deposits - Handles token approvals automatically - Converts human amounts to protocol units ### Withdraw Action ```typescript @CreateAction({ name: "withdraw", description: "Withdraw assets from Aave protocol", schema: WithdrawSchema, }) ``` - Supports USDC and ETH withdrawals - Verifies aToken balances - Manages gas optimization ## Integration Example ```typescript // examples/langchain-cdp-chatbot/test-aave.ts const agent = new Agent({ actionProviders: [new AaveActionProvider()], }); // Natural language command const result = await agent.chat(` Supply 100 USDC to Aave on Base network `); ``` ## Technical Details ### Dependencies - @aave/contract-helpers: Protocol interactions - @bgd-labs/aave-address-book: Contract addresses - ethers: Web3 provider - viem: Amount handling ### Error Handling - Balance verification - Network validation - Transaction failures - Approval errors ### Testing - Mocked provider interactions - Success and failure scenarios - Balance checks - Network validation ## Usage in AgentKit ```typescript // agentkit/src/index.ts export { AaveActionProvider } from './action-providers/aave'; // In your agent import { AaveActionProvider } from 'agentkit'; ``` ## Environment Setup ```env # examples/langchain-cdp-chatbot/.env PROVIDER_URL=https://mainnet.base.org WALLET_KEY=your_private_key ``` ## Current Limitations - Base network only - USDC and ETH support - Single position management ## Future Enhancements - Multi-network support - Additional assets - Position optimization - Collateral management This integration enables AI agents to interact with Aave through a secure, type-safe interface while maintaining protocol-level safety checks.