Autonomous Agent

How the Agent Works

StakePilot's autonomous agent monitors the Solana network, evaluates validators, and manages stake positions — without human intervention.

🔄 Execution Cycle

The agent runs on a 4-hour monitoring cycle, with intelligent execution gating based on epoch timing. This prevents unnecessary transactions while ensuring timely rebalancing.

Monitor

Every 4 hours
  • ›Check current epoch progress
  • ›Read vault & agent balances
  • ›Scan all active stake positions
  • ›Evaluate validator health

Decide

Based on conditions
  • ›Epoch >90%? → Prepare rebalance
  • ›New epoch (<5%)? → Execute plan
  • ›Deactivating stakes ready? → Withdraw
  • ›All healthy? → Skip execution

Execute

~Once per epoch
  • ›Withdraw cooled-down stakes
  • ›Deactivate unhealthy positions
  • ›Stake to new high-quality validators
  • ›Log all decisions on-chain

⏱️ Epoch-Aware Timing

Solana epochs are the heartbeat of staking. Stake changes only take effect at epoch boundaries, and deactivating stake means ~2 epochs of zero rewards. The agent uses this knowledge to time its actions:

Epoch 0–90%
Monitor only — report status, no transactions
Changes won't take effect until next epoch anyway
Epoch 90–100%
Evaluate and prepare rebalancing
Position changes near boundary for fastest activation
New epoch (0–5%)
Execute pending plan if not yet run this epoch
Fresh epoch — new rewards, updated validator stats
Validator delinquent
Immediate deactivation regardless of epoch
Earning zero rewards — no cost to deactivate

⚖️ Rebalancing Logic

The agent is conservative about rebalancing. Deactivating stake costs ~2 epochs of rewards, so it only triggers when the cost of staying exceeds the cost of moving.

🚨 Triggers Deactivation

  • •Commission raised above 15%
  • •Commission jumped 3%+ since staking
  • •Validator went delinquent (not voting)
  • •Validator disappeared from network

✅ Keeps Position

  • •Score dropped but commission stable
  • •Minor performance dip (transient)
  • •Better validator available (cost of moving too high)
  • •Mid-epoch — wait for boundary

🎯 Validator Selection

When staking to new validators, the agent prioritizes decentralization and net yield to the staker.

Max Commission
≤ 15%
Max Active Stake
< 1M SOL
Target Validators
5–10
Min Stake
1 SOL

Scoring Factors

Commission (net yield)High
Uptime / vote creditsHigh
Stake concentration (prefer smaller)Medium
Client diversity (minority bonus)Medium
Geographic distributionLow

🔐 Security Model

The on-chain program enforces strict constraints. The agent wallet is authorized to manage staking operations but can never extract funds.

Agent Key
By596j...qthS
Stored locally on the execution host. Never exposed to the web.
Vault PDA
HpsHuy...2p5u
Program-derived address. Only the program can move funds.
Execution Host
Agent runs locally via cron. Vault key never leaves the server. Dashboard reads on-chain state — no private keys in Vercel.

📊 Live Activity

The agent logs every decision and transaction. View real-time activity on the dashboard.