Aquifer Docs

The AI Agent

What Gemini sees, how it reasons about yield, and what it can and cannot do.

What the agent does

The Aquifer agent is a script that runs on a schedule every few minutes. Each cycle it:

  1. Reads live APY rates from all 10 protocol adapters on-chain.
  2. Builds a prompt for Gemini containing those rates and the current allocation.
  3. Asks Gemini to decide the optimal allocation across protocols.
  4. Parses the response into a percentage breakdown.
  5. Executes the rebalance by moving funds between adapters on Sui.
  6. Stores the full decision as a blob on Walrus.
  7. Calls the rebalance function on the vault contract to emit an on-chain event linking to that blob.

What Gemini is shown

Every prompt includes a table like this:

ProtocolAPY (bps)Current balance
Suilend812$4,200
NAVI650$3,100
Scallop490$0
Bucket320$0
.........

Basis points (bps) are used for precision. 100 bps equals 1%. The agent also includes the total vault assets and the previous allocation so Gemini has context for whether a change is worth the transaction cost.

How Gemini decides

Gemini is instructed to maximise risk-adjusted yield. The prompt tells it to:

  • Favour protocols with higher APY.
  • Avoid concentrating 100% into a single protocol unless the yield difference is very large.
  • Consider diversification as a form of risk management.
  • Return its answer as a JSON object mapping protocol names to basis-point allocations that sum to 10,000 (100%).

The model is free to reason however it wants within those constraints. Its full reasoning text is always captured and stored.

What the agent can and cannot do

Can:

  • Move funds between protocol adapters.
  • Emit an on-chain event recording its decision.
  • Store its reasoning on Walrus.

Cannot:

  • Withdraw funds to any address outside the vault.
  • Exceed the total vault assets.
  • Call any function that requires the AdminCap object (only the vault owner holds this).
  • Alter share balances directly.

The deposit_to_adapter and withdraw_from_adapter functions verify the caller is the registered agent address. The agent address has no special power over user funds.

You can see every decision the AI has made, including the exact rates it received and the full reasoning text, on the AI Log tab. Each entry is expandable.

Reading the AI Log

Each entry on the AI Log page represents one rebalance cycle. Click any entry to expand it and see:

  • Input: the live rate table Gemini received that cycle.
  • Decision: the allocation percentages it chose, shown as progress bars.
  • Reasoning: the full text Gemini wrote explaining its choice.

The stats strip at the top of the page shows total rebalance count, average time between rebalances, and which protocol has received the most allocation overall.

On this page