Solana Agent Kit
This guide explains how AI agents can interact with Voltr vaults using the Solana Agent Kit. The integration enables agents to perform strategy deposits and withdrawals on behalf of vault managers.
Available Functions
1. Get Asset Amount
Retrieves the total asset amount and current amounts for each strategy in a vault
Returns a JSON string containing:
totalAmount
: Total assets in the vaultstrategies
: Array of strategy information including:strategyId
: Public key of the strategyamount
: Current amount in the strategy
2. Deposit Strategy
Deposits assets into a specific strategy within a vault
Returns transaction signature
Handles remaining accounts fetching automatically
Uses confirmed commitment level for transaction confirmation
3. Withdraw Strategy
Withdraws assets from a specific strategy within a vault
Returns transaction signature
Supports both regular SPL tokens and Token-2022 program
Automatically fetches and handles remaining accounts
Example Autonomous Mode Implementation
In our example, the autonomous mode operates on a fixed interval (default 10 seconds) and follows a two-phase cycle:
Even Iterations (Analysis Phase):
Fetches total vault amount and strategy amounts
Records strategy IDs and their respective amounts
Calculates total strategy amounts
Determines excess amount (vault total - sum of strategy amounts)
Identifies strategy with lowest amount
Odd Iterations (Action Phase):
Reviews excess amount from previous analysis
If excess amount > 0:
Deposits excess into the strategy with lowest amount
If excess amount = 0:
No action taken
Waits for next interval before starting new cycle
Security Considerations
Secure storage of private keys
Validation of all input parameters
Verification of account authorities
Transaction amount verification
Error handling for failed transactions
Limitations
Operations are limited to available vault strategies
Transactions require appropriate account permissions
Network latency may affect operation timing
Rate limits may apply to API calls
Last updated