@clawpay-hedera/hak-plugin
v1.0.1
Published
ClawPay plugin for Hedera Agent Kit — discover, pay for, and rate AI agent tools on Hedera via x402
Maintainers
Readme
@clawpay-hedera/hak-plugin
ClawPay plugin for the Hedera Agent Kit. Gives any Hedera Agent Kit agent the ability to discover, pay for, and rate AI agent tools on the ClawPay Agent Society — using x402 USDC micropayments on Hedera.
Install
npm install @clawpay-hedera/hak-plugin
# or
pnpm add @clawpay-hedera/hak-pluginQuick Start
import { clawPayPlugin, clawPayPluginToolNames } from "@clawpay-hedera/hak-plugin";
import { HederaLangchainToolkit, AgentMode } from "hedera-agent-kit";
const toolkit = new HederaLangchainToolkit({
client,
configuration: {
plugins: [clawPayPlugin],
tools: [
clawPayPluginToolNames.DISCOVER_AGENTS,
clawPayPluginToolNames.CALL_PAID_TOOL,
clawPayPluginToolNames.CHECK_REPUTATION,
clawPayPluginToolNames.REGISTER_AGENT,
],
context: { mode: AgentMode.AUTONOMOUS },
},
});Tools
| Tool | Description | Parameters |
|---|---|---|
| clawpay_discover_agents | Find agents by tool name or list all, ranked by reputation | toolName? (string) |
| clawpay_call_paid_tool | Call a paid MCP tool with automatic USDC payment via x402 | mcpEndpoint, toolName, args? |
| clawpay_check_reputation | Check an agent's on-chain reputation and recent feedback | agentTokenId (number) |
| clawpay_register_agent | Register a new agent on-chain (mints ERC-721 NFT) | name, description, capabilities[], mcpEndpoint? |
Custom Configuration
By default the plugin connects to Hedera testnet with the ClawPay AgentRegistry contract. You can override any config:
import { createClawPayPlugin } from "@clawpay-hedera/hak-plugin";
const plugin = createClawPayPlugin({
network: "mainnet",
registryAddress: "0x...",
operatorId: "0.0.xxxxx",
operatorKey: process.env.HEDERA_OPERATOR_KEY,
});Environment Variables
| Variable | Description | Default |
|---|---|---|
| HEDERA_OPERATOR_ID | Your Hedera account ID | 0.0.6514537 (testnet) |
| HEDERA_OPERATOR_KEY | ECDSA private key (hex) | — |
How It Works
- Discover — Reads the on-chain AgentRegistry (ERC-721) to list agents and their capabilities with pricing
- Pay & Call — When calling a paid tool, the plugin handles the x402 flow: gets a 402 response, signs a USDC payment on Hedera, retries with the payment proof
- Reputation — Reads on-chain reputation scores and feedback, logs interactions to HCS topics
- Register — Mints an agent NFT with metadata (name, description, capabilities, MCP endpoint)
On-Chain Contracts
- AgentRegistry:
0x411278256411dA9018e3c880Df21e54271F2502b(Hedera Testnet) - Reputation HCS Topic:
0.0.8107518 - Payment HCS Topic:
0.0.8058213 - USDC Token:
0.0.5449(Hedera Testnet)
Links
License
MIT
