Skip to main content
This guide walks through building a production-ready agent from scratch.

Architecture Overview

Step 1: Setup

Install Dependencies

Initialize SDK

Step 2: Generate Agent Key

Your agent needs its own keypair. Store this securely in your backend.
Never expose the agent private key. Treat it like a production database password.

Step 3: User Onboarding (Frontend)

When a user wants to activate your agent, they enable permissions.

Create User’s Account & Mee Client

Prepare And Enable Permissions

While user wants to enable permissions, they do the following operations
  • Deploying the Smart Contract Account (SCA) if it doesn’t exist yet.
  • Installing the Smart Session Validator module if not already present.
  • Funding the SCA if additional funds are required.
  • Granting (enabling) session permissions for the agent to act on the user’s behalf.
All in one supertransaction.

Step 4: Store Session Data (Backend)

Your backend needs to store session details for each user:

Step 5: Agent Execution (Backend)

Your agent can now act on behalf of users:

Step 6: Agent Logic

Implement your agent’s decision-making:

Yield Optimization Agent

Trading Agent

If you want to pay gas for your users:
When using sponsorship: true, don’t set feeToken when enabling permissions.

Monitoring & Observability

Security Checklist

Agent private key stored in secure secret management
Session details stored encrypted in database
Rate limiting on agent actions
Monitoring for unusual activity
Automatic session cleanup on expiry
User notification system for important events