aegis-buy
The trust layer for agent spending. Wallets answer "can my agent pay?" — aegis-buy answers "should it pay, and did it get what it paid for?"
Before your agent spends a cent: a trust gate backed by real delivery verification (Aegis actually buys from sellers with real USDC to prove they deliver — the only x402 index that does), a local spend policy (per-call/daily caps, tier floors, allow/deny lists), and an Ed25519-signed receipt for every purchase. Procurement mode is capture-on-delivery: state a need and a budget, and you are never charged for non-delivery.
Works with any funded Base wallet key — including one from Coinbase Agentic Wallets — on top of your wallet, not instead of it.
probe (free) -> parse price -> Aegis trust gate -> local spend policy -> pay -> receipt
Every step before "pay" is free and local. Nothing settles unless the service passes the trust gate and your policy caps.
Why not just a wallet?
Agent wallets (Coinbase Agentic Wallets, AgentCash, Bedrock AgentCore) give your
agent the ability to pay and cap how much. None of them answer whether the
seller on the other side is real: in the x402 ecosystem roughly half of listed
endpoints are unreachable at any given time, and "challenge-honest,
delivery-broken" sellers settle your payment and 404 the paid retry. aegis-buy
gates on the only signal that catches that — verified paid deliveries — and its
trust verdicts conform to the x402 trust-provider extension wire format
(x402-trust-evaluation-v0.1), so the same data can gate settlements
server-side as the extension lands.
Install
pip install aegis-buy # library
pip install 'aegis-buy[mcp]' # + MCP server (aegis-buy-mcp)
Quickstart
from aegis_buy import BuyClient
client = BuyClient() # key from AEGIS_BUY_KEY env
r = client.get("https://api.example.com/price?symbol=ETH")
print(r["ok"], r["price_usd"], r["data"])
# Don't know a provider? Let the hub find a trusted one within budget:
r = client.procure("live ETH price", budget=0.01)
# Test everything without spending a cent:
client = BuyClient(dry_run=True)
Environment variables
| Var | Meaning | Default |
|---|---|---|
AEGIS_BUY_KEY |
EVM private key of the buyer wallet (funds USDC on Base) | — |
AEGIS_BUY_POLICY |
Path to spend policy JSON | ~/.aegis-buy/policy.json |
AEGIS_BUY_LEDGER |
Path to sqlite receipts ledger | ~/.aegis-buy/ledger.db |
AEGIS_HUB |
Aegis hub base URL | https://aegis.borisinc.com |
AEGIS_BUY_DRY_RUN |
1 = MCP server never actually pays |
off |
Spend policy (~/.aegis-buy/policy.json)
{
"max_per_call_usd": 0.05,
"max_per_day_usd": 1.00,
"max_total_usd": 10.00,
"min_tier": "provisional",
"allow_domains": [],
"deny_domains": ["sketchy.example"],
"trust_mode": "basic"
}
max_per_call_usd/max_per_day_usd/max_total_usd— hard USD caps. Day and total spend are computed from the local ledger.min_tier— minimum Aegis trust tier:unverified<provisional<trusted. Services flagged by Aegis are always blocked.allow_domains/deny_domains— domain allow/deny lists (subdomains match).trust_mode—basic(free Aegis signals),strict(paid $0.002 verification-backed trust check per service, itself policy-capped), oroff.
Missing file = safe defaults (5¢/call, $1/day, provisional+, basic gate).
MCP server
Give Claude Desktop (or any MCP client) a safe x402 wallet:
{
"mcpServers": {
"aegis-buy": {
"command": "aegis-buy-mcp",
"env": {
"AEGIS_BUY_KEY": "0xYOUR_BUYER_WALLET_PRIVATE_KEY",
"AEGIS_BUY_POLICY": "~/.aegis-buy/policy.json"
}
}
}
}
Tools: buy_get(url, params_json) · procure(need, budget) · trust_gate(url) · spend_stats().
Safety model
- Local spend policy — per-call, per-day, and lifetime USD caps enforced before any payment; domain allow/deny lists. The wallet's downside is bounded by config.
- Pre-payment trust gate — services are checked against Aegis's continuously
verified registry before money moves. Unknown services default to
unverified; flagged services are always blocked. - Receipts ledger — every attempt (paid, blocked, failed, dry-run) lands in a local sqlite ledger; caps are computed from it, so they survive restarts.
- No blind buys — if the price can't be parsed from the 402 challenge, the purchase is refused.
- Delivery protection via Aegis — routes purchased through the hub use auth-then-capture: your payment only settles after the upstream actually delivers, so you are never charged for non-delivery.
Use a dedicated buyer wallet funded with only what you're willing to spend — defense in depth on top of the policy caps.
Links
- Hub: https://aegis.borisinc.com — free discovery:
GET /discover?query=... - x402 protocol: HTTP 402 + USDC on Base (
eip155:8453)
MIT license.
LangChain
from aegis_buy.langchain_adapter import get_tools
tools = get_tools() # buy_get, procure, trust_gate, spend_stats
Agent framework tools (LangChain / CrewAI)
Give any agent safe, spend-capped access to the x402 machine economy:
pip install aegis-buy[langchain] # or aegis-buy[crewai]
export AEGIS_BUYER_KEY=0x... # funded Base-USDC wallet (optional — free tools work without)
# LangChain
from aegis_buy.frameworks.langchain_tools import get_aegis_tools
tools = get_aegis_tools() # aegis_discover (free), aegis_trust_check, aegis_paid_get, aegis_procure
# CrewAI
from aegis_buy.frameworks.crewai_tools import get_aegis_tools
Every paid action is bounded by a local SpendPolicy — default $0.05/call, $1.00/day,
provisional-or-better sellers only (AEGIS_MAX_PER_CALL_USD, AEGIS_MAX_PER_DAY_USD,
AEGIS_MIN_TIER) — with a pre-payment trust gate against the Aegis registry.
No key configured: paid tools return an instructive message instead of spending.
The aegis_buy.services layer (real-world purchases via Merchant-of-Record providers,
take-rate settlement) also ships in this package from 0.2.0.
Release files for aegis-buy 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| aegis_buy-0.2.1.tar.gz | 28.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| aegis_buy-0.2.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 55.1 kB
Release files / aegis_buy-0.2.1.tar.gz
| Download URL | aegis_buy-0.2.1.tar.gz |
|---|---|
| Size | 28.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9de7aac088f7415f8c436dffe592bd7883b60706cb7cd66f04723f9d986e8d86
|
|
BLAKE2b-256 checksum How to use checksums |
f7743f4ab40fbefd2e1408919b27dde1c5fff48967dde43593c7cfc90dbd1d06
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.4
|
Release files / aegis_buy-0.2.1-py3-none-any.whl
| Download URL | aegis_buy-0.2.1-py3-none-any.whl |
|---|---|
| Size | 27.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
99ba6b705c338739a0facfff9e85ed5bc27c8000569d5df3f05d9f0f6cf31788
|
|
BLAKE2b-256 checksum How to use checksums |
3e55235435c22d6a723c2e8c6fee44d71632bf3066cf4d974eefe36142663c73
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.4
|