awslabs / awslabs/agentcore-samples
feat(payments): scoped delegation + receipt accountability for x402 settlement
- Dominant language
- Python
- Stars
- 3.4k
- Forks
- 1.3k
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 30
Description
This looks like a sample worth adding alongside the Heurist Pay for Data work in #1545.
AgentCore Payments + x402 cleanly handle settlement. The payment manager intercepts HTTP 402, generates payment proof, retries. That's the settlement layer. The gap that remains is post-settlement accountability: once the payment clears, what proves what the agent did with the access it just bought, and that the action record can't be modified after the fact?
For an auditor or counterparty downstream, `payment_hash` proves the payment cleared. It doesn't prove which agent took which action under which delegated authority, or that the action receipt the operator surfaces wasn't constructed after the fact. That's a real boundary in any production payments deployment.
We've built a reference composition that addresses that gap (Apache 2.0, public): https://github.com/agent-governance-spec/aps-x402-composition
It composes:
- **APS scoped delegation chain** with monotonic narrowing, where each step in the agent's authority is a signed delegation that can only narrow, never widen. Ed25519. The chain is the receipt of "who authorized what."
- **x402 settlement** as the payment rail (same substrate as #1545's Heurist composition).
- **Bilateral receipt chain** linking the action to both the delegation and the settlement, content-hashed via RFC 8785 JCS canonicalization (cross-verified against `erdtman/canonicalize@3.0.0` and `rfc8785@0.1.4`, the x402 substrate's own canonicalizer).
The 6-step demo (`src/demo.ts`) runs end-to-end: principal -> scoped delegation -> agent -> x402 paid call -> receipt -> independent verification (`src/verifier.ts`, 11 checks pass). Zero AgentCore-specific dependencies in the substrate. The demo wraps each step in a way that maps to AgentCore Payments primitives. The `AgentCorePaymentsPlugin` shape from #1545 would slot in cleanly.
What this adds beyond scoped delegation alone is third-party verifiability: any auditor or counterparty can verify the delegation chain end-to-end without trusting the operator's infrastructure.
Would you consider this as an AgentCore Payments sample? I can adapt the wrapper to match the conventions used in #1545 and submit as a PR if that's the preferred path. APS is Apache 2.0 (npm: `agent-passport-system`) and the IETF Internet-Draft is `draft-pidlisnyi-aps-01`.
Contributor guide
Research direction
Start by comparing the AgentCorePaymentsPlugin conventions proposed in #1545 with the external composition's src/demo.ts and src/verifier.ts. Adapt the six-step flow as an AgentCore Payments sample, preserving independent verification and the 11 passing checks; done means the wrapper matches the preferred sample conventions and is submitted as a PR.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- authorization, payments, security
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100