# Automation & AI Agents

Set it and forget it. Deploy intelligent AI agents that monitor rates 24/7 and automatically switch your positions to maximize returns or minimize costs.

***

## 🤖 What is Automation?

**AI-powered agents** that work tirelessly to optimize your DeFi positions while you sleep, work, or enjoy life.

### How It Works

1. **You Deploy an Agent** - Set your preferences and rules
2. **Agent Monitors Rates** - Checks every lending protocol 24/7 for the best borrowing rates
3. **Agent Finds Better Rates** - Compares against your positions
4. **Agent Executes Switches** - Automatically migrates your positions to the best borrow rates so you save on interest
5. **You Save Money** - Without lifting a finger

***

## Why Use Automation?

### The Problem with Manual Management

**Manual position management is exhausting:**

* ⏰ **Time-consuming** - Checking rates multiple times daily
* 😴 **You sleep** - Rates change while you're offline
* 📉 **You miss opportunities** - Best rates don't wait for you
* 🧠 **Mental load** - Constant worry about missing better rates

### The Automation Solution

**Agents never sleep:**

* ✅ **24/7 Monitoring** - Always watching, always ready
* ✅ **Instant Action** - Execute switches within minutes
* ✅ **No Emotions** - Purely data-driven decisions
* ✅ **Peace of Mind** - Stop worrying, start earning

***

## Agent Types

Ratehopper offers four agent types, each designed for different DeFi strategies:

### Looper Agent (Rate Optimizer)

The primary automation agent that creates leveraged looping positions and:

* Monitors borrowing rates across all supported protocols
* Compares against your current position
* Calculates if switching would save money (after gas costs)
* Executes switches automatically when profitable
* Supports **in-app position closing** via flash loan unwinding

### Arb Agent

Exploits rate differences between protocols:

* Borrows at low rates on one protocol, lends at higher rates on another
* Automated rate monitoring and rebalancing
* Supports **in-app exit** (vault withdrawal, debt repayment, collateral return)
* Supports **Auto-Exit / Liquidation Protection** via Zodiac Roles module

### LP Agent

AI-powered liquidity provision:

* Natural language interface for creating LP positions
* Auto-calculates optimal token amounts from real-time pool data
* Supports Uniswap V3 on Base
* Supports **in-app exit** for LP positions
* Supports **Auto-Exit / liquidation protection** via Zodiac Roles module

### Custom Agent

Create a guided custom borrowing position directly in Ratehopper:

* Choose protocol (Aave V3, Compound V3, Morpho, or Fluid)
* Use ETH as collateral and USDC as debt asset
* Set borrow percentage and execute through Safe

**Supported Protocols:**

* Aave V3
* Compound V3
* Morpho
* Moonwell
* Fluid
* Uniswap V3 (LP Agent)

***

## Setting Up Your First Agent

### Step 1: Deploy Agent

1. Go to **Dashboard** and open your Safe wallet page
2. If you have no active position, use the **Deploy Agent** cards
3. Select an agent type (Looper is the most common starting point)

### Step 2: Configure Settings

**Agent-specific setup examples:**

* **Looper Agent** - Select collateral/debt and leverage, then execute the setup transaction
* **Arb Agent** - Select borrow protocol + vault flow via chat, then execute the setup transaction
* **LP Agent** - Define LP setup via chat and execute generated calldata through Safe
* **Custom Agent** - Configure ETH collateral / USDC debt parameters in the setup dialog

### Step 3: Fund and Activate

1. Ensure your Safe has required token balances and ETH for gas
2. **Sign Transaction** in-app
3. **Execute Transaction** through your Safe flow
4. Confirm your new position appears on your wallet page

***

## Exiting Positions

Each agent type has a built-in exit flow:

**Looper Agent:**

1. Navigate to your Dashboard
2. Click **"Close Position"** on your position card
3. The system uses flash loans to atomically unwind the entire leveraged position
4. Funds are returned to your Safe wallet

**Arb Agent:**

1. Open the Arb Agent chat
2. Click **"Exit My Position"** or type "exit"
3. Review the exit summary and click **"Confirm Exit Position"**
4. The agent handles vault withdrawal, debt repayment, and collateral return

**LP Agent:**

1. Open the LP Agent chat
2. Click **"Exit My Position"**
3. Confirm the exit and sign the transaction

***

## Auto-Exit / Liquidation Protection (Arb + LP)

Arb and LP agents support automated protection with Zodiac Roles module permissions:

1. Open your agent chat and trigger setup:
   * **Arb Agent:** type **"set up auto exit"**
   * **LP Agent:** click **"Set up auto exit"** in chat options
