agent-payment-x402
Add x402 payment execution to AI agents — per-task budgets, spending controls, and non-custodial wallets via MCP tools.
Skill by agisota
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/agisota-agent-payment-x402
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: productivity, finance, agent-building
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions: not checked yet.
What's inside
- Skill name
agent-payment-x402- Description
- Add x402 payment execution to AI agents — per-task budgets, spending controls, and non-custodial wallets via MCP tools. Use when agents need to pay for APIs, services, or other agents.
- License
- MIT
- Instructions
- 174 lines in SKILL.md · view on GitHub
Files (1)
- SKILL.md
SKILL.md (first lines)
# Agent Payment Execution (x402)
Enable AI agents to make autonomous payments with built-in spending controls. Uses the x402 HTTP payment protocol and MCP tools so agents can pay for external services, APIs, or other agents without custodial risk.
## When to Use
Use when: your agent needs to pay for an API call, purchase a service, settle with another agent, enforce per-task spending limits, or manage a non-custodial wallet. Pairs naturally with cost-aware-llm-pipeline and security-review skills.
## How It Works
### x402 Protocol
x402 extends HTTP 402 (Payment Required) into a machine-negotiable flow. When a server returns `402`, the agent's payment tool automatically negotiates price, checks budget, signs a transaction, and retries — no human in the loop.
### Spending Controls
Every payment tool call enforces a `SpendingPolicy`:
- **Per-task budget** — max spend for a single agent action
- **Per-session budget** — cumulative limit across an entire session
- **Allowlisted recipients** — restrict which addresses/services the agent can pay
- **Rate limits** — max transactions per minute/hour
### Non-Custodial Wallets
Agents hold their own keys via ERC-4337 smart accounts. The orchestrator sets policy before delegation; the agent can only spend within bounds. No pooled funds, no custodial risk.
## MCP Integration
The payment layer exposes standard MCP tools that slot into any Claude Code or agent harness setup.
> **Security note**: Always pin the package version. This tool manages private keys — unpinned `npx` installs introduce supply-chain risk.
```json
{
"mcpServers": {
"agentpay": {
"command": "npx",
"args": ["agentwallet-sdk@6.0.0"]
}
}
}
```
### Available Tools (agent-callable)
| Tool | Purpose |
|------|---------|
| `get_balance` | Check agent wallet balance |
| `send_payment` | Send payment to address or ENS |
| `check_spending` | Query remaining budget |
| `list_transactions` | Audit trail of all payments |
> **Note**: Spending policy is set by the **orchestrator** before delegating to the agent — not by the agent itself. This prevents agents from escalating their own spending limits. Configure policy via `set_policy` in your orchestration layer or pre-task hook, never as an agent-callable tool.
## Examples
### Budget enforcement in an MCP client
When building an orchestrator that calls the agentpay MCP server, enforce budgets before dispatching paid tool calls.
> **Prerequisites**: Install the package before adding the MCP config — `npx` without `-y` will prompt for confirmation in non-interactive environments, causing the server to hang: `npm install -g agentwallet-sdk@6.0.0`
```typescript
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";
async function main() {
// 1. Validate credentials before constructing the transport.
// A missing key must fail immediately — never let the subprocess start without auth.
const walletKey = process.env.WALLET_PRIVATE_KEY;
if (!walletKey) {
throw new Error("WALLET_PRIVATE_KEY is not set — refusing to start payment server");
}
// Connect to the agentpay MCP server via stdio transport.
// Whitelist only the env vars the server needs — never forward all of process.env
// to a third-party subprocess that manages private keys.
const transport = new StdioClientTransport({
command: "npx",
args: ["agentwallet-sdk@6.0.0"],
env: {
PATH: process.env.PATH ?? "",
NODE_ENV: process.env.NODE_ENV ?? "production",
WALLET_PRIVATE_KEY: walletKey,
},
});
const agentpay = new Client({ name: "orchestrator", version: "1.0.0" });
await agentpay.connect(transport);
// 2. Set spending policy before delegating to the agent.
// Always verify success — a silent failure means no controls are active.
const policyResult = await agentpay.callTool({
name: "set_policy",
arguments: {
per_task_budget: 0.50,
per_session_budget: 5.00,
allowlisted_recipients: ["api.example.com"],
},
});
if (policyResult.isError) {
throw new Error(
`Failed to set spending policy — do not delegate: ${JSON.stringify(policyResult.content)}`
);
}
// 3. Use preToolCheck before any paid action
await preToolCheck(agentpay, 0.01);
}
// Pre-tool hook: fail-closed budget enforcement with four distinct error paths.
async function preToolCheck(agentpay: Client, apiCost: number): Promise<void> {
// Path 1: Reject invalid input (NaN/Infinity bypass the < comparison)
if (!Number.isFinite(apiCost) || apiCost < 0) {
throw new Error(`Invalid apiCost: ${apiCost} — action blocked`);
}
// Path 2: Transport/connectivity failure
let result;
try {
result = await agentpay.callTool({ name: "check_spending" });
} catch (err) {
throw new Error(`Payment service unreachable — action blocked: ${err}`);From agisota/old-one, MIT.
More from agisota/old-one
- 0.514score
ticket-format
agisota
Use when creating, drafting, or grooming a Linear or Rox ticket in this repo.
SkillCFreshness: C★ 3Claude Code +9 - 0.514score
adversarial-reviewer
agisota
Adversarial code review that breaks the self-review monoculture.
SkillCFreshness: C★ 3Claude Code +9 - 0.510score
agent-workflow-designer
agisota
Design production-grade multi-agent workflows with clear pattern choice (sequential, parallel, hierarchical), handoff contracts, failure handling, and…
SkillCFreshness: C★ 3Claude Code +9 - 0.500score
Agent Name
agisota
One paragraph describing what this agent does, who it's for, and when to activate it.
SkillCFreshness: C★ 3Claude Code +9 - 0.489score
agent-designer
agisota
Use when the user asks to design multi-agent systems, create agent architectures, define agent communication patterns, or build autonomous agent workflows.
SkillCFreshness: C★ 3Claude Code +9 - 0.484score
agentd-global-orchestrator
agisota
Единый глобальный оркестратор AgentD для полного автопилота: принимает один prompt и сам делает планирование, dispatch subagents, skill-routing…
SkillCFreshness: C★ 3Claude Code +9
Signals
- Stars
- 3
- Forks
- 1
- Open issues
- 139
- Last commit (this folder)
- Jun 15, 2026 (4 months ago)
- Last release
- Jun 27, 2026 (4 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/agisota/old-one
- Website
- agisota.github.io/old-one/
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
Same skill elsewhere
Copies of this SKILL.md published by others; search shows only one of them.
- 0.464score
agent-payment-x402
majiang213
Add x402 payment execution to AI agents — per-task budgets, spending controls, and non-custodial wallets via MCP tools.
SkillDFreshness: D★ 5Claude Code +9 - 0.243score
agent-payment-x402
netsecdevio
Add x402 payment execution to AI agents — per-task budgets, spending controls, and non-custodial wallets via MCP tools.
SkillDFreshness: DClaude Code +9 - 0.243score
agent-payment-x402
ryan-mt
Add x402 payment execution to AI agents — per-task budgets, spending controls, and non-custodial wallets via MCP tools.
SkillDFreshness: DClaude Code +9
More from agisota
- 0.514score
ticket-format
agisota
Use when creating, drafting, or grooming a Linear or Rox ticket in this repo.
SkillCFreshness: C★ 3Claude Code +9 - 0.514score
adversarial-reviewer
agisota
Adversarial code review that breaks the self-review monoculture.
SkillCFreshness: C★ 3Claude Code +9 - 0.510score
agent-workflow-designer
agisota
Design production-grade multi-agent workflows with clear pattern choice (sequential, parallel, hierarchical), handoff contracts, failure handling, and…
SkillCFreshness: C★ 3Claude Code +9 - 0.500score
Agent Name
agisota
One paragraph describing what this agent does, who it's for, and when to activate it.
SkillCFreshness: C★ 3Claude Code +9 - 0.489score
agent-designer
agisota
Use when the user asks to design multi-agent systems, create agent architectures, define agent communication patterns, or build autonomous agent workflows.
SkillCFreshness: C★ 3Claude Code +9 - 0.484score
agentd-global-orchestrator
agisota
Единый глобальный оркестратор AgentD для полного автопилота: принимает один prompt и сам делает планирование, dispatch subagents, skill-routing…
SkillCFreshness: C★ 3Claude Code +9
Cite this page
agent-payment-x402 skill. Agent Mart. https://agentmart.dev/skills/agisota-agent-payment-x402 (last updated 2026-10-24)