agents-pay

Settle x402 paywalled content at runtime through AgentCore Payments with policy-enforced spend limits.

2.5k|282|Updated Apr 23, 2026
One-click install
npx skills add https://github.com/aws/agent-toolkit-for-aws --skill agents-pay
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: agents-pay
Source: https://github.com/aws/agent-toolkit-for-aws/tree/main/plugins/aws-agents/skills/agents-pay
Command: npx skills add https://github.com/aws/agent-toolkit-for-aws --skill agents-pay

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires bedrock-agentcore, boto3, httpx, pydantic, and includes scripts (resource) and references (resource) components.

What problem does it solve?

When an AI agent hits an HTTP 402 Payment Required paywall mid-task, it needs a safe way to pay for the content without being able to decide who gets paid, how much, or how often. This Skill enforces every payment decision in code from an operator-owned policy file, so neither the model nor prompt-injected content can authorize or raise spending.

Core Features & Use Cases

  • Policy-gated x402 payments: Validate recipient, network, asset, scheme, origin, and per-payment ceiling in Python before any signing occurs.
  • Human-approved session budgets: A human creates budget-bounded payment sessions at a TTY; the agent can only spend within an approved session and can never mint new budget.
  • Hardened fetching and proof isolation: HTTPS-only requests with SSRF protections, no redirects, pinned IPs, idempotent retries, and signed proofs that never reach model context.
  • Use Case: Your coding agent hits a 402 while calling a paid API. With a pre-approved $1 session and a $0.05 per-payment cap, the agent pays the merchant, receives response metadata and a content hash, and stops spending when the budget runs out.

Quick Start

Ask the agent to pay for the x402-protected URL using the configured payment session, for example: pay for this API endpoint that returned a 402 error.

Frequently Asked Questions about agents-pay

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I let my AI agent pay for x402-protected content?

Provision a payment manager and connector with the agentcore CLI, write a policy with init-config, create a wallet instrument, then approve a budget-bounded session with new-session. The agent then pays via the x402_fetch tool, which enforces the policy before signing.

How do I set a spend limit for an agent making payments?

Set max_per_payment_usd in the policy file for a per-transaction ceiling, and pass --budget to new-session for a cumulative session cap. Both bounds apply, and only a human running new-session at a terminal can authorize more spending.

Why did my agent refuse to pay a 402 challenge?

A refusal means a policy check failed in code, such as an unapproved recipient, wrong network or asset, or an amount above the per-payment cap. Refusal reasons are intentionally uniform; only a human editing the policy or approving a new session changes the outcome.

Can the agent create its own payment session when budget runs out?

No. Session creation requires a human typing approve at an interactive terminal, and the runtime IAM role must exclude CreatePaymentSession. This separation prevents the agent from minting fresh budget when a session is exhausted.

Does this work with OpenClaw and other agent hosts?

Yes. OpenClaw uses the published TypeScript plugin with the get_paid_content tool, while Claude Code, Codex, Cursor, and Kiro invoke the Python x402_fetch CLI. Choose exactly one runtime path so policy enforcement is not bypassed.

When should I use agents-build instead of agents-pay?

Use agents-build when you are shipping a product that gives end users payment capability with per-customer wallets and framework middleware. Use agents-pay when the agent you are running right now needs to pay for content itself under operator-approved limits.