Skip to content

Example: pre-pay check of an x402 endpoint in a Mastra agent - #11

Open
rumangsanya wants to merge 2 commits into
agent402-dev:mainfrom
rumangsanya:example-mastra-prepay-check
Open

rumangsanya wants to merge 2 commits into
agent402-dev:mainfrom
rumangsanya:example-mastra-prepay-check

Conversation

@rumangsanya

Copy link
Copy Markdown

/claim #3

Adds a Mastra example: a createTool tool that calls runCheck402({ url }) from @agent402-dev/ai-sdk-tools and returns the verdict to the agent, which is instructed not to pay when fixes > 0.

Includes a local broken-402 server for the refusal path. The tool passes allowLocal: true (documented in the package README) so the required local broken-402 test can run; public URLs still require https.

Tested: tsc --noEmit --strict is clean, and the tool was executed against the local broken server (fixes: 1) and a live endpoint (fixes: 0); public http URLs are refused.

@opirebot

opirebot Bot commented Dec 5, 2026

Copy link
Copy Markdown

👀 We've notified the reward creators here.

This branch has not been deployed

No deployments
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