v0.1 — Phase 1

Installation

bash
npm install @clawdgo/openclaw

Setup

typescript
import { ClawdGoTool } from "@clawdgo/openclaw";
import { OpenClawAgent } from "openclaw";

const agent = new OpenClawAgent({
  tools: [
    new ClawdGoTool({
      accountId: process.env.CLAWDGO_ACCOUNT_ID,
      apiKey: process.env.CLAWDGO_API_KEY,
    }),
  ],
});
Use agent-scoped keys. The apiKey passed to ClawdGoTool should be an agent-scoped key, not your operator key. An agent key is bound to the single account specified in accountId. Generate agent keys from the dashboard or via the CLI.

Available tool functions

The ClawdGoTool exposes these typed functions to the agent's language model. The LLM can call them directly within its reasoning loop.

clawdgo.getBalance

Returns the current USDC balance of the agent's account.

typescript
// The agent might call this internally when reasoning about a budget
// Agent prompt: "Do I have enough to pay the vendor $120?"

const result = await agent.run(
  "Check my USDC balance and let me know if I have enough to pay invoice #1042 for $120."
);
// Agent calls clawdgo.getBalance internally, then reasons over the result

clawdgo.sendPayment

Sends USDC to a recipient address or ClawdGo account. Takes to, amount, memo, and idempotency_key.

typescript
// Fully autonomous payment — agent reasons and executes
const result = await agent.run(
  "Pay invoice #1042 to vendor account acct_03x1m7p9k2qrst4ab for $120 USDC."
);
// Agent: calls clawdgo.sendPayment with amount="120.00", memo="Invoice #1042",
// idempotency_key="invoice-1042", confirms settlement, reports back.

clawdgo.getTransactionHistory

Returns recent transactions for the account. Useful for agents that need to verify prior payments or build a spend summary.

Idempotency key generation

The ClawdGoTool can generate idempotency keys automatically from the agent's task context, or you can pass them explicitly. If the agent is in a reasoning loop that might retry a payment, auto-generation is safer — the same logical payment in the same task will always produce the same key.

typescript
new ClawdGoTool({
  accountId: process.env.CLAWDGO_ACCOUNT_ID,
  apiKey: process.env.CLAWDGO_API_KEY,
  idempotencyStrategy: "task-scoped", // derives key from task_id + operation
})

Example: agentic invoice payment

typescript
import { ClawdGoTool } from "@clawdgo/openclaw";
import { OpenClawAgent } from "openclaw";

const agent = new OpenClawAgent({
  systemPrompt: `You are a payment agent. When asked to pay an invoice,
    verify the balance, confirm the amount is within policy, then execute.
    Always include the invoice number in the memo.`,
  tools: [
    new ClawdGoTool({
      accountId: process.env.CLAWDGO_ACCOUNT_ID,
      apiKey: process.env.CLAWDGO_API_KEY,
    }),
  ],
});

const result = await agent.run(
  "Pay invoice #5521 to 9xTz4KqR8mYvPn3SdFgHj6WbCeAuLo1XkQi5NtZpMwV for $85 USDC"
);

console.log(result.output);
// "Payment of $85.00 USDC completed. Transaction: 5j4Kz9qX... settled at 10:41:02Z."

What the agent cannot do

The ClawdGoTool only exposes read and transfer functions. The agent cannot:

  • Modify spending policy
  • Pause or unpause its own account
  • Provision new accounts
  • Access other agents' accounts

These constraints are enforced by the agent-scoped API key — not just by the SDK.