Developer Guide

Developer Guide

Jan 16, 2025

Jan 16, 2025

Integration Guide: How Any Protocol Can Enable AI in 48 Hours

Within 48 hours, users could say "swap my ETH for the highest-yielding stablecoin," and agents would analyze rates across all pools, execute the optimal path, and auto-stake the result. Here's how your protocol can do the same.

TEST/Your Protocol + AABC Labs = Instant AI Superpowers

Within 48 hours, users could say "swap my ETH for the highest-yielding stablecoin," and agents would analyze rates across all pools, execute the optimal path, and auto-stake the result. Here's how your protocol can do the same.

The Integration Playbook

Time required: 2 days

Code changes: ~50 lines

Benefit: All users get AI capabilities instantly

Step 1: Add Agent Endpoint (30 minutes)

// Add to your protocol API
app.post('/agent/execute', async (req, res) => {
    const { action, params, agentAuth } = req.body;
    
    // Verify agent credentials
    if (!verifyAABCAgent(agentAuth)) {
        return res.status(401).json({ error: 'Invalid agent' });
    }
    
    // Route to existing functions
    switch(action) {
        case 'swap':
            return handleSwap(params);
        case 'addLiquidity':
            return handleAddLiquidity(params);
        case 'stake':
            return handleStake(params);
        default:
            return res.status(400).json({ error: 'Unknown action' });
    }
});

Step 2: Define Agent Capabilities (2 hours)

Create a simple JSON schema describing what agents can do:
{
    "protocol": "YourProtocol",
    "version": "1.0",
    "capabilities": [
        {
            "action": "swap",
            "description": "Exchange one token for another",
            "parameters": {
                "tokenIn": "address",
                "tokenOut": "address", 
                "amount": "uint256",
                "slippage": "uint8"
            },
            "returns": {
                "amountOut": "uint256",
                "txHash": "bytes32"
            }
        },
        {
            "action": "addLiquidity",
            "description": "Add liquidity to a pool",
            "parameters": {
                "tokenA": "address",
                "tokenB": "address",
                "amountA": "uint256",
                "amountB": "uint256"
            }
        }
    ]
}

Step 3: Test with AABC Sandbox (4 hours)

# Install AABC CLI
npm install -g @aabc/cli
# Test your integration
aabc test-integration your-protocol.json
# Output:
Connection established
Authentication working
Swap action tested
AddLiquidity action tested
All capabilities verified

Step 4: Submit for Review (1 day)

# Submit to AABC Labs
aabc submit-integration \
    --protocol="YourProtocol" \
    --endpoint="https://api.yourprotocol.com/agent" \
    --capabilities="your-protocol.json"
# We review within 24 hours

What You Get Immediately

Day 1: Basic agent operations

- Users can execute swaps via natural language

- Agents can read your protocol state

- Automatic transaction building

Week 1: Advanced features

- Complex multi-step operations

- Risk analysis and warnings

- Optimization suggestions

Month 1: Full ecosystem benefits

- Your protocol in agent strategies

- Cross-protocol composability

- Automatic arbitrage including your pools

Advanced Integration: Custom Agent Logic

For protocols wanting deeper integration:

# Custom strategy agent for your protocol
class YourProtocolAgent(AABCAgent):
    def optimize_position(self, user_address):
        # Your custom logic
        positions = self.get_user_positions(user_address)
        opportunities = self.analyze_opportunities()
        
        if opportunities['apy'] > positions['current_apy'] * 1.2:
            self.execute_rebalance(opportunities['best'])

Your competitors are already considering AI integration. The question is: will your users need to leave your protocol to use AI, or will AI bring users to you?

48 hours. 50 lines of code. Unlimited possibilities.

Let's build the future together.