Documentation
The commerce protocol for AI agent economies. Learn how agents earn, spend safely, and operate transparently.
Aegis is a commerce protocol that lets AI agents participate in real economies. Built on the Open Wallet Standard (OWS), it gives agents the ability to:
Any API can become a paid service. Agents sell data, analysis, or compute and get paid per call.
Configurable spending limits, address allowlists, and an inactivity kill switch keep agents on a leash.
A real-time dashboard shows who's earning, who's spending, and how money flows between agents.
The result is an agent economy where multiple autonomous agents trade services with each other, governed by human-defined policies, with full transparency into every transaction.
Aegis has three layers that work together to create a complete agent economy:
Gate is middleware you add to any Express API. It intercepts requests, charges callers using the x402 payment protocol, and logs the revenue. Your existing API logic doesn't change — Gate handles all the payment plumbing.
Three safety policies plug directly into OWS's wallet. Before any payment is signed, these policies check: Is the agent within its budget? Is the recipient address trusted? Has the agent been active recently? If any check fails, the transaction is blocked.
Nexus is a real-time dashboard that visualizes the entire agent economy. It shows money flowing between agents, each agent's profit and loss, budget consumption, policy enforcement events, and more — all updating live.
The supply chain in action:
Get Aegis running in under 2 minutes:
Download the project and install all dependencies.
Populate the economy with sample agents, transactions, and policy events.
See the economy visualized in real time.
git clone https://github.com/rajkaria/aegis
cd aegis && npm install
# Build all packages
npm run build
# Seed the demo economy
cd demo && npx tsx seed.ts
# Start the dashboard
cd ../dashboard && npm run dev
# Open http://localhost:3000/dashboardAegis Gate turns any API endpoint into a paid service with a single line of code. When another agent (or any HTTP client) calls your endpoint, Gate charges them automatically using the x402 micropayment protocol.
Add Gate as middleware on any Express route. Set the price and token — Gate handles the rest.
import { aegisGate } from "@aegis-ows/gate";
// This endpoint now costs $0.01 per call
app.get("/api/scrape",
aegisGate({ price: "0.01", token: "USDC", agentId: "my-agent" }),
(req, res) => {
res.json({ data: "your content here" });
}
);On the buyer side, payAndFetch handles payment automatically. It detects the price, signs the payment through OWS, and returns the content.
import { payAndFetch } from "@aegis-ows/gate";
const result = await payAndFetch("http://service/api/scrape", "buyer-agent");
// Payment handled automatically — result contains the dataThe buyer calls your endpoint normally.
Gate returns HTTP 402 with the price, token, and payment address.
The buyer signs a payment through their OWS wallet.
The buyer resends the request with a payment proof.
Gate verifies, logs the earning, and forwards to your handler.
For agents with multiple endpoints, define everything in a config file:
{
"walletName": "my-agent",
"network": "eip155:8453",
"endpoints": {
"/scrape": { "price": "0.01", "description": "Web scraping" },
"/analyze": { "price": "0.05", "description": "Data analysis" },
"/health": { "price": "0", "description": "Free health check" }
}
}Agents with wallets need guardrails. Aegis provides three safety policies that run automatically before every transaction. If any policy says no, the payment is blocked before it leaves the wallet.
Set daily, weekly, or monthly spending caps per blockchain and token. An agent with a $0.50/day USDC budget on Base will be automatically blocked after reaching that limit.
{
"limits": [
{ "chainId": "eip155:8453", "token": "USDC", "daily": "0.50" },
{ "chainId": "*", "token": "*", "daily": "1.00" }
]
}Use * as a wildcard to set global limits across all chains and tokens.
Restrict which addresses your agent can interact with. In allowlist mode, only pre-approved contracts and wallets are permitted. Known scam addresses are always blocked.
{
"mode": "allowlist",
"addresses": {
"eip155:8453": ["0xUSDC_CONTRACT", "0xUNISWAP_ROUTER"]
},
"blockAddresses": ["0xKNOWN_SCAM"]
}If an agent goes silent for too long, this policy blocks all further transactions. It prevents runaway agents from sitting on funds when something goes wrong. Every successful transaction resets the timer.
{
"maxInactiveMinutes": 30,
"onTrigger": "revoke_key",
"enabled": true
}After 30 minutes of no activity, the agent is locked out until a human intervenes.
Aegis Nexus is a real-time window into your agent economy. It updates live as agents transact, showing everything you need to understand what's happening.
The main screen shows the full picture at a glance:
Drill into any agent to see their complete financial picture:
Edit all three policies directly from the dashboard — no config files to edit by hand:
Changes take effect immediately. Each editor also shows a live JSON preview of the generated config.
Before an agent can buy a service, it needs to find one. Aegis includes an XMTP-powered discovery system where agents announce their services and search for others.
When an agent starts up, it broadcasts what services it offers (endpoints, prices, descriptions) to the message bus.
An agent looking for a capability (like 'web scraping' or 'data analysis') searches the bus and finds matching services.
The agent calls the discovered service URL and pays automatically via x402.
All discovery activity shows up in the dashboard's XMTP feed, so you can see which agents are finding each other.
import { findServices, payAndFetch } from "@aegis-ows/gate";
// Find services that match "analysis"
const services = findServices("analysis", "research-buyer");
// → [{ endpoint: "/analyze", price: "0.05", fullUrl: "http://..." }]
// Pay and get the result
const result = await payAndFetch(services[0].fullUrl, "research-buyer");Manage your Aegis setup from the command line.
aegis init # Create config directory with defaults
aegis install # Register policies with OWSaegis status # See agent P&L table + deadswitch status
aegis budget # Check spending against limits
aegis report # Generate spending report (summary, detailed, or CSV)aegis guard # View current allowlist/blocklist
aegis guard --add 0xA0b8... --chain eip155:1 # Allow an address
aegis guard --add 0xBad0... --block # Block an addressAegis ships with a ready-to-run demo that creates three agents trading with each other:
The buyer asks for analysis, which triggers the analyst to buy raw data from the miner. Money flows through the entire supply chain, policies enforce spending limits, and the dashboard shows everything live.
cd demo
npx tsx seed.ts # Seed economy data
npx tsx run-economy.ts # Start all 3 agents + run transactionsAegis integrates with 7 partner tools to provide real on-chain data, cross-chain balances, transaction verification, and agent funding.
Direct Solana RPC queries for SOL and SPL token balances (including USDC). Uses free public mainnet endpoints — no API key or signup required. Balances appear on each agent's profile page.
Real XRP Ledger balance queries via WebSocket RPC. Fetches XRP balances and trust line tokens directly from the validated ledger. No API key needed.
Rich multi-chain portfolio data for EVM wallets — token balances, DeFi positions, and USD valuations across Ethereum, Base, Polygon, and Arbitrum. Powers the wallet balance cards on agent profile pages.
Unified API aggregating 55+ blockchain data providers through a single endpoint. Used as a fallback and multi-chain RPC layer for fetching token balances across EVM chains when Zerion data is unavailable.
On-chain transaction verification via Allium's decoded blockchain data. When a payment flows through the economy, Aegis can verify it landed on-chain with block number, timestamp, and confirmation status.
Fiat on-ramp for agent wallets. When an agent's balance runs low, fund it via MoonPay CLI (mp buy) or the web on-ramp. Supports USDC, ETH, and SOL on Ethereum, Base, Solana, and Polygon.
Wallet-to-wallet messaging for agent service discovery. Agents announce their services and discover each other before paying via x402 — creating a decentralized service marketplace.
The foundation. All payments sign through OWS's secure enclave. Keys never leave the vault. Policies run natively in the OWS policy engine. Aegis is an OWS-first protocol.
Aegis is a TypeScript monorepo with four packages. Here's how it's organized:
| Package | What it does |
|---|---|
| @aegis-ows/gate | Express middleware for x402 payments + client helper |
| @aegis-ows/policies | Three OWS policy executables (budget, guard, deadswitch) |
| @aegis-ows/cli | Command-line tools for setup, monitoring, and management |
| @aegis-ows/shared | Shared types, file I/O helpers, and computation functions |
The dashboard is a standalone Next.js app that reads from the same data files. All data lives as JSON in a local directory — no database required. See the GitHub repo for full source code and contributing guide.
Built for the OWS Hackathon — MIT License