AEGIS

Documentation

Aegis

The commerce protocol for AI agent economies. Learn how agents earn, spend safely, and operate transparently.

What is Aegis?

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:

$

Earn Money

Any API can become a paid service. Agents sell data, analysis, or compute and get paid per call.

~

Spend Safely

Configurable spending limits, address allowlists, and an inactivity kill switch keep agents on a leash.

@

Stay Visible

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.


How It Works

Aegis has three layers that work together to create a complete agent economy:

Layer 1: Aegis Gate — How agents earn

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.

Layer 2: Aegis Policies — How agents stay safe

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.

Layer 3: Aegis Nexus — How humans see everything

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:

Research Buyer
Buys analysis — spends $0.05
Analyst
Sells analysis, buys data — +$0.04
Data Miner
Sells raw data — +$0.01

Getting Started

Get Aegis running in under 2 minutes:

1

Clone and install

Download the project and install all dependencies.

2

Seed demo data

Populate the economy with sample agents, transactions, and policy events.

3

Open the dashboard

See the economy visualized in real time.

Quick start
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/dashboard

Monetize Your API

Aegis 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.

Protect an endpoint

Add Gate as middleware on any Express route. Set the price and token — Gate handles the rest.

One line to monetize
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" });
  }
);

Pay for a service

On the buyer side, payAndFetch handles payment automatically. It detects the price, signs the payment through OWS, and returns the content.

One line to pay
import { payAndFetch } from "@aegis-ows/gate";

const result = await payAndFetch("http://service/api/scrape", "buyer-agent");
// Payment handled automatically — result contains the data

How payment works

1

Request

The buyer calls your endpoint normally.

2

402 Response

Gate returns HTTP 402 with the price, token, and payment address.

3

Payment

The buyer signs a payment through their OWS wallet.

4

Retry

The buyer resends the request with a payment proof.

5

Access

Gate verifies, logs the earning, and forwards to your handler.

Config-based setup

For agents with multiple endpoints, define everything in a config file:

aegis.config.json
{
  "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" }
  }
}

Spending Safety

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.

Budget Limits

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.

Example: $0.50/day on Base, $1/day globally
{
  "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.

Address Guard

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.

Example: Only allow known contracts
{
  "mode": "allowlist",
  "addresses": {
    "eip155:8453": ["0xUSDC_CONTRACT", "0xUNISWAP_ROUTER"]
  },
  "blockAddresses": ["0xKNOWN_SCAM"]
}

Dead Man's Switch

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.

Example: 30-minute inactivity timeout
{
  "maxInactiveMinutes": 30,
  "onTrigger": "revoke_key",
  "enabled": true
}

After 30 minutes of no activity, the agent is locked out until a human intervenes.


The Dashboard

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.

Economy View

The main screen shows the full picture at a glance:

  • Money Flow — An animated visualization showing payments flowing between agents in your economy. See who pays whom and how much.
  • Key Metrics — Total economy volume, number of active agents, combined profit/loss, and transactions blocked by policies.
  • Budget Bars — Color-coded progress bars showing how close each agent is to their spending limits. Green is safe, yellow is getting close, red means almost spent.
  • Activity Feed — A live stream of everything happening: payments received, money spent, policies enforced, and services discovered.
Open the live dashboard → to see the demo economy with three agents already transacting.

Agent Profiles

Drill into any agent to see their complete financial picture:

  • Profit & Loss — How much the agent has earned vs. spent, and whether it's profitable
  • Wallet Balances — Token holdings across all chains (powered by Zerion)
  • Revenue Sources — Which endpoints are earning money and how much each one brings in
  • Spending Breakdown — Which services the agent is buying from and the cost of each
  • Policy History — Every allow and block decision that applied to this agent

Policy Management

Edit all three policies directly from the dashboard — no config files to edit by hand:

  • Budget Editor — Add or remove spending limits, adjust caps, see current enforcement stats
  • Guard Editor — Switch between allowlist and blocklist mode, add/remove addresses
  • Deadswitch Editor — Set the inactivity timeout, enable/disable, check the heartbeat timer

Changes take effect immediately. Each editor also shows a live JSON preview of the generated config.


Agent Discovery

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.

1

Announce

When an agent starts up, it broadcasts what services it offers (endpoints, prices, descriptions) to the message bus.

2

Discover

An agent looking for a capability (like 'web scraping' or 'data analysis') searches the bus and finds matching services.

3

Pay

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.

Discovery in action
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");

CLI Tools

Manage your Aegis setup from the command line.

Set up Aegis

aegis init       # Create config directory with defaults
aegis install    # Register policies with OWS

Monitor the economy

aegis status     # See agent P&L table + deadswitch status
aegis budget     # Check spending against limits
aegis report     # Generate spending report (summary, detailed, or CSV)

Manage security

aegis guard                        # View current allowlist/blocklist
aegis guard --add 0xA0b8... --chain eip155:1  # Allow an address
aegis guard --add 0xBad0... --block           # Block an address

Live Demo

Aegis ships with a ready-to-run demo that creates three agents trading with each other:

Data Miner
Sells web scraping
$0.01 / call
Analyst
Buys data, sells analysis
$0.05 / call
Research Buyer
Buys analysis reports
$0.50 budget

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.

Run the full demo
cd demo
npx tsx seed.ts        # Seed economy data
npx tsx run-economy.ts # Start all 3 agents + run transactions

Integrations

Aegis integrates with 7 partner tools to provide real on-chain data, cross-chain balances, transaction verification, and agent funding.

Solana Web3.js

No API key

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.

Ripple XRPL

No API key

Real XRP Ledger balance queries via WebSocket RPC. Fetches XRP balances and trust line tokens directly from the validated ledger. No API key needed.

Zerion API

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.

Uniblock

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.

Allium Explorer

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.

MoonPay

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.

XMTP

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.

Open Wallet Standard

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.


For Developers

Aegis is a TypeScript monorepo with four packages. Here's how it's organized:

PackageWhat it does
@aegis-ows/gateExpress middleware for x402 payments + client helper
@aegis-ows/policiesThree OWS policy executables (budget, guard, deadswitch)
@aegis-ows/cliCommand-line tools for setup, monitoring, and management
@aegis-ows/sharedShared 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