GOAT Plugin

Use Cron Protocol with the Great Onchain Agent Toolkit (GOAT SDK) to give AI agents subscription management superpowers.

Overview

The @cron/goat package is a GOAT SDK plugin that exposes Cron Protocol as a set of on-chain tools for AI agents. Agents can list plans, check subscription status, subscribe, cancel, and create plans — all from a natural language prompt.

Installation

bash
npm install @cron/goat @goat-sdk/core

Available Tools

  • cron_list_plans — search active subscription plans
  • cron_get_plan — fetch plan details by ID
  • cron_get_subscription — check a wallet's subscription status
  • cron_subscribe — subscribe the connected wallet to a plan
  • cron_cancel_subscription — cancel an active subscription
  • cron_create_plan — create a new subscription plan as a merchant
  • cron_api_list_plans — list plans via paid MPP API
  • cron_api_chargeable — query chargeable subscriptions via paid MPP API

Usage with Vercel AI SDK adapter

typescript
import { CronClient } from "@cron/sdk";
import { cronPlugin } from "@cron/goat";
import { getOnChainTools } from "@goat-sdk/adapter-vercel-ai";

const client = new CronClient({
  chain: "base",
  walletClient, // your viem WalletClient
});

const tools = await getOnChainTools({
  wallet: viemWalletClient,
  plugins: [cronPlugin({ client })],
});

// Use with generateText / streamText
const result = await generateText({
  model: anthropic("claude-sonnet-4-6"),
  tools,
  prompt: "Check if 0xABC... has an active subscription to plan 1",
});

With MPP transport

typescript
import { MppTransport } from "@cron/sdk";
import { privateKeyToAccount } from "viem/accounts";

const mpp = new MppTransport({
  account: privateKeyToAccount(process.env.AGENT_KEY!),
  maxSessionDeposit: "5",
});

const tools = await getOnChainTools({
  wallet: viemWalletClient,
  plugins: [cronPlugin({ client, mpp, apiBaseUrl: "https://api.cronprotocol.xyz" })],
});

Usage with raw tools

You can also access the raw tool definitions without the GOAT adapter:

typescript
import { buildCronTools } from "@cron/goat";

const tools = buildCronTools(client);

// Each tool has: name, description, parameters (zod schema), execute()
const result = await tools.getSubscription.execute({
  subscriber: "0xabc...",
  planId: "1",
});
console.log(result); // { status: "Active", chargeCount: "3", ... }

[i] Supported chains

The GOAT plugin supports Base, Base Sepolia, Arbitrum One, and Arbitrum Sepolia. Pass the correct chain when constructing CronClient.

Supported chain IDs

  • 8453 — Base
  • 84532 — Base Sepolia
  • 42161 — Arbitrum One
  • 421614 — Arbitrum Sepolia