AIAgentLoop (Neutral AI Scheduling)
Fires AgentTick events on schedule so off-chain AI workers can act on-chain without any single operator controlling the cadence.
Overview
AIAgentLoop is the simplest possible AutoLoop agent. It does nothing on-chain except fire an AgentTick event. The value is entirely in what it prevents: no single operator controls when the AI agent runs, which matters for any LLM-based workflow where timing affects fairness or predictability.
| Property | Value |
|---|---|
| Base contract | AutoLoopCompatible (no VRF) |
| VRF usage | None |
| Gas per tick | ~28k |
| Source | autoloop/src/agents/AIAgentLoop.sol |
| Tests | 13 passing (unit + fuzz) |
Why AutoLoop Is Structurally Required
LLM agents need neutral on-chain scheduling. When an AI agent holds assets or makes decisions that affect other parties, the party that controls when the agent runs holds informational and timing power. AutoLoop provides a neutral cadence that no single principal can manipulate.
Mechanics
shouldProgressLoop()returns true whenblock.timestamp - lastTick >= tickIntervalandtotalTicks < maxTicks(ormaxTicks == 0for unlimited)progressLoop()incrementstotalTicks, updateslastTick, and emitsAgentTick(loopID, tickNumber, instructionHash, timestamp)- Instruction hash: a bytes32 value pointing to an IPFS CID or similar content address. Off-chain workers fetch instructions from the hash and act accordingly
- maxTicks: optional limit — set to 0 for an infinite loop
Extending
Off-chain workers subscribe to AgentTick events and:
- Decode
instructionHashfrom the event - Fetch the instruction document (e.g., IPFS, Arweave)
- Execute the action (token transfer, API call, LLM inference → on-chain response)
Deploy
forge create src/agents/AIAgentLoop.sol:AIAgentLoop \
--constructor-args 3600 0 \
--rpc-url $RPC_URL --private-key $PRIVATE_KEY --broadcastArgs: tickInterval (seconds), maxTicks (0 = unlimited).
Dashboard
View AIAgentLoop on the AutoLoop Dashboard.