2. A **Zodiac Roles module** is deployed on your Safe with limited permissions
3. Configure risk parameters (for example trigger threshold and protective action size)
4. When configured risk conditions are met, the system executes approved protective actions
5. This protects your position 24/7, even when you're offline

See [Agent Actions - Auto-Exit](/features/agent_actions.md#auto-exit--liquidation-protection) for full details.

***

## Agent Management

### Monitoring Your Agents

**Dashboard View:**

* Agent status (Active, Paused, Error)
* Last check timestamp
* Recent switches
* Total savings
* Next scheduled check

**Activity Log:**

* All proposed switches
* Executed transactions
* Savings calculations
* Gas costs
* Success/failure status

### Adjusting Agent Settings

You can modify anytime:

* Rate thresholds
* Allowed protocols
* Gas limits
* Notification preferences

**When to Adjust:**

* Gas fees are consistently high
* Too many/too few switches
* Market conditions change
* Your risk tolerance changes

### Pausing or Stopping Agents

**Pause:** (coming soon)

1. Go to agent dashboard
2. Click "Pause Automation"
3. Agent pauses but position remains
4. Resume anytime

**Stop Agent:**

* Permanently deactivate
* Remove approvals
* Free up gas reserve

**When to Pause:**

* High gas fee periods
* Major protocol upgrades
* Market volatility
* Personal preference

***

## Safety & Security

### How Agents Are Secure

**Non-Custodial:**

* Agents never hold your funds
* All funds stay in protocols
* You maintain full ownership

**Limited Permissions:**

* Can only switch between approved protocols
* Cannot withdraw to other addresses
* Cannot change your positions beyond switching

**Safe Module (Optional):**

* Additional approval layer
* Multi-signature capability
* Emergency pause function

### Best Security Practices

✅ **Start Small:**

* Test with smaller positions first
* Verify agent works as expected
* Scale up gradually

✅ **Use Safe Module:**

* Enable for large positions
* Adds approval requirement
* Extra peace of mind

✅ **Monitor Regularly:**

* Check dashboard daily
* Review all switches
* Pause if anything seems wrong

✅ **Keep Gas Reserve:**

* Ensure enough ETH for switches
* Agent may pause if insufficient
* Monitor and refill

***

## Troubleshooting

### Agent Not Switching

**Possible Reasons:**

1. No better rates available
2. Rate improvement below threshold
3. Gas fees too high
4. Insufficient ETH for gas
5. Protocol liquidity issues

**Solutions:**

* Lower rate threshold slightly
* Increase gas limit
* Add more ETH to wallet
* Check agent logs for details

### Unexpected Switches

**Why it might happen:**

* Rates changed rapidly
* Gas fees dropped suddenly
* Your settings allow it

**What to do:**

* Review agent settings
* Adjust thresholds if needed
* Check logs for reasoning
* Contact support if confused

### Agent Paused Automatically

**Common Causes:**

* Insufficient gas
* Protocol temporary issues
* Safety mechanism triggered
* Error in execution

**Resolution:**

* Check notifications
* Review error logs
* Fix underlying issue
* Reactivate when ready

***

## Pricing

### Agent Costs

**Deployment:** Free **Monitoring:** Free **Execution:** You pay gas only

**What You Pay:**

* Standard blockchain gas fees
* Protocol fees (normal DeFi fees)
* No Ratehopper fees

**Typical Costs:**

* Gas per switch: $0.01 to 0.10
* Expected switches: 5-15/month
* Expected savings: $100-200/year on $10K

***

## Agent FAQ

**Q: What if I want to withdraw while agent is active?** A: You can withdraw anytime. For full in-app unwind flows use Agent Actions exit options. For manual protocol-level flows, follow our [Manual Withdrawals Guide](/advanced/manual_withdrawals.md) and [Unwinding Positions Guide](/support/unwinding_positions.md).

**Q: Can I have multiple agents on one position?** A: No, one agent per position to avoid conflicts.

**Q: What happens if a protocol gets hacked?** A: Agents only use well-audited protocols, but you should monitor your positions and maintain appropriate insurance/risk management.

**Q: Can I see what the agent will do before it does it?** A: Yes, with Safe Module enabled. You approve each switch.

***

## Next Steps

Ready to automate?

1. [**Getting Started Guide**](/introduction/getting_started.md) - Learn how to deploy your first agent
2. [**Rate Comparison**](/advanced/rate_comparison.md) - Compare rates before automating
3. [**Join community**](/support/contact.md) - Share your results

***

**Want maximum returns with minimum effort?** [Deploy an agent now →](https://ratehopper.ai/dashboard)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.ratehopper.ai/features/automation.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
