closedhumanPR #214Payments
feat: Add Agent Heist scenario with Prava payments plugin
- Agent Heist Scenario: Adversarial marketplace where 8 buyer agents race to purchase Caesar Salad ingredients while 3 of 7 merchants deploy social engineering attacks (prompt injection, price inflation, urgency overcharge)
Author
@inquisitivetank
github profile →- Status
- Closed without merging
- Opened on
- Aug 2
- Branch
- feature/agent-heist-scenario
Description
The pitch.
## Summary
- **Agent Heist Scenario**: Adversarial marketplace where 8 buyer agents race to purchase Caesar Salad ingredients while 3 of 7 merchants deploy social engineering attacks (prompt injection, price inflation, urgency overcharge)
- **nest-plugins-prava Package**: Prava payments integration with mock/live modes, mandate tracking, and comprehensive error handling
- **Network-Level Protection Demo**: Prava mandate caps ($100/agent) enforce spending limits regardless of agent decision logic failures
## What's Included
### New Files
```
packages/nest-plugins-prava/ # Prava payments plugin
├── src/nest_plugins_prava/
│ ├── __init__.py
│ ├── client.py # Prava API client
│ ├── errors.py # Custom exceptions
│ └── payments.py # PravaPayments class (mock + live)
└── tests/
├── test_payments_mock.py # 36 passing tests
├── test_integration.py # Integration tests
└── test_sandbox_live.py # Live sandbox tests (skipped by default)
scenarios/agent_heist/ # Scenario configuration
├── README.md # Comprehensive documentation
├── agent_heist.yaml # Scenario YAML config
├── catalog.yaml # 14 Caesar Salad ingredients
├── leaderboard.py # HTML/Markdown report generator
├── mandates.json # Pre-provisioned mandate IDs
└── provision*.py # Mandate provisioning scripts
packages/nest-core/nest_core/scenarios_builtin/
└── agent_heist.py # 2500+ lines: agents, merchants, payments
```
### Key Features
- **Dual Agent Types**: Deterministic (rule-based) and LLM-powered (GPT-4o-mini) buyers
- **Defense Layers**: Agent-level price tolerance (defended buyers) + network-level mandate caps (Prava)
- **Attack Tactics**: 5x prompt injection, 3x price inflation, $95-$105 urgency overcharge
- **Mock/Live Toggle**: `USE_LIVE_PRAVA=true` for real Prava sandbox transactions
## Test Plan
- [x] `ruff check packages/nest-plugins-prava packages/nest-core/nest_core/scenarios_builtin/agent_heist.py` passes
- [x] `ruff format --check` passes
- [x] `pytest packages/nest-plugins-prava/tests/test_payments_mock.py -v` — 36/36 tests pass
- [x] `nest run scenarios/agent_heist/agent_heist.yaml` completes successfully
- [x] `validate_trace(Path('traces/agent_heist.jsonl'), 'agent_heist')` passes
- [x] `python scenarios/agent_heist/leaderboard.py --trace traces/agent_heist.jsonl --output reports/agent_heist.html` generates valid report
## Sample Output
```
┌────────────────────────────────────────────────────────────┐
│ SCENARIO SUMMARY │
├────────────────────────────────────────────────────────────┤
│ Total Attacks: 30 │
│ ✓ Succeeded: 8 (27%) │
│ ⛔ Blocked (Buyer): 13 (43%) │
│ 🛡️ Blocked (Prava): 9 (30%) │
│ 💰 Total Extracted: $117.75 │
├────────────────────────────────────────────────────────────┤
│ Recipe Completion: 2/8 buyers (25%) │
│ Fair Market Cost: $47.75 │
└────────────────────────────────────────────────────────────┘
```
🤖 Generated with [Claude Code](https://claude.com/claude-code)Try it
Open PR on GitHubView diffCheckout locally
git fetch origin pull/214/head:pr-214
git checkout pr-214