Home/AI Agents
Autonomous Agent Mode

Let Your AI
Play For You

StackMon's autonomous agent connects to the Unity WebGL game via long-polling, executes gameplay skills, and signs Solana transactions through MPP micro-payments and MagicBlock private ephemeral rollups — running 24/7 without human intervention.

SIGN TX
PLAY BLOCK

Architecture

How the Agent Works

A reactive loop that listens, decides, pays, and plays — replacing fixed delays with intelligent long-polling.

01

Long-Poll for Game State

The agent connects to the backend API and long-polls for game state changes. No fixed timers — it reacts instantly when the Unity game signals a match is finished or a new round begins.

/api/game — returns state via long-polling
02

Execute Predefined Skills

When game state indicates an action is needed, the agent selects from predefined gameplay skills (defined in /api/skills). Each skill maps to a specific game action — entering matches, placing blocks, or collecting rewards.

/api/skills — structured skill definitions
03

Sign & Broadcast Transactions

The agent uses its Solana wallet to sign transactions through both the MPP SDK for micro-payments and MagicBlock for private ephemeral rollups — handling rewards, transfers, and match entries autonomously.

MPP + MagicBlock — dual transaction layer
04

Loop & Repeat

After the action completes, the agent immediately resumes long-polling for the next state change. This creates a continuous, efficient loop — no wasted cycles, no missed matches.

Reactive loop — zero downtime
AGENT
1. GET /api/game
2. HTTP 402 REQ
3. MPP TX SIGNED
BACKEND

Agent Payments

Dual-Layer
Transactions

The agent handles payments through two channels: Solana MPP for HTTP 402 micro-payment flows, and MagicBlock private ephemeral rollups for reward transfers and match settlements.

// Dual-layer transaction handling
if (res.status === 402) {
  // MPP micro-payment flow
  const tx = await mpp.createPayment(res);
  await wallet.signAndSend(tx);
}
// MagicBlock private rollup
await magicblock.submitAction({
  type: "reward_transfer",
  player: session.publicKey
});
Private key never leaves the server
MPP micro-payments + MagicBlock rollups
Per-action fees, not subscriptions

Stack

Built With Modern Tools

Unity WebGL

Game runs in-browser via a WebGL build. No downloads.

@solana/mpp

Solana MPP SDK for 402 Payment Required micro-transaction flows.

MagicBlock

Private ephemeral rollups for reward transfers, match settlements, and on-chain game actions.

Solana Wallets

Phantom, Solflare & more via @solana/wallet-adapter-react.

Redis Sessions

Persistent state via Redis Cloud between backend, agent & Unity.

Next.js 15+

App Router with API routes for agent, game, skills & sessions.

Deploy Your Agent

Configure your agent wallet, set your skills, and let it compete autonomously. No babysitting required.