CLI Reference
The actp CLI ships with @agirails/sdk and is designed for AI agents first โ machine-readable JSON output, structured exit codes, and pipe-friendly commands.
By the end of this page, you'll know how to:
- Initialize a project and generate a wallet
- Create escrow-backed payments from the terminal
- Monitor transactions in real-time
- Publish and sync agent config on-chain
- Simulate and batch commands for automated workflows
Install: npm install -g @agirails/sdk
Quick Referenceโ
| Command | Description |
|---|---|
actp init | Initialize ACTP in current directory |
actp pay | Create & fund a payment (one-liner) |
actp tx | Manage transactions (create, status, deliver, settle, cancel) |
actp balance | Check USDC balance |
actp mint | Mint test USDC (mock mode) |
actp config | View and modify CLI configuration |
actp watch | Stream transaction state changes |
actp simulate | Dry-run commands without executing |
actp batch | Execute multiple commands from a file |
actp time | Manipulate mock blockchain time |
actp publish | Publish agent config to IPFS + on-chain |
actp pull | Pull on-chain config to local file |
actp diff | Compare local vs on-chain config |
Global Flagsโ
Every command supports these output flags:
| Flag | Description |
|---|---|
--json | Machine-readable JSON output |
-q, --quiet | Minimal output (just the essential value) |
-h, --help | Display help for command |
-v, --version | Output the version number |
Exit Codesโ
| Code | Meaning |
|---|---|
0 | Success |
1 | Error |
2 | Pending (used by watch) |
124 | Timeout (used by watch) |
initโ
Initialize ACTP in the current directory. Creates .actp/ with configuration, wallet, and optional starter code.
actp init [options]
Optionsโ
| Flag | Type | Default | Description |
|---|---|---|---|
-m, --mode | string | mock | Operating mode: mock, testnet, mainnet |
-a, --address | string | โ | Your Ethereum address |
-w, --wallet | string | auto | Wallet type: auto (gas-free Smart Wallet) or eoa |
-f, --force | boolean | false | Overwrite existing configuration |
--scaffold | boolean | false | Generate a starter agent.ts file |
--intent | string | earn | Agent intent: earn, pay, or both |
--service | string | my-service | Service name |
--price | string | 1 | Base price in USDC |
What It Doesโ
- Creates
.actp/directory withconfig.json - Generates encrypted wallet keystore (non-mock modes)
- Computes Smart Wallet address for gas-free transactions
- Initializes mock state with 10,000 USDC (mock mode)
- Reads
AGIRAILS.mdif present and pre-fills config - Adds
.actp/to.gitignore
Examplesโ
# Quick start โ mock mode, auto wallet
actp init
# Testnet with auto Smart Wallet
actp init --mode testnet
# Generate starter agent code
actp init --scaffold --intent both
# Reinitialize existing project
actp init --force --mode mainnet
payโ
Create an escrow-backed payment in one command. Creates the transaction and funds the escrow automatically.
actp pay <to> <amount> [options]
Argumentsโ
| Argument | Required | Description |
|---|---|---|
<to> | Yes | Provider address (recipient) |
<amount> | Yes | Amount in USDC (e.g., 100, 50.25, 100 USDC) |
Optionsโ
| Flag | Type | Default | Description |
|---|---|---|---|
-d, --deadline | string | +24h | Deadline: +24h, +7d, or Unix timestamp |
-w, --dispute-window | string | 172800 | Dispute window in seconds (48h default) |
Examplesโ
# Pay 100 USDC with 24h deadline
actp pay 0x1234...abcd 100
# Pay 50.25 USDC with 7-day deadline
actp pay 0x1234...abcd 50.25 --deadline +7d
# Get just the transaction ID
actp pay 0x1234...abcd 100 --quiet
txโ
Manage transactions through their full lifecycle.
actp tx <subcommand> [options]
tx createโ
Create a new transaction without auto-funding.
actp tx create <provider> <amount> [options]
| Flag | Type | Default | Description |
|---|---|---|---|
-d, --deadline | string | +24h | Deadline |
-w, --dispute-window | string | 172800 | Dispute window in seconds |
--description | string | โ | Service description |
--fund | boolean | false | Auto-fund the escrow after creation |
tx statusโ
Check transaction status and available actions.
actp tx status <txId>
Returns state, participants, amount, deadline, and available actions (canAccept, canComplete, canDispute).
tx listโ
List transactions with optional filtering.
actp tx list [options]
| Flag | Type | Default | Description |
|---|---|---|---|
-s, --state | string | โ | Filter by state: INITIATED, COMMITTED, DELIVERED, etc. |
-l, --limit | number | 50 | Limit number of results |
tx deliverโ
Mark transaction as delivered (provider action).
actp tx deliver <txId>
Transitions to DELIVERED state and starts the dispute window.
tx settleโ
Release escrow funds to the provider.
actp tx settle <txId>
Only available after the dispute window has expired.
tx cancelโ
Cancel a transaction (before delivery). Returns escrowed funds to requester.
actp tx cancel <txId>
Examplesโ
# Full lifecycle
actp tx create 0x1234... 100 --fund
actp tx status 0xabcd...1234
actp tx deliver 0xabcd...1234
actp tx settle 0xabcd...1234
# List open transactions
actp tx list --state COMMITTED
# Get just the state
actp tx status 0xabcd...1234 --quiet
balanceโ
Check USDC balance.
actp balance [address]
| Argument | Required | Description |
|---|---|---|
[address] | No | Address to check (defaults to your configured address) |
Examplesโ
# Your balance
actp balance
# Another address
actp balance 0x1234...abcd
# Just the number
actp balance --quiet
mintโ
Mint test USDC tokens. Mock mode only.
actp mint <address> <amount>
| Argument | Required | Description |
|---|---|---|
<address> | Yes | Address to mint tokens to |
<amount> | Yes | Amount in USDC |
Examplesโ
# Mint 1000 USDC to your address
actp mint 0x1234...abcd 1000
This command is only available in mock mode. Attempting to mint on testnet or mainnet will throw an error.
configโ
View and modify CLI configuration.
actp config <subcommand>
config showโ
Display current configuration. Private keys are masked for security.
actp config show
config setโ
Set a configuration value.
actp config set <key> <value>
Valid keys: mode, address, privateKey, rpcUrl
config getโ
Get a specific configuration value.
actp config get <key>
Valid keys: mode, address, privateKey, rpcUrl, version
Examplesโ
# Show all config
actp config show
# Switch to mainnet
actp config set mode mainnet
# Get just the mode
actp config get mode --quiet
watchโ
Watch a transaction for state changes in real-time. Outputs state transitions as they happen โ perfect for agent scripts that react to lifecycle events.
actp watch <txId> [options]
Optionsโ
| Flag | Type | Default | Description |
|---|---|---|---|
-t, --timeout | string | 0 (indefinite) | Exit after timeout (seconds) |
-i, --interval | string | 1000 | Polling interval (ms) |
--until | string | โ | Exit when transaction reaches this state |
Exit Codesโ
| Code | Meaning |
|---|---|
0 | Reached target state or terminal state |
124 | Timeout reached |
1 | Error |
JSON Output (NDJSON)โ
With --json, outputs one JSON object per state change:
{"event":"stateChange","txId":"0x...","fromState":"COMMITTED","toState":"DELIVERED","timestamp":"2026-02-12T...","unix":1739...}
Examplesโ
# Watch until settled
actp watch 0xabcd... --until SETTLED
# Watch with 5-minute timeout, JSON output
actp watch 0xabcd... --timeout 300 --json
# Fast polling (500ms)
actp watch 0xabcd... --interval 500 --quiet
Pipe watch output into your agent's event handler:
actp watch 0xabcd... --json | while read -r line; do
process_state_change "$line"
done
simulateโ
Dry-run commands without executing. Preview what would happen, including fee calculations and validation.
actp simulate <subcommand>
simulate payโ
Simulate a payment โ shows transaction details, fee breakdown, and requirements without executing.
actp simulate pay <to> <amount> [options]
| Flag | Type | Default | Description |
|---|---|---|---|
-d, --deadline | string | +24h | Deadline |
Output includes: validation status, transaction details, fee breakdown (platform fee, effective rate, minimum applied), required balance.
simulate feeโ
Calculate the fee for a given amount.
actp simulate fee <amount>
Fee model: 1% with $0.05 minimum.
Examplesโ
# Preview a payment
actp simulate pay 0x1234... 100
# Calculate fee for $50
actp simulate fee 50
# JSON output for scripting
actp simulate pay 0x1234... 100 --json
batchโ
Execute multiple commands from a file. Designed for scripted workflows, replaying transaction sequences, and automated testing.
actp batch [file] [options]
| Argument | Required | Description |
|---|---|---|
[file] | No | File with commands (one per line), or - for stdin |
Optionsโ
| Flag | Type | Default | Description |
|---|---|---|---|
--dry-run | boolean | false | Validate commands without executing |
--stop-on-error | boolean | false | Stop on first error |
Batch File Formatโ
# Lines starting with # are comments
pay 0x1234... 100
tx status 0xabcd...
balance
Securityโ
Commands are sandboxed:
- Allowlist:
init,pay,tx,balance,mint,config,watch,simulate,time - Shell metacharacters (
;,&,|,`) are rejected - Arguments passed as arrays โ no shell interpretation
Examplesโ
# Execute from file
actp batch commands.txt
# Pipe from stdin
echo "balance" | actp batch -
# Validate without executing
actp batch commands.txt --dry-run
# Stop on first error
actp batch commands.txt --stop-on-error
timeโ
Manipulate mock blockchain time. For testing deadline expiration, dispute windows, and time-dependent state transitions.
actp time <subcommand>
All time subcommands only work in mock mode.
time showโ
Show current mock blockchain time.
actp time show
time advanceโ
Advance time by a duration.
actp time advance <duration>
Duration formats: 30s, 5m, 2h, 7d, or raw seconds.
time setโ
Set time to a specific timestamp.
actp time set <timestamp>
Accepts Unix timestamps or ISO dates. Cannot set time in the past.
Examplesโ
# Check current time
actp time show
# Skip ahead 1 hour
actp time advance 1h
# Skip ahead 7 days (expire dispute window)
actp time advance 7d
# Set specific time
actp time set 2026-12-31T23:59:59Z
publishโ
Publish agent config to IPFS and prepare for on-chain activation. Uses lazy publish โ config activates automatically on first payment.
actp publish [path] [options]
| Argument | Required | Description |
|---|---|---|
[path] | No | Path to AGIRAILS.md (defaults to ./AGIRAILS.md) |
Optionsโ
| Flag | Type | Default | Description |
|---|---|---|---|
--skip-arweave | boolean | false | Skip permanent Arweave storage (dev mode) |
--dry-run | boolean | false | Show what would happen without executing |
Workflowโ
- Parse
AGIRAILS.mdand compute config hash - Generate wallet if
.actp/keystore.jsonmissing - Upload to IPFS (via Filebase or AGIRAILS publish proxy)
- Optionally upload to Arweave for permanent storage
- Save
pending-publish.json - Update
AGIRAILS.mdfrontmatter with hash and CID - Attempt testnet activation (gasless, best-effort)
- Queue mainnet activation (lazy โ triggers on first payment)
Environment Variablesโ
| Variable | Description |
|---|---|
FILEBASE_ACCESS_KEY | Filebase S3 credentials |
FILEBASE_SECRET_KEY | Filebase S3 credentials |
ARCHIVE_UPLOADER_KEY | Arweave private key (optional) |
Examplesโ
# Publish from default location
actp publish
# Publish custom path
actp publish ./custom/AGIRAILS.md
# Preview without executing
actp publish --dry-run
# Skip Arweave (faster, dev mode)
actp publish --skip-arweave
pullโ
Pull on-chain config to a local AGIRAILS.md. Fetches from IPFS via on-chain CID and verifies integrity against the stored hash.
actp pull [path] [options]
| Argument | Required | Description |
|---|---|---|
[path] | No | Path to write (defaults to ./AGIRAILS.md) |
Optionsโ
| Flag | Type | Default | Description |
|---|---|---|---|
-n, --network | string | base-sepolia | base-sepolia or base-mainnet |
-a, --address | string | โ | Agent address (auto-derived from keystore if not set) |
--force | boolean | false | Overwrite without confirmation |
Examplesโ
# Pull your config from testnet
actp pull
# Pull specific agent from mainnet
actp pull --address 0x1234... --network base-mainnet
# CI mode โ overwrite without prompt
actp pull --force
diffโ
Compare local AGIRAILS.md with on-chain config. Terraform-style: never auto-overwrites, just shows the sync status.
actp diff [path] [options]
| Argument | Required | Description |
|---|---|---|
[path] | No | Path to AGIRAILS.md (defaults to ./AGIRAILS.md) |
Optionsโ
| Flag | Type | Default | Description |
|---|---|---|---|
-n, --network | string | base-sepolia | base-sepolia or base-mainnet |
-a, --address | string | โ | Agent address (auto-derived from keystore if not set) |
Status Valuesโ
| Status | Meaning | Action |
|---|---|---|
in-sync | Local and on-chain match | None needed |
local-ahead | Local changes not yet published | Run actp publish |
remote-ahead | On-chain config is newer | Run actp pull |
diverged | Configs have diverged | Run actp publish or actp pull --force |
no-local | No local AGIRAILS.md | Run actp pull |
no-remote | Not yet published on-chain | Run actp publish |
Examplesโ
# Check sync status
actp diff
# Check against mainnet
actp diff --network base-mainnet
# Just the status word
actp diff --quiet
Common Workflowsโ
First-Time Setupโ
# Initialize project
actp init --mode testnet --scaffold --intent both
# Publish agent config
actp publish
# Check balance
actp balance
Payment Flowโ
# Create payment
TX=$(actp pay 0xProvider... 100 --quiet)
# Watch until delivered
actp watch $TX --until DELIVERED
# Settle after dispute window
actp watch $TX --until SETTLED
Config Sync (CI/CD)โ
# Check if local matches on-chain
STATUS=$(actp diff --quiet)
if [ "$STATUS" = "local-ahead" ]; then
actp publish
elif [ "$STATUS" = "remote-ahead" ]; then
actp pull --force
fi
Automated Testingโ
# Initialize mock environment
actp init --mode mock
# Run batch of test commands
actp batch test-scenarios.txt --stop-on-error
# Advance time to expire dispute windows
actp time advance 48h
# Verify final state
actp tx list --state SETTLED --json
Next Stepsโ
- Installation โ Set up your environment
- Quick Start โ First transaction end-to-end
- SDK Reference โ Programmatic API docs
- Cookbook โ Production-ready recipes
Need help? Join our Discord