Lifecycle protocol for ephemeral AI agents. Lease, metered execution, termination, and settlement — composable with any x402 payment gateway and any receipt format compatible with cognitive-meter.
Spawns an AI agent for a specific task, meters its work via signed receipts, and terminates the agent when its budget or TTL is exhausted. The "summon-work-die" lifecycle is protocol-level: agents don't need to know how they'll be killed, and the orchestrator doesn't need to know what the agent is doing.
- Lease — a Lease Capability Token (LCT) is issued with a short TTL.
- Work — the agent makes requests through an x402 gateway. Each request consumes from the lease budget; the gateway returns signed receipts for every metered call.
- Refresh — the lease controller refreshes the LCT while the lease is active and within budget.
- Combust — the controller stops refreshing. The agent's next request fails with 402; the agent terminates.
- Settle — accumulated receipts are bundled, the final receipt chain is verified, and payment is split per the configured policy.
commerce/— core protocol: LCT tokens, lease controller, settlement engine, fleet relay, termination, agent card, receipt bundling.phase0/— FastAPI vertical slice demonstrating the full lifecycle with a mock LLM.tests/— ~180 tests covering the commerce modules and an adversarial agent suite.
Install:
pip install -e ".[dev]"Run the Phase 0 vertical slice (FastAPI server + mock LLM):
cd phase0
pip install -e .
uvicorn phase0_agent.server:app --reloadDrive a full lease lifecycle from the included integration script:
phase0/scripts/test_vertical_slice.shYou'll see the lease open, receipts accumulate while the agent works, the LCT refresh stop, and the agent terminate on the next request when its lease goes stale.
- LCT default TTL: 60 seconds, refreshed every 30s while the lease is active.
- Settlement default split: 85% creator / 15% platform, with a 48-hour hold period.
- Receipt chain: Ed25519 signatures + SHA-256 hash chain (cognitive-meter receipt v1 format).
- Combustion: passive (stop refreshing the token) rather than active (explicit kill signal). The agent experiences termination as a 402 on its next call, not as an interrupt.
- x402-gateway — HTTP 402 payment gateway for the payment + metering stage.
- cognitive-meter — signed receipt spec used by this protocol.
- cognitive-meter-verify — browser demo for verifying receipts produced by this protocol.
- agent-sandbox-templates — E2B sandbox runtimes for the agents this protocol governs.
Apache 2.0