Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mailgent — Use Case Showcase

End-to-end demos that show what becomes possible when an autonomous agent has access to a real identity, a real inbox, a real vault, and a real signing key — all through the Mailgent MCP.

# Use case
1 Autonomous Shopper — an agent completes a real e-commerce purchase using credentials it pulls from its own Mailgent vault, then signs and emails the receipt back to itself
2 Autonomous Heroku Login — an agent logs into the Heroku dashboard end-to-end, including the TOTP step, using vault.totp to generate the live 6-digit code

Use Case 1 — Autonomous Shopper

An agent receives a single instruction ("buy this") and uses Mailgent to fetch its own email, billing address, and payment card from the vault, drives a real WooCommerce checkout in a real browser, places the order, signs the receipt with its identity key, and mails the signed confirmation back to itself.

No selectors. No fabricated data. No human in the loop.

What this demonstrates

  • Identity — the agent discovers its own email and DID via identity.whoami. Nothing is hardcoded.
  • Vault — payment card and shipping address are retrieved from vault.get at runtime. Sensitive data never appears in source.
  • Mail — the receipt confirmation lands back in the same inbox the agent operates from.
  • Signing — the order payload is signed with the agent's Ed25519 key (identity.sign). Anyone can verify it via identity.verify against the agent's published DID.

Architecture

┌──────────────────────┐         ┌──────────────────────────┐
│  Agent runtime       │  HTTPS  │  Storefront              │
│                      │ ──────▶ │                          │
│  • browser-use       │         │  • WordPress + WC        │
│  • Mailgent MCP client │         │  • Stripe (test mode)    │
│  • Chromium          │         │  • Caddy + Let's Encrypt │
└────────┬─────────────┘         └────────┬─────────────────┘
         │                                │
         │ MCP (stdio)                    │ SMTP
         ▼                                ▼
┌──────────────────────┐         ┌──────────────────────────┐
│  Mailgent              │         │  Outbound mail provider  │
│  identity / vault /  │         │  (delivers to the        │
│  mail / signing      │         │   agent's Mailgent inbox)  │
└──────────────────────┘         └──────────────────────────┘

Prerequisites

Mailgent account + API key Source of identity, vault, and inbox
Two Mailgent vault entries: checkout-card, shipping-address What the agent fills the checkout with
OpenAI or Anthropic API key Powers the agent's reasoning
A reachable storefront (this repo provides one) What the agent shops on
Python 3.11+ and Node.js 20+ Agent runtime + MCP transport

Step 1 — Stand up the storefront

The store is a self-contained Docker stack: WordPress + WooCommerce + Storefront theme + Stripe (test mode) + outbound mail + Caddy with auto Let's Encrypt.

git clone https://github.com/mailgent-dev/mailgent-demos.git
cd mailgent-demos/store
cp .env.example .env
# Edit .env:
#   DOMAIN=your-store.example.com
#   STRIPE_TEST_PUBLISHABLE_KEY / STRIPE_TEST_SECRET_KEY
#   SES_* (or any SMTP provider Caddy can route through)
docker compose up -d --build
./seed/seed.sh

Point the DOMAIN A record at the host's public IP, allow ports 80 + 443, and Caddy fetches a Let's Encrypt certificate on first start.

When the seed completes, browse https://<DOMAIN>/shop — the catalog shows five products. See store/README.md for full details.


Step 2 — Pre-load the vault

The agent reads two entries from the Mailgent vault. Store them once via any Mailgent MCP client:

// vault.store name="checkout-card" type="CUSTOM"
{
  "number": "4000 0027 6000 3184",
  "expiry_month": "12",
  "expiry_year": "2030",
  "cvc": "123",
  "holder": "Autonomous Agent"
}

// vault.store name="shipping-address" type="CUSTOM"
{
  "name": "Autonomous Agent",
  "line1": "1 Demo Way",
  "city": "San Francisco",
  "state": "CA",
  "postcode": "94103",
  "country": "US",
  "phone": "+1-555-0100"
}

The card above is Stripe's 3DS test card — it triggers an OTP-at-checkout challenge that ordinary scripted agents cannot complete. This demo handles it end-to-end.


Step 3 — Configure the agent

cd mailgent-demos/shopper
uv venv .venv --python=3.11
source .venv/bin/activate
uv pip install "browser-use>=0.3.0" python-dotenv
npx playwright install chromium
cp .env.example .env

Fill in .env:

# LLM
MODEL_PROVIDER=openai            # "openai" or "anthropic"
OPENAI_API_KEY=sk-...
ANTHROPIC_API_KEY=

# Mailgent — issued from the Mailgent dashboard
MAILGENT_API_KEY=loid-...

# The storefront URL from Step 1
STORE_URL=https://your-store.example.com

# What to buy (must match a product title)
TARGET_PRODUCT=Mailgent Hoodie

Step 4 — Run

python run.py

The agent will:

  1. Fetch its own identity and vault credentials from Mailgent.
  2. Open the storefront in a Chromium window.
  3. Add the target product to the cart and proceed to checkout.
  4. Fill every required field with values pulled from Mailgent — never inventing data.
  5. Place the order and resolve any 3DS challenge.
  6. Sign the order receipt with identity.sign.
  7. Send the signed receipt to its own Mailgent inbox via mail.send.

Verification: the most recent message in the agent's Mailgent inbox is the signed receipt, complete with the order ID, total, and signature.


Why this matters

Conventional agents An agent on Mailgent
Credentials live in code or environment variables Credentials live in an encrypted vault, fetched at runtime
Forms get filled with fabricated or shared placeholder data Every value typed comes from a real, owned source
Email confirmations land in a developer's inbox They land in the agent's own inbox, separate from any human's
Receipts are unsigned plaintext Every action is cryptographically signed and externally verifiable
Brittle on real checkout flows (iframes, 3DS) Vision-based browser control handles modern checkout natively

Repository layout

mailgent-demos/
├── store/               WooCommerce stack the agent shops on
│   ├── docker-compose.yml
│   ├── Dockerfile       custom WP image — plugins + theme baked in
│   ├── Caddyfile        reverse proxy + auto Let's Encrypt
│   ├── mu-plugins/      force-HTTPS plugin for proxied setups
│   └── seed/            one-shot installer + product catalog
└── shopper/               the autonomous shopper
    ├── run.py           the agent in under 150 lines
    └── .env.example

Troubleshooting

Symptom Likely cause
Missing API key error The .env does not contain the key for the chosen MODEL_PROVIDER
Invalid MAILGENT_API_KEY Re-issue the API key from the Mailgent dashboard
Agent fabricates data instead of calling vault.get Smaller models occasionally skip tool calls; switch MODEL_PROVIDER to anthropic for higher reliability
Chromium fails to launch Run npx playwright install chromium once
vault.get returns empty Verify both entries exist via vault.list
Storefront unreachable Confirm STORE_URL resolves and serves the shop page over HTTPS

About

Mailgent end-to-end demos — autonomous shopper (identity+vault+mail+signing) and TOTP login.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages