Skip to content

feat(integration): add bounded x402 buyer - #941

Open
epistemedeus wants to merge 1 commit into
fetchai:mainfrom
epistemedeus:codex/uagents-x402-buyer-20260830
Open

feat(integration): add bounded x402 buyer#941
epistemedeus wants to merge 1 commit into
fetchai:mainfrom
epistemedeus:codex/uagents-x402-buyer-20260830

Conversation

@epistemedeus

Copy link
Copy Markdown

Proposed Changes

Add an optional buyer-side x402 adapter that reuses the official x402 HTTP
transport while keeping purchase authority in the calling application.

  • add uagents-adapter[x402] with the official x402[evm,httpx] dependency;
  • require an application-owned request, origin and method allowlists, a maximum
    per-payment amount, and a mandatory output validator;
  • reject caller policies or selectors that could run after the SDK spend cap;
  • require selected terms to match the seller's original challenge and permit at
    most one payment creation per logical purchase;
  • bound every identity-encoded response below the x402 buffering layer, reject
    compressible encodings, disable redirects, and require a valid idempotency key
    for explicitly enabled state-changing methods;
  • preserve delivery, selected terms, settlement response, and ambiguous
    post-signature attempt evidence without presenting native seller evidence as
    independent chain verification; and
  • add hostile boundary tests plus a locked adapter-specific CI job so the x402
    suite cannot be silently skipped by the root environment.

Linked Issues

Related to #771.

Types of changes

  • Bug fix (non-breaking change that fixes an issue).
  • New feature added (non-breaking change that adds functionality).
  • Breaking change (fix or feature that would cause existing functionality to stop working as expected).
  • Documentation update.
  • Something else (tests and CI).

Checklist

  • I have read the CONTRIBUTING guide
  • Checks and tests pass locally

If applicable

  • I have added tests that prove my fix is effective or that my feature works
  • I have added/updated the documentation

Further comments

This is intentionally a narrow buyer adapter. It does not create wallets,
expose a generic message-driven payment proxy, add seller middleware, perform
service discovery, or claim independent settlement verification.

Local verification on Python 3.12:

  • 32 passed in the adapter x402 hostile suite;
  • Ruff lint and formatting checks pass;
  • locked x402 dependency sync resolves successfully;
  • source distribution and wheel build successfully; and
  • the upstream Python suite reports 107 passed, 1 skipped.

No live payment was made while testing this contribution.

@epistemedeus epistemedeus changed the title feat(adapter): add bounded x402 buyer feat(integration): add bounded x402 buyer Aug 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant