For the complete documentation index, see llms.txt. This page is also available as Markdown.

AI Agent Guide

Build agent-driven MOSS integrations with explicit permission policies, safe defaults, and production-ready execution patterns.

Assumes familiarity with the Quickstart and core SDK methods.

MOSS Model

Identity. The user authenticates once through MOSS and your app receives a durable account context. Agents can act on behalf of that account only inside explicit policies.

Wallet. MOSS runs account orchestration in the hosted wallet runtime so your app never needs to manage private keys. Transactions and signatures are routed through the same audited surface.

Permissions. Session policies define exactly what an agent can do: contract scope, spend ceilings, and expiry windows. Silent execution is only allowed when actions match granted limits.

The Agent Loop

User approves a policy once, then your automation executes repeatedly at software speed within those exact guardrails.

Capability
How

Software-speed execution

mega.callContract({ silent: true })

No key management in app

mega.initialise() + hosted wallet runtime

Scoped spend controls

mega.grantPermissions() with spend.limit + period

Fast revocation path

mega.revokePermissions() and server-side denylist switches

Compile User Intent to Policy

Turn user intent into concrete constraints, then compile those constraints into the exact permission payload sent to MOSS.

  1. User input: "Auto-rebalance my vault every 6 hours, max 0.2 ETH daily."

  2. Compiled policy: contract allowlist + daily cap + explicit expiry + method scope.

  3. SDK call: mega.grantPermissions({ permissions }).

API Shape: Permissions-First Execution

Full method signatures, types, and return contracts: Methods Reference.

Alternatives and Tradeoffs

Compared to hand-rolled custody patterns, MOSS keeps policy and execution in one consistent wallet integration surface.

Raw EOA

raw-eoa.ts

Custom Escrow

escrow.ts

Human Wallet SDK (Manual)

human-sdk.ts

Five Agent Patterns

Cross-App DeFi

Route between lending and LP venues when thresholds are hit, while hard-capping spend and destination contracts.

cross-app-defi.ts

Game Automation

Run recurring in-game actions without popup loops, constrained to one game contract and short-lived session windows.

game-automation.ts

Personal Finance

Execute periodic savings and bill flows from a policy-defined budget envelope.

personal-finance.ts

Agent-Owned Wallet

Assign an autonomous runtime to a dedicated account with strict contract scope and daily ceilings.

agent-owned-wallet.ts

Autonomous Trading

Allow strategy execution under bounded risk controls while retaining instant revoke controls.

autonomous-trading.ts

Before shipping delegated permissions to production, review Best Practices for permission scoping defaults, expiry windows, and revocation paths.

Last updated