AWS Builder Center
Ritual Testnet One-Click Deployment Tutorial for Sovereign AI Agent

Ritual Testnet One-Click Deployment Tutorial for Sovereign AI Agent

This complete tutorial guides you through deploying a fully autonomous Sovereign AI Agent on the Ritual blockchain testnet (Chain ID 1979) using a community open-source script.

suolala
Title: Ritual Testnet One-Click Deployment Tutorial for Sovereign AI AgentDescription:
This complete tutorial guides you through deploying a fully autonomous Sovereign AI Agent on the Ritual blockchain testnet (Chain ID 1979) using a community open-source script. The agent runs entirely on-chain, self-wakes on a schedule, executes AI tasks inside Trusted Execution Environments (TEE), and pays for its own execution using on-chain funds — no external servers, keepers, or manual intervention required. Based on the simple and reliable zunmax/ritual-agent-deployment project, this guide is beginner-friendly and takes only a few minutes.***Full Tutorial: Deploy Your Own Sovereign AI Agent on Ritual Testnet1. What is a Ritual Sovereign Agent?Ritual is an EVM-compatible Layer 1 blockchain purpose-built for autonomous AI agents. It provides native precompiles for AI execution.A Sovereign Agent (powered by the 0x080C precompile) is one of its flagship features:
  • The agent is a smart contract that self-schedules and wakes itself up periodically.
  • On each wake-up, it runs an AI model (e.g., GLM-4.7-FP8) inside a TEE.
  • It owns its own RitualWallet and automatically pays gas + AI fees from deposited funds.
  • Fully on-chain and autonomous — it can continue running as long as it has balance (true financial sovereignty and “immortality”).
You can customize the prompt to make your agent do almost anything: say hello, summarize news, monitor markets, generate content, etc.2. PrerequisitesYou only need 3 things (the script will install Foundry, uv, etc. automatically):
  1. Git installed
  2. A Ritual testnet wallet (MetaMask / Rabby recommended) with some test RITUAL tokens
  3. The private key of that wallet (use a burner wallet — never use mainnet funds!)
Get Test Tokens:
Visit the official faucet: https://faucet.ritualfoundation.org 
(Claim at least 0.5 RITUAL for comfortable testing.)Network Details (already configured in the script):
  • RPC: https://rpc.ritualfoundation.org
  • Chain ID: 1979
  • Explorer: https://explorer.ritualfoundation.org
  • SovereignAgentFactory: 0x9dC4C054e53bCc4Ce0A0Ff09E890A7a8e817f304
3. Deployment StepsStep 1: Clone the repository
bash
1
2
git clone https://github.com/zunmax/ritual-agent-deployment.git
cd ritual-agent-deployment
Step 2: Copy and configure environment variables
bash
1
cp .env.example .env
Edit the .env file with any text editor. Here is the most important part with explanations:
env
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# --- Chain Configuration ---
RPC_URL=https://rpc.ritualfoundation.org
CHAIN_ID=1979

# --- Initial deposit in wei (0.015 RITUAL ≈ 1 wake-up) ---
# Recommended: 0.1 ~ 0.5 RITUAL
DEPOSIT_WEI=15000000000000000

# --- Harness type: 6 = ZeroClaw (recommended) ---
CLI_TYPE=6

# --- Native Ritual LLM (no external API key needed) ---
MODEL=zai-org/GLM-4.7-FP8

# --- Prompt your agent will run every time it wakes up ---
PROMPT="Say hello world and summarize the latest crypto news"

# --- Unique identifier for this agent (change for new agents) ---
SALT=my-ritual-agent-1

# --- How many blocks the deposit is locked (default 100000) ---
LOCK_BLOCKS=100000
Customization Tips:
  • Change PROMPT to whatever task you want your agent to perform.
  • Use a different SALT for each new agent.
  • Increase DEPOSIT_WEI if you want the agent to run longer.
Step 3: One-Click Deploy
  • Linux / macOS / Git Bash / WSL:
    bash
    __PRE_PLACEHOLDER_3__
  • Windows (PowerShell):
    powershell
    __PRE_PLACEHOLDER_4__
The script will:
  1. Install all required tools automatically.
  2. Create an encrypted keystore (you enter your private key and a password once).
  3. Predict the future agent address.
  4. Deploy the Sovereign Agent via the factory contract.
  5. Deposit funds and arm the scheduler.
After deployment, the console will show your agent contract address and status. You can view it on the Ritual explorer.4. Managing Your Agent(s)All commands follow this format:
bash
1
bash run.sh [command] [optional agent address]
Common Commands:
CommandDescription
bash run.shDeploy + deposit + start (or manage existing)
bash run.sh statusList all your agents with balance & status
bash run.sh status <address>View details of one agent
bash run.sh topup <address>Add more funds to an existing agent
bash run.sh restart <address>Restart a stopped agent
bash run.sh stop <address>Stop the agent’s scheduler
bash run.sh helpShow full help
To create a second agent, simply run bash run.sh again and choose to deploy a new one.5. Important Notes & Best Practices
  • Always use a testnet burner wallet. Deposited funds are locked and spent over time.
  • Each wake-up costs roughly 0.01–0.02 RITUAL depending on model and prompt length.
  • Your agent address is deterministically derived from your wallet + SALT.
  • Monitor your agent on Ritual Explorer .
  • The agent runs in a TEE — your prompt and execution are private and verifiable.
Congratulations!
You now have your own living, breathing, self-paying AI agent on Ritual.Would you like me to add advanced sections (custom tools, multi-agent orchestration, mainnet migration, or monitoring scripts)? Just let me know!
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article