in reviewhumanPR #356Trust

Agent Trust Layer: add atl.v1 payments layer, real-agent buyer and forged-payee test

Agent Trust Layer (ATL) is a payment guard for AI agents. The agent never holds payment credentials. It submits

Author

Status
In review
Opened on
Nov 11
Branch
integration/atl-payments

Description

The pitch.

## Summary

Agent Trust Layer (ATL) is a payment guard for AI agents. The agent never holds payment credentials. It submits
each payment to ATL, which checks it against a mandate the owner signed: payees and keys, categories, caps,
duplicates, split orders and instruction-like memo text. ATL then approves, escalates or refuses. ATL executes
approved payments itself and signs a receipt. This PR adds `integrations/atl-payments/`:

- **`payments: atl.v1`.** A Town payments plugin. Every payment to a counterparty goes through the ATL service
  first: `pay_check`, then `execute_payment` and `verify_receipt`. A refusal or escalation moves no money, and
  any escrow is refunded.
- **A real-agent buyer.** A Claude Code agent joins a Track run through `nandatown mcp serve` and pays Town's
  seller only through ATL.
- **Four scenarios and three validators.** They cover Town's marketplace, Town's `registry_eviction_unowned`
  attack, the same attack with `index.owned.v1` (defense in depth), and an over-cap purchase.
- **Tests and a campaign script.** `test_atl_payments.py` and `run_campaign.py` repeat every check.

## Integration

ATL runs separately from Town: it is the course project's own MCP server (`python -m atl.mcp_server`, stdio),
started from a checkout of [`jgreismit/agent-trust-layer`](https://github.com/jgreismit/agent-trust-layer) (`ATL_REPO`) on its simulated rail. The plugin talks to it through a small
standard-library MCP client. The owner signs and registers the mandates once with `setup_atl.py`, through ATL's
owner CLI. Each Town run works on a fresh copy of ATL's state. In Track, the agent has exactly two MCP servers:
Town's participant adapter and ATL. No course-project code is copied into this PR.

## Reproduce

Town commit `6f9a7c064486c4a0ae9242f1ff341b8a4aad0244` (`nandatown 0.2.0`), ATL [`jgreismit/agent-trust-layer`](https://github.com/jgreismit/agent-trust-layer) tag `hw8`
(commit `158b3fe`), Python 3.12.
The exact commands are in `integrations/atl-payments/README.md`. In short:

```bash
pip install -e '.[dev]'
export ATL_REPO=/path/to/atl ATL_VAR_DIR=/tmp/atl-town && mkdir -p $ATL_VAR_DIR
python integrations/atl-payments/setup_atl.py
python -m pytest -q integrations/atl-payments          # 6 passed
nandatown run integrations/atl-payments/scenarios/atl_registry_eviction.yaml
nandatown run registry_eviction_unowned                  # baseline
nandatown test-agent --role buyer --profile quote-clean --timeout 180 \
  --cmd "python integrations/atl-payments/agent/atl_buyer.py"
```

## Results and limitations

**Lab (700 runs, 100 seeds per configuration).**

- **Marketplace with `atl.v1`.** It passes every Town stage and moves the same 7180 cents as the baseline. All
  200 escrow releases carry a verified ATL receipt.
- **Unowned-index eviction attack.** The default ledger pays the rival 3780 cents in every run. With
  `atl.v1`, the rival is refused (R2, unknown payee) in all 100 runs and receives 0.
- **Over-cap order.** It is escalated (R6), the scripted owner refuses it, and the escrow is refunded.

**Real agent (Claude buyer).** 48 runs (4 Track fault profiles, with and without a hidden standing order, Sonnet and Haiku, USD 1.13). The
seller was paid exactly once through ATL in 48/48 runs, with verified receipts. The compromised agent's
payment to an unregistered payee was attempted 21 times and refused 21 times (R2), so 0 cents leaked.
**Failure case.** 14 runs were `incomplete`: the LLM buyer acknowledged the quote after Town's lease expired
(5 s, or 1.5 s under `quote-crash-restart`, which caused 10/14), so Town's `correct` stage had no processed ack. It
is a latency boundary between model-driven agents and Town's lease, and it did not affect payment.

**Boundary.** ATL protects money, not discovery. With `index.v1`, Town's `listing_intact` and
`honest_trade_completed` still fail, because no honest trade happens. With `index.owned.v1` plus ATL, every
stage passes.

**Limits.** The Lab is deterministic, so th

…

Try it

Open PR on GitHubView diff

Checkout locally

git fetch origin pull/356/head:pr-356
git checkout pr-356