GOAT Network
AgentKit

CLIs

AgentKit ships three command-line interfaces:

CLIAudiencePurpose
create-goat-agentDevelopersScaffold a starter project (minimal / defi / full preset)
agentkit-gnsEnd usersRegister, renew, and look up .goat names — on-chain or paid cross-chain via x402
agentkit-giftcardEnd usersBrowse brands, place giftcard orders, pay cross-chain in USDC/USDT, poll for fulfillment

The end-user CLIs ship as binaries on the main @goatnetwork/agentkit npm package and are invokable directly via npx -p @goatnetwork/agentkit <cli>. They do not require a generated project.

Project Scaffolder — create-goat-agent

The published create-goat-agent CLI generates a complete starter project with all boilerplate pre-configured. Choose from three presets depending on your use case.

If you already have an agent or app, start with manual installation instead. The official AgentKit product page positions the CLI as the path for runnable starter projects.

Usage

Terminal
npm create goat-agent
Terminal
pnpm dlx create-goat-agent

The CLI prompts you for three inputs:

  1. Project name -- the directory name for your new project
  2. Preset -- which plugin set to include
  3. Network -- target network (goat-testnet or goat-mainnet)

Presets

Plugins: wallet (10 actions)

Best for getting started quickly or building custom agents that only need basic wallet operations.

Terminal
npm create goat-agent
# Project name: my-agent
# Preset: minimal
# Network: goat-testnet

Plugins: wallet, wgbtc, bridge, bitcoin (23 actions)

Best for DeFi-focused agents that need bridging, wrapped BTC, and Bitcoin oracle access.

Terminal
npm create goat-agent
# Project name: my-defi-agent
# Preset: defi
# Network: goat-testnet

Plugins: All 15 plugins (118 actions)

Includes everything: wallet, DEX, bridge, x402 payments, merchant portal, ERC-8004 identity, BitVM2, LayerZero, NFTs, governance, faucet, Bitcoin, GNS (.goat names), and x402 giftcard purchase.

Terminal
npm create goat-agent
# Project name: my-full-agent
# Preset: full
# Network: goat-mainnet

Generated Project Structure

Generated files
my-agent/
├── package.json       # Dependencies and scripts
├── tsconfig.json      # TypeScript configuration
├── .env.example       # Environment variable template
├── README.md          # Quick start instructions
└── src/
    └── index.ts       # Main entry point with all plugins registered

Generated Code

The generated src/index.ts includes:

  • All plugin imports for the chosen preset
  • A NoopWalletProvider (replace with EvmWalletProvider or ViemWalletProvider for production)
  • An ActionProvider with all actions registered
  • A PolicyEngine configured for the chosen network
  • An ExecutionRuntime ready to execute actions

Example: minimal preset output

src/index.ts (minimal)
import { ActionProvider } from '@goatnetwork/agentkit/providers';
import { PolicyEngine, ExecutionRuntime } from '@goatnetwork/agentkit/core';
import { NoopWalletProvider } from '@goatnetwork/agentkit/core';
import {
  walletBalanceAction,
  getDetailsAction,
  getAllowanceAction,
  contractReadAction,
  contractWriteAction,
  transferNativeAction,
  transferErc20Action,
  approveErc20Action,
  deployContractAction,
  resolveTokenAction,
  NoopWalletReadAdapter,
} from '@goatnetwork/agentkit/plugins';

// Replace NoopWalletProvider with a real provider for production use.
const wallet = new NoopWalletProvider();

const provider = new ActionProvider();
provider.register(walletBalanceAction(new NoopWalletReadAdapter()));
provider.register(getDetailsAction(wallet));
provider.register(getAllowanceAction(wallet));
provider.register(contractReadAction(wallet));
provider.register(contractWriteAction(wallet));
provider.register(transferNativeAction(wallet));
provider.register(transferErc20Action(wallet));
provider.register(approveErc20Action(wallet));
provider.register(deployContractAction(wallet));
provider.register(resolveTokenAction());

