The BSV Agent Coordination Layer: A Visual Architecture
The previous posts covered why AI agents need BSV-native identity and how we built live testnet transactions. This post steps up one level: the full system architecture, captured in diagrams.
The BSV Agent Coordination Layer is a Clojure monorepo that gives AI agents economic agency — identity, payments, escrow, audit, policy enforcement — all on Bitcoin SV primitives. 99 tests, 246 assertions, 9 modules, 0 failures.
System Architecture
The stack has six layers, from the Agent SDK down to the BSV blockchain:
Every module is independently testable with acyclic dependencies. The key design rule: identity is the root. Everything — payments, audit, coordination — starts from the agent’s secp256k1 keypair.
BRC-105 Payment Flow
HTTP 402 Payment Required is the handshake protocol. A service returns 402 with challenge headers; the client evaluates policy, reserves funds, constructs a payment proof, and retries:
The policy engine sits between the agent’s wallet and every payment decision. It enforces budgets, rate limits, domain whitelists, and approval thresholds — all programmatically, with human-only escalation above configurable thresholds.
Micropayment Escrow and Milestone Flow
For multi-step agent tasks, the coordination module provides milestone escrows. Funds are locked and released incrementally as deliverables are confirmed:
The dispute resolution state machine supports three outcomes: release to beneficiary, return to depositor, or split at configurable ratio. Funds are frozen from the moment a dispute is raised.
Audit Anchoring
Every agent action — payments, task completions, decisions — is bundled into a SHA-256 hash and optionally anchored to BSV via OP_RETURN:
The bundle-and-anchor function accepts an optional
wallet. With a wallet, it broadcasts to BSV testnet. Without one, it
falls back to local simulation — making the entire test suite run
offline.
Core Domain Model
The domain model is expressed as Clojure records with typed fields:
Business Model
The architecture enables six economic primitives for autonomous agent commerce:
- Pay-per-call AI services — agents monetize with microtransactions (500–10,000 sats), no subscriptions or API keys
- Staged milestone escrows — large tasks broken into funded milestones, payment releases on delivery
- Immutable audit trail — every action hashed and optionally anchored to BSV via OP_RETURN
- Programmable policy engine — budgets, rate limits, domain whitelists enforced automatically
- BSV-native identity — secp256k1 keypair for payments, commitments, and audit signatures
- Open protocol stack — built on BRC-105, OP_RETURN, secp256k1; interoperable with any BRC-105-compliant service
Testnet Integration
The full end-to-end flow runs on BSV testnet via the Bitails API:
Stack Summary
| Layer | Technology | BSV Standard |
|---|---|---|
| Identity | Bouncy Castle secp256k1 | ECDSA (same curve as BSV) |
| Payments | BRC-105 HTTP 402 | BRC-105 |
| Anchoring | OP_RETURN + SHA-256 | Bitcoin Script OP_RETURN |
| Testnet API | Bitails API | — |
| Runtime | Clojure on JVM | — |
The full architecture page with interactive diagrams, all 9 module diagrams, and the complete business model breakdown is available in the repository’s architecture.html.
99 tests. 246 assertions. 0 failures. 9 modules. One coordination layer for sovereign agent commerce.