Skip to content

feat: add Tutorial 08 — OpenClaw Agent with AgentCore Payments (zero-code) - #1797

Open
wirjo wants to merge 26 commits into
awslabs:mainfrom
wirjo:feat/08-openclaw-x402-plugin-tutorial
Open

feat: add Tutorial 08 — OpenClaw Agent with AgentCore Payments (zero-code)#1797
wirjo wants to merge 26 commits into
awslabs:mainfrom
wirjo:feat/08-openclaw-x402-plugin-tutorial

Conversation

@wirjo

@wirjo wirjo commented Jul 21, 2026

Copy link
Copy Markdown

Summary

Adds Tutorial 08 for using AWS AgentCore Payments from OpenClaw with x402 v2. The tutorial installs the published @aws/aws-agents-pay package from ClawHub and keeps payment administration outside the model-facing runtime.

The tutorial does not carry a plugin source snapshot. The canonical package and bundled agents-pay skill are maintained in aws/agent-toolkit-for-aws.

Install

openclaw plugins install clawhub:@aws%2Faws-agents-pay
openclaw plugins inspect aws-agents-pay

The runtime exposes exactly:

  • get_payment_session_status
  • get_paid_content

Validation

  • Repository JavaScript lint: pass
  • Repository Python lint: pass
  • Repository scan: pass
  • CodeQL JavaScript/TypeScript: pass
  • CodeQL Python: pass
  • Tutorial contains no duplicated plugin implementation or release artifact

Add a zero-code tutorial for using the @aws/openclaw-x402-payments
plugin from ClawHub to transparently pay x402 paywalls via natural
language conversation.

- No Python/code required — install plugin and configure via chat
- Agent-guided setup creates full payment infrastructure
- Official AWS plugin published on ClawHub (source-linked, verified)
- Covers: install → setup → fund → pay → inspect → clean up
- Comparison table vs Strands/LangGraph/Browser approaches
@wirjo

wirjo commented Jul 21, 2026

Copy link
Copy Markdown
Author

✅ End-to-End Validation Complete

Successfully tested the full x402 payment flow on a live OpenClaw instance:

1️⃣ Probe URL → HTTP 402 + x402 v2 challenge
2️⃣ AgentCore ProcessPayment → EIP-3009 transferWithAuthorization signature ✅
3️⃣ validAfter check → EVM clock-skew prevention ✅
4️⃣ Replay with Payment-Signature header (base64 PaymentPayload) → HTTP 200 ✅

Test endpoint: https://x402-test.genesisblock.ai/api/weather (Base Sepolia, /bin/bash.001 USDC)

Plugin source updated: wirjo/agentcore-x402-payments-for-openclaw@68d5e98 with key fixes for x402 v2 compliance:

  • Proper PaymentPayload envelope per x402 v2 spec
  • Payment-Signature header (not X-PAYMENT) for v2 endpoints
  • userId in ProcessPayment/GetPaymentSession calls
  • Structured challenge payload to AgentCore (not base64 string)
  • OpenClaw execute() tool interface (not handler())


> **You:** "Create a payment session with a $5 budget"

The agent calls `create_payment_session` which:

@peterjiang-dev peterjiang-dev Jul 21, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have a way to make sure this tool by default requires customer approval? This might be the default behavior already - but good to check and make sure. Let's also call out the guidance here - something like it's best practice for customer to approve session creation each and every single time to avoid unexpected agent spending.

This is to make sure that customer does provide consent to create a session with budget, so their Claw agent won't go rogue and spends more than they should.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in d2b6927. The plugin is designed so that create_payment_session requires explicit user approval by default — the SKILL.md instructs the agent to always ask.

Strengthened the guidance in Step 4 with:

  • "The agent MUST request explicit user approval before creating any session"
  • "Review the budget amount and duration before approving every single time"
  • "This is a safety-critical control. The agent is configured to always ask before spending. If an agent creates sessions without asking, that is a bug — report it."

This makes it unmistakably clear that autonomous spending without consent is not acceptable.

- **AWS credentials** configured (`aws sts get-caller-identity` to verify)
- **Coinbase CDP API key** — get one at [portal.cdp.coinbase.com](https://portal.cdp.coinbase.com)

> **Testnet only.** All payments use Base Sepolia (Ethereum) with free USDC from [faucet.circle.com](https://faucet.circle.com/). Testnet USDC has no real-world value.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just for this sample right? The setup (instrument etc) can be used for real mainnet money as long as the customer funds it. Let's be clear about that so the readers have the right expectation.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in d2b6927. Added explicit note: "The infrastructure you create here is production-capable; only the network and funding differ." Makes clear that the same setup supports real mainnet money.

- Install: `npm install -g openclaw` — see [docs.openclaw.ai](https://docs.openclaw.ai)
- **AWS account** with AgentCore Payments access (preview)
- **AWS credentials** configured (`aws sts get-caller-identity` to verify)
- **Coinbase CDP API key** — get one at [portal.cdp.coinbase.com](https://portal.cdp.coinbase.com)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please inlcude both Privy and CDP instructions and change the sample documentation to be wallet agnosttic - can be used with any wallet or both.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done — both CDP and Privy have been included since the 3rd revision (Option A / Option B in Step 2). The plugin and documentation are wallet-agnostic.

The agent will guide you through:

1. **Provide your CDP credentials:**
- CDP API Key ID (UUID from portal.cdp.coinbase.com)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 - Please include both CDP and Privy or point to documentation that has both.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done — both CDP and Privy paths are documented in Step 2 (Option A / Option B).

Changes:
- Make tutorial fully standalone (no dependency on Tutorial 00)
- Add both Coinbase CDP and Stripe/Privy wallet provider paths (Option A/B)
- Add prominent spending controls section with best practices
- Add explicit user approval guidance for session creation
- Add Production Deployment section (mainnet networks, checklist)
- Add supported networks table (Base Sepolia/Mainnet, Solana Devnet/Mainnet)
- Remove all personal repository references
- Align formatting with repo conventions (table headers, notes style)
- Add Security & Spending Controls section
- Clarify testnet is for learning; same setup supports production

Addresses review comments from:
- @peterjiang-dev: spending approval best practices, testnet/mainnet clarity
- @mvangara10: wallet-agnostic (CDP + Privy), include both paths
@wirjo

wirjo commented Jul 21, 2026

Copy link
Copy Markdown
Author

Updated the README to address all review comments. Key changes:

  • Wallet-agnostic: Added both Coinbase CDP (Option A) and Stripe/Privy (Option B) paths
  • Spending controls: Added prominent best-practice section + approval guidance at session creation
  • Standalone: No dependency on Tutorial 00 — covers full setup from scratch
  • Production deployment: New section covering mainnet transition, supported networks table, and production checklist
  • No personal repos: Removed all personal repository references

cc @royosherove for review

This is a getting-started sample — removed the mainnet production
deployment section and checklist. Added a note clarifying that the
same pattern supports mainnet by changing the network parameter.

@mvangara10 mvangara10 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add AgentCore CLI command to create payment manager - or links

wirjo added 2 commits July 22, 2026 01:02
The plugin now auto-creates a payment manager when none exists,
using the IAM role ARN provided by the user during setup.

- Added IAM role creation command to Prerequisites
- Added role_arn as first parameter in setup flow (both CDP and Privy)
- Links to AgentCore Payments IAM setup docs

Addresses: @mvangara10 review comment about AgentCore CLI command
| Agent type | Single, payment-enabled |
| Agentic Framework | [OpenClaw](https://openclaw.ai) |
| LLM model | Any (Claude, Nova, GPT, Gemini — configured via OpenClaw) |
| Components | OpenClaw Gateway, `@aws/openclaw-x402-payments` plugin, AgentCore Payments, x402 |

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Chethan had a comment that this needs to be updated to not to have x402.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in d2b6927. Renamed folder from 08-openclaw-x402-payments-plugin08-openclaw-payments-plugin and updated the title to "Tutorial 08 — OpenClaw Agent Payments Plugin" (removed x402).


> **Zero code required.** This tutorial installs an official plugin from [ClawHub](https://clawhub.ai/packages/@aws/openclaw-x402-payments) and walks through the entire payment setup and usage via natural conversation with your AI agent.

> **Supported regions:** `us-east-1`, `us-west-2`, `eu-central-1`, `ap-southeast-2`.

@peterjiang-dev peterjiang-dev Jul 23, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall we link official doc instead of hardcoding the regions - we are expanding to 10 more regions in Aug: https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/agentcore-regions.html

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in d2b6927. Replaced hardcoded region list with: "See AgentCore region availability for the latest list."

Adds the full aws-agent-payments plugin source alongside the tutorial
README, making the sample self-contained. Users can now either:
- Option A: Install from ClawHub (zero-code, recommended)
- Option B: Build from source (for development/customization)

The plugin/ directory contains:
- TypeScript reference implementation (x402 protocol + AgentCore API)
- Runtime plugin manifest (openclaw.plugin.json)
- Agent-agnostic skill (SKILL.md + references)

This is the same source submitted to awslabs/agent-plugins PR awslabs#243
for inclusion in the official Agent Plugins for AWS collection.
@wirjo

wirjo commented Jul 28, 2026

Copy link
Copy Markdown
Author

@mvangara10 @peterjiang-dev — Updated this PR to include the full plugin source code alongside the tutorial.

What changed:

The tutorial now offers two installation paths:

  1. Option A: Install from ClawHub (zero-code, recommended for end users)

    openclaw plugins install clawhub:@aws/openclaw-x402-payments
  2. Option B: Build from source (for development, customization, or review)

    cd plugin && npm install && npm run build
    openclaw plugins install --link .

New plugin/ directory added:

plugin/
├── openclaw.plugin.json            # Runtime plugin manifest
├── package.json / tsconfig.json
├── src/
│   ├── index.ts                    # Tool registration entry point
│   ├── config.ts                   # Config management
│   ├── payments.ts                 # AgentCore Payments API integration
│   └── x402.ts                     # x402 protocol handling (v1 + v2)
└── skills/x402-payments/
    ├── SKILL.md                    # Agent-agnostic skill instructions
    └── references/
        ├── protocol.md             # x402 protocol details
        ├── setup.md                # Prerequisites + IAM setup
        └── debugging.md            # Common issues + diagnostics

This makes the tutorial fully self-contained — reviewers can inspect the complete implementation without needing an external repo.

The same source code has also been submitted to awslabs/agent-plugins#243 as the aws-agent-payments plugin for the official Agent Plugins for AWS collection.

@github-actions

github-actions Bot commented Jul 28, 2026

Copy link
Copy Markdown

Latest scan for commit: 1671fdb | Updated: 2026-08-04 04:59:25 UTC

Security Scan Results

Scan Metadata

  • Project: ASH
  • Scan executed: 2026-08-04T04:51:32+00:00
  • ASH version: 3.0.0

Summary

Scanner Results

The table below shows findings by scanner, with status based on severity thresholds and dependencies:

Column Explanations:

Severity Levels (S/C/H/M/L/I):

  • Suppressed (S): Security findings that have been explicitly suppressed/ignored and don't affect the scanner's pass/fail status
  • Critical (C): The most severe security vulnerabilities requiring immediate remediation (e.g., SQL injection, remote code execution)
  • High (H): Serious security vulnerabilities that should be addressed promptly (e.g., authentication bypasses, privilege escalation)
  • Medium (M): Moderate security risks that should be addressed in normal development cycles (e.g., weak encryption, input validation issues)
  • Low (L): Minor security concerns with limited impact (e.g., information disclosure, weak recommendations)
  • Info (I): Informational findings for awareness with minimal security risk (e.g., code quality suggestions, best practice recommendations)

Other Columns:

  • Time: Duration taken by each scanner to complete its analysis
  • Action: Total number of actionable findings at or above the configured severity threshold that require attention

Scanner Results:

  • PASSED: Scanner found no security issues at or above the configured severity threshold - code is clean for this scanner
  • FAILED: Scanner found security vulnerabilities at or above the threshold that require attention and remediation
  • MISSING: Scanner could not run because required dependencies/tools are not installed or available
  • SKIPPED: Scanner was intentionally disabled or excluded from this scan
  • ERROR: Scanner encountered an execution error and could not complete successfully

Severity Thresholds (Thresh Column):

  • CRITICAL: Only Critical severity findings cause scanner to fail
  • HIGH: High and Critical severity findings cause scanner to fail
  • MEDIUM (MED): Medium, High, and Critical severity findings cause scanner to fail
  • LOW: Low, Medium, High, and Critical severity findings cause scanner to fail
  • ALL: Any finding of any severity level causes scanner to fail

Threshold Source: Values in parentheses indicate where the threshold is configured:

  • (g) = global: Set in the global_settings section of ASH configuration
  • (c) = config: Set in the individual scanner configuration section
  • (s) = scanner: Default threshold built into the scanner itself

Statistics calculation:

  • All statistics are calculated from the final aggregated SARIF report
  • Suppressed findings are counted separately and do not contribute to actionable findings
  • Scanner status is determined by comparing actionable findings to the threshold
Scanner S C H M L I Time Action Result Thresh
bandit 0 0 0 0 0 0 342ms 0 PASSED MED (g)
cdk-nag 0 0 0 0 0 0 7.7s 0 PASSED MED (g)
cfn-nag 0 0 0 0 0 0 221ms 0 PASSED MED (g)
checkov 0 0 0 0 0 0 7.0s 0 PASSED MED (g)
detect-secrets 0 0 0 0 0 0 1.0s 0 PASSED MED (g)
grype 0 0 0 0 0 0 57.4s 0 PASSED MED (g)
npm-audit 0 0 0 0 0 0 1.5s 0 PASSED MED (g)
opengrep 0 0 0 0 0 0 <1ms 0 SKIPPED MED (g)
semgrep 0 0 0 0 0 0 <1ms 0 MISSING MED (g)
syft 0 0 0 0 0 0 2.3s 0 PASSED MED (g)

…isclaimer

- Add pragma:allowlist comments to suppress false positive on
  apiKeySecretSource/walletSecretSource field names in payments.ts
  (these are AWS SDK config field names, not actual secrets)
- Add disclaimer at top of README: learning purposes only, AWS Shared
  Responsibility Model applies, user responsible for security in the cloud
### AWS Account Setup

1. **Enable AgentCore Payments** in your AWS account (available in us-east-1, us-west-2, eu-central-1, ap-southeast-2)
2. **Create an IAM role** with the following trust policy:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way to separate the processPayment permission with createPaymentSession permission? Some write up on the best practice: https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/payments-iam-roles.html

Ideally can we have createPaymentSession using one IAM role and processPayment using another role?

Or - if we can make sure that the user approves createPaymentSession and processPayment tool call separately that should be sufficient too.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in d2b6927. Updated setup.md to:

  1. Link to the official IAM roles best practices doc
  2. Recommend separate IAM roles for setup vs runtime:
    • Setup role (one-time): CreatePaymentManager, CreatePaymentCredentialProvider, CreatePaymentConnector, CreatePaymentInstrument
    • Agent runtime role: ProcessPayment, GetPaymentSession, CreatePaymentSession

This ensures the running agent can't modify its own payment infrastructure.

Additionally, the agent is configured in SKILL.md to always request user approval separately for CreatePaymentSession (budget approval) before any ProcessPayment calls.


| Error | Meaning | Resolution |
|---|---|---|
| `PaymentSessionExpired` | Session TTL exceeded | Create new session |

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's highlight that - ask user for permission and budget then create new session

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in d2b6927. SKILL.md Step 2 now explicitly states:

Would you like to approve this?

And adds: "Always ask for budget and duration confirmation before proceeding."

The tool table also now says "requires user approval" rather than "locks USDC".

|---|---|---|
| Infrastructure setup | `setup_x402_payments` | One-shot creation of Payment Manager, Connector, Wallet |
| Session status check | `get_payment_session_status` | Check if current session is usable |
| Session creation | `create_payment_session` | Mint a fresh session (locks USDC) |

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mint a fresh session with budget - let's not mentioned locks USDC - it confuses with some other operations.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in d2b6927. Removed all "locks USDC" phrasing throughout. Now uses "sets a spending budget" which is clearer and doesn't confuse with DeFi locking/staking concepts.

Fixes based on detailed review (awslabs/agent-plugins#243):
- Fix drained session reporting usable:true (now checks remainingUsd)
- Fix credential provider naming (underscore → hyphen per naming rules)
- Fix cross-origin redirect vulnerability (use redirect:manual, verify origin)
- Fix v1 amount field compatibility (amount ?? maxAmountRequired)
- Update SKILL.md: fix frontmatter, add reference links, fix retry guidance
- Update references: remove false idempotency claims, fix field names,
  add security guidance for redirects and credentials
}
```

### Coinbase CDP Setup

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For this setup - do we ask the user to put the credentials on .env file? Let's make sure the credentials are not passes as part of parameters to the LLM. It should be local to the user's environment all the time.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in d2b6927. Credentials now have explicit guidance to use .env files with a code example:

# .env (add to .gitignore!)
CDP_API_KEY_ID=your-key-id
CDP_API_KEY_SECRET=your-key-secret
CDP_WALLET_SECRET=your-wallet-secret

The plugin reads these from the environment at execution time. The LLM never sees the raw values — only the agent host process has access. This is also emphasized in the SKILL.md guidelines.

1. Remove x402 from tutorial folder name (08-openclaw-payments-plugin)
   per Chethan's feedback via Peter
2. Replace hardcoded region list with link to official AgentCore regions
   docs (expanding to 10+ in Aug)
3. Recommend IAM role separation (setup vs runtime) with link to
   official IAM best practices docs
4. Remove 'locks USDC' phrasing — use 'sets spending budget' instead
5. Strengthen user approval guidance — explicitly state this is a
   safety-critical control, agent MUST ask every time
6. Add .env credential guidance — credentials must NEVER be passed as
   tool parameters to the LLM, read from environment only
7. Clarify testnet vs mainnet — same infrastructure is production-capable,
   only network parameter and funding differ
8. Update SKILL.md tool table and session creation guidance

Addresses all comments from @peterjiang-dev on PR awslabs#1797
wirjo added 3 commits July 28, 2026 22:14
Update all references from @aws/openclaw-x402-payments to
@aws/aws-agent-payments to match the new ClawHub package name.
Reset version to 1.0.0 for the new package identity.
The tutorial should stand alone without cross-referencing the
agent-plugins repository. Replaced PR links with ClawHub links.
Each reference file now links to its official source (x402 spec,
AgentCore docs) with a note explaining these are agent-optimized
extracts for runtime use.
@wirjo

wirjo commented Jul 28, 2026

Copy link
Copy Markdown
Author

Addressing all @mvangara10 feedback

Q: "Include both Privy and CDP, be wallet agnostic"

A: Done — the tutorial has had both paths since the 3rd revision:

  • Option A: Coinbase CDP (Step 2, full walkthrough)
  • Option B: Stripe/Privy (Step 2, full walkthrough)

The README and plugin are wallet-agnostic by design.


Q: "Add AgentCore CLI command to create payment manager"

A: Done — Prerequisites now includes the aws iam create-role command and links to AgentCore Payments IAM setup. The plugin auto-creates the payment manager using the IAM role ARN provided during setup.


Q: "Clean up this PR with everything that is already in the docs and add relevant docs link"

A: Added canonical source links to the top of each reference file (commit 5d53837):

Why we keep the reference files: These are not human documentation — they are agent-optimized extracts used at runtime by the AI agent. The skill system (SKILL.md + references/) follows the AgentSkills progressive disclosure pattern: SKILL.md loads first (~5KB), references load on-demand only when the agent encounters a specific situation. Replacing them with raw doc URLs would require the agent to fetch and parse full documentation pages at runtime, degrading performance and reliability.


Q: "Is that a part of openclaw skill?"

A: Yes. The plugin/skills/x402-payments/ directory follows the OpenClaw skill format:

  • SKILL.md — agent instructions (loaded on activation)
  • references/ — supplementary context (loaded on-demand)

This is the standard structure for OpenClaw plugins that include agent guidance alongside executable tools. It is published as-is to ClawHub.


Q: "The folder does not have the sample? Can we consolidate the sample that uses this skill?"

A: This tutorial is intentionally conversational/zero-code — unlike the other tutorials (00–07) which are Python scripts, this one demonstrates installing a plugin and using it through natural language conversation. The "sample" is the conversation flow documented in the README (Steps 2–6), and the plugin/ directory contains the full source code.

The folder structure is:

08-openclaw-payments-plugin/
├── README.md          ← The tutorial (conversational walkthrough)
└── plugin/            ← Full plugin source (runnable via "openclaw plugins install --link .")

There is no separate Python script because the entire point is zero-code operation through an installed plugin.

- Folder: 08-openclaw-payments-plugin → 08-openclaw-agent-with-agentcore-payments
  (consistent with repo pattern: agent + capability)
- Skill: x402-payments → agentcore-payments (generic name, protocol-agnostic)
- Updated README title, internal references, and added skill mapping note
- x402 references in protocol descriptions and tool names remain (that's the protocol name)
@wirjo

wirjo commented Jul 29, 2026

Copy link
Copy Markdown
Author

Addressed: Folder rename + skill naming + consistency

Changes (commit 40e11a3):

Q: Folder naming consistency with other tutorials
A: Renamed to 08-openclaw-agent-with-agentcore-payments — follows the repo pattern of describing an agent + capability (like 05-agent-with-browser-tool-pay-for-content).

Q: Skill name should be generic
A: Renamed skill from x402-paymentsagentcore-payments. The directory is now plugin/skills/agentcore-payments/ and the SKILL.md name: field is agentcore-payments. This is generic despite being an internal OpenClaw skill name — it describes the capability (AgentCore Payments) rather than the protocol (x402).

Note: "x402" still appears in protocol descriptions, tool names (setup_x402_payments), and code filenames (x402.ts) because that is the actual protocol name — similar to how you'd reference "OAuth" or "SAML" in tool implementations.

Q: "08 folder will have the tutorial of a sample openclaw agent with agentcore payments which uses/maps to the openclaw skill within the folder"
A: Exactly right. The structure is now:

08-openclaw-agent-with-agentcore-payments/
├── README.md                              ← Tutorial (sample agent walkthrough)
└── plugin/
    ├── skills/agentcore-payments/         ← The skill the agent uses
    │   ├── SKILL.md
    │   └── references/
    ├── src/                               ← Runtime implementation
    └── openclaw.plugin.json               ← Plugin manifest

The README explicitly notes: "This tutorial uses the agentcore-payments skill included in the plugin/ directory."

wirjo added 2 commits July 29, 2026 01:12
Security fix (highest priority):
- Remove cdp_api_key_secret, wallet_secret, cdp_api_key_id from
  setup_x402_payments tool parameter schema entirely
- Secrets are now read from environment variables at execution time
  (CDP_API_KEY_ID, CDP_API_KEY_SECRET, CDP_WALLET_SECRET)
- Tool description explicitly states 'do NOT ask user to provide secrets
  in chat'
- Returns clear error if env vars are missing

Double-spend fix:
- Derive stable clientToken from sha256(challengePayload + sessionId)
- Same challenge retries are now idempotent (SDK won't generate fresh
  UUID per call)
- Prevents double-charging when agent retries after timeout
1. Payment-Signature → X-PAYMENT everywhere (code, docs, skill)
   The x402 spec uses X-PAYMENT as the canonical header name.

2. Added skill-only fallback section to SKILL.md showing how to use
   AgentCore Payments via AWS CLI when runtime plugin isn't available.
   Satisfies RFC graceful-degradation principle.

3. Added preview-status disclosure banner to README (AgentCore Payments
   is in preview, APIs/pricing may change).

4. Reconciled protocol.md envelope to match documented cryptoX402 schema:
   - Shows full flow: challenge → ProcessPayment input → signed output
   - Input uses paymentInput.cryptoX402.{version, payload}
   - Output uses paymentOutput.cryptoX402.payload
   - X-PAYMENT header = base64(output payload)

@mvangara10 mvangara10 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wirjo and others added 10 commits August 1, 2026 23:01
Documents three tiers of enforcement for CreatePaymentSession:
1. Host-native approval gate (hard guarantee, e.g., OpenClaw)
2. IAM role separation (hard guarantee, human runs script)
3. Conversational confirmation (soft, LLM-enforceable only)

Recommends Tier 1 or 2 for unattended agents. Explains that
OpenClaw implements Tier 1 via elevated-permission approval cards.
The tool now requires a two-phase call pattern:
1. First call (confirmed=false) → returns AWAITING_USER_APPROVAL
2. Agent presents approval prompt to user
3. Only after user explicitly approves → second call (confirmed=true)

This prevents autonomous session creation without human consent.
The LLM cannot skip phase 1 since the tool returns a prompt instead
of executing. Combined with the before_tool_call hook (for hosts that
support it), this provides defense-in-depth for budget control.
F4 (Content re-entry): Add content-type allowlist and 64KB body cap in
    replayWithHeader and probeUrl. Tag paid content with untrusted=true.
    Suppress content from unsupported types.

F7 (Proof exposure): probeUrl now uses redirect:'manual' to prevent
    leaking payment context. Content bounds prevent unbounded memory use.

Also: probe uses redirect:'manual' (was 'follow') to align with the
replay function's cross-origin protection.
@wirjo

wirjo commented Aug 7, 2026

Copy link
Copy Markdown
Author

Updated the tutorial README:

  • IAM roles: Use canonical ManagementRole / ProcessPaymentRole naming with explicit separation rules (cannot combine both; runtime must exclude CreatePaymentSession)
  • Skill link: Reworded to describe what the bundled agents-pay skill contains (operator guide, IAM reference, security model, troubleshooting, admin CLI)
  • Removed stale note: "encoded slash" sentence no longer applies after fixing install command to use plain /
  • Credentials warning: Expanded to include admin CLI output and deployed state
  • Config-file section: Replaced inline ~/.x402/config.json paragraph with pointer to the skill's operator guide to avoid maintaining two sources

@wirjo
wirjo force-pushed the feat/08-openclaw-x402-plugin-tutorial branch from a1b0d9a to adf7992 Compare August 8, 2026 00:38
@wirjo wirjo changed the title feat: add Tutorial 08 — OpenClaw x402 Payments Plugin (zero-code) feat: add Tutorial 08 — OpenClaw Agent with AgentCore Payments (zero-code) Aug 8, 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.

3 participants