const policy = new PolicyEngine({
  allowedNetworks: ['goat-testnet'],
  maxRiskWithoutConfirm: 'low',
  writeEnabled: true,
});

const runtime = new ExecutionRuntime(policy, {
  maxRetries: 2,
  retryDelayMs: 200,
});

console.log('Agent ready - minimal preset, 1 plugin(s)');
console.log('Registered actions:', provider.list().map((a) => a.name));

Running the Project

Terminal
cd my-agent
pnpm install   # or npm install
pnpm start     # runs: tsx src/index.ts

Customizing After Scaffolding

After generating your project:

Replace the wallet provider

Swap NoopWalletProvider for a real implementation:

src/index.ts
import { JsonRpcProvider, Wallet } from 'ethers';
import { EvmWalletProvider } from '@goatnetwork/agentkit/core';

const ethersProvider = new JsonRpcProvider('https://rpc.testnet3.goat.network');
const signer = new Wallet(process.env.PRIVATE_KEY!, ethersProvider);
const wallet = new EvmWalletProvider(signer, ethersProvider, 'goat-testnet');

Add custom actions

Use customActionProvider or implement ActionDefinition to add your own tools. See Custom Tools.

Connect to your AI framework

Export tools for your framework of choice:

src/index.ts
const tools = provider.openAITools();
// Or: provider.langChainToolDefs(), provider.mcpTools(), etc.

See the Frameworks guide for details.

Configure for production

  • Set up Redis idempotency for distributed deployments
  • Add Prometheus metrics for observability
  • Configure execution hooks for audit logging

See Runtime Configuration for details.

The CLI is published as the create-goat-agent npm package and generates projects that depend on @goatnetwork/agentkit.

The latest CLI scaffold writes GOAT_TESTNET_RPC_URL=https://rpc.testnet3.goat.network into .env.example, matching the upstream goat-testnet network config.


End-User CLI — agentkit-gns

Register, renew, and look up .goat names without writing any code. Runs against GOAT mainnet by default.

Show help
npx -p @goatnetwork/agentkit agentkit-gns --help

Common Commands

Look up a .goat name
npx -p @goatnetwork/agentkit agentkit-gns lookup alice

# Check availability
npx -p @goatnetwork/agentkit agentkit-gns search alice

# Quote a registration
npx -p @goatnetwork/agentkit agentkit-gns price alice --years 1 --token USDC

# Register on GOAT mainnet (requires USDC/USDT on GOAT)
npx -p @goatnetwork/agentkit agentkit-gns register alice --years 1 --token USDC

# Cross-chain register paid from BSC (USDT, 18 decimals on BNB Smart Chain)
npx -p @goatnetwork/agentkit agentkit-gns x402-register alice \
  --pay-chain 56 \
  --pay-token USDT \
  --pay-token-contract 0x55d398326f99059fF775485246999027B3197955

x402-register Flags

FlagDefaultDescription
--years <n>1Registration term in years (1-10)
--pay-chain <chainId>8453 (Base)Numeric source chain id
--pay-token <symbol>USDCSource token symbol (USDC / USDT)
--pay-token-contract <address>requiredSource-chain ERC-20 contract address
--wait-timeout <sec>180Max seconds to poll for the on-chain commit reveal window (minCommitmentAge is 60s on GOAT)
--poll-interval <sec>10Seconds between commit-readiness polls

Required Environment Variables

VariableRequiredDescription
GOAT_PRIVATE_KEYAlwaysWallet key for the GOAT-side wallet (owner of the registered name)
PAYMENT_CHAIN_RPC_URLx402-register onlyRPC URL of the source chain you're paying from (e.g., BSC)
PAYMENT_CHAIN_PRIVATE_KEYx402-register, optionalSource-chain signer key. Defaults to GOAT_PRIVATE_KEY when omitted (the CLI's pre-flight error message lists it among required vars, but the runtime fallback at cli-gns.ts makes it functionally optional when GOAT_PRIVATE_KEY is set)
GNS_API_BASE_URLOptionalOverride default https://gns-api.goat.network/api

Run agentkit-gns doctor for a full env diagnostic.

See the GNS reference for the full action surface, security model, and orchestration sequence.


End-User CLI — agentkit-giftcard

Browse giftcard brands, place orders, pay cross-chain in USDC/USDT, and poll until the order is fulfilled. Supports source chains Polygon, Base, Arbitrum, Optimism, BSC, and Metis.

Show help
npx -p @goatnetwork/agentkit agentkit-giftcard --help

Common Commands

The CLI bundles create-order, pay-order, and the fulfillment poll into a single buy subcommand. Use status / list-orders to inspect existing orders.

Browse, buy, track
# Discover available regions (US, CA, …) — start here. Brand catalogs are
# region-scoped; the upstream API silently defaults to US if you don't pick.
npx -p @goatnetwork/agentkit agentkit-giftcard regions

# List brands in a chosen region. --country is required in non-TTY contexts;
# interactively the CLI prompts with a region picker (US as the default).
npx -p @goatnetwork/agentkit agentkit-giftcard list-brands --country US

# Get details for one brand (includes products[] with UUIDs to pass to buy).
# get-brand is region-agnostic — brand UUIDs are global.
npx -p @goatnetwork/agentkit agentkit-giftcard get-brand <brand-id>

# List supported source chains and their tokens
npx -p @goatnetwork/agentkit agentkit-giftcard list-chains

# Buy a giftcard (createOrder → payOrder → poll until FULFILLED)
npx -p @goatnetwork/agentkit agentkit-giftcard buy \
  --product <product-id> --face-value 25 \
  --pay-chain 56 --pay-token USDT

# Inspect status (use --reveal-secrets to print card_code / card_pin / card_link)
npx -p @goatnetwork/agentkit agentkit-giftcard status <order-id>

# List past orders (filter by status, paginate)
npx -p @goatnetwork/agentkit agentkit-giftcard list-orders

buy Flags

FlagDefaultDescription
--brand <id>noneBrand UUID (skip if you pass --product directly)
--product <id>noneProduct UUID (skips brand lookup)
--face-value <amount>50Face value in the brand's local currency
--pay-chain <chainId>2345 (GOAT) when non-interactive; interactive picker otherwiseNumeric source chain id
--pay-token <symbol>USDCPayment token symbol (USDC or USDT)
--poll-timeout-sec <n>60Max seconds to poll for fulfillment

Safety Posture

The buy subcommand hard-refuses to run with a NoopWalletProvider outside of --dry-run / DEMO_MOCK=true. A real signer is mandatory for any production purchase. The chain-bound check verifies wallet.getChainId() matches the selected --pay-chain — refuses to broadcast on a chain mismatch.

Required Environment Variables

VariableRequiredDescription
GOAT_PRIVATE_KEYAlwaysWallet key (signs EIP-712 auth + broadcasts source-chain transfer when paying on GOAT)
PAYMENT_CHAIN_RPC_URLWhen --pay-chain is non-GOATRPC URL of the source chain you're paying from
PAYMENT_CHAIN_IDWhen --pay-chain is non-GOATNumeric chain id sanity-check for the source-chain wallet
PAYMENT_CHAIN_PRIVATE_KEYOptionalSource-chain signer key; falls back to GOAT_PRIVATE_KEY when omitted
GIFTCARD_API_BASE_URLOptionalOverride default https://giftcard-api.goat.network
DEMO_MOCKOptionaltrue allows buy --dry-run against a NoopWalletProvider for shape demos only

Run agentkit-giftcard doctor for env validation.

See the Giftcard reference for the full action surface and the cross-chain payment flow.

On this page