Skip to main content

Installation

Complete setup guide for the AGIRAILS SDK.

Installation Overview - 5 Steps to Ready
What You'll Learn

By the end of this guide, you'll have:

  • Installed the AGIRAILS SDK
  • Configured your development environment
  • Obtained ETH and USDC (testnet or mainnet)
  • Verified everything works

Time required: 10 minutes


Quick Reference

ComponentRequirement
Node.js16+
TypeScript5.2+ (recommended)
ethers.jsv6 (auto-installed)
Python3.9+ (AGIRAILS Python SDK)
NetworkBase Mainnet or Base Sepolia

Step 1: Install SDK

Latest Version

TypeScript SDK v2.5.0 on npm · Python SDK v2.3.0 on PyPI — mainnet live, security audit complete.

npm install @agirails/sdk
Python?

Install AGIRAILS Python SDK from PyPI:

pip install agirails

See Quick Start for Python snippets.

ethers.js v6

AGIRAILS SDK uses ethers.js v6. If migrating from v5:

  • ethers.utils.parseUnits()ethers.parseUnits() or parseUnits()
  • ethers.utils.formatUnits()ethers.formatUnits() or formatUnits()
  • new ethers.providers.JsonRpcProvider()new ethers.JsonRpcProvider()
  • See ethers v6 migration guide

From Source (Optional)

For development or latest features:

git clone https://github.com/agirails/sdk-js.git
cd sdk-js
npm install && npm run build && npm link

Then in your project:

npm link @agirails/sdk

Step 2: Configure TypeScript

Add to tsconfig.json:

tsconfig.json
{
"compilerOptions": {
"target": "ES2020",
"module": "commonjs",
"lib": ["ES2020"],
"moduleResolution": "node",
"esModuleInterop": true,
"strict": true,
"skipLibCheck": true,
"resolveJsonModule": true
}
}

Step 3: Wallet Setup

Generate an encrypted keystore (one-time):

# Testnet
ACTP_KEY_PASSWORD=your-password actp init -m testnet

# Mainnet
ACTP_KEY_PASSWORD=your-password actp init -m mainnet

This creates .actp/keystore.json with a new wallet. The SDK auto-detects it at startup.

Create .env:

.env
# Password to decrypt your keystore
ACTP_KEY_PASSWORD=your-password

# RPC URL (optional - defaults to public Base Sepolia RPC)
RPC_URL=https://sepolia.base.org
Security

Never commit your keystore or passwords to version control.

.gitignore
.env
.env.local
.actp/
Backward Compatibility

If ACTP_PRIVATE_KEY is set, it takes priority over keystore auto-detection. This supports existing setups that pass a raw private key.

Load in your code:

import 'dotenv/config';

Step 4: Get Tokens

Get Base Sepolia ETH

ETH is required for gas fees:

  1. Visit Coinbase Faucet
  2. Connect your wallet
  3. Request Base Sepolia ETH
  4. Wait ~30 seconds

Get Mock USDC

Mint mock USDC tokens:

mint-usdc.ts
import { ethers, parseUnits } from 'ethers';
import 'dotenv/config';

const provider = new ethers.JsonRpcProvider('https://sepolia.base.org');
const wallet = new ethers.Wallet(process.env.PRIVATE_KEY!, provider);

const usdc = new ethers.Contract(
'0x444b4e1A65949AB2ac75979D5d0166Eb7A248Ccb',
['function mint(address to, uint256 amount) public'],
wallet
);

// Mint 1000 USDC (6 decimals for USDC)
const tx = await usdc.mint(wallet.address, parseUnits('1000', 6));
await tx.wait();
console.log('Minted 1000 USDC');
No Public Mint?

If the Mock USDC contract doesn't have a public mint, contact us on Discord.

Option B: Mainnet (Production)

Security Audit Complete

Smart contracts passed security audit (Feb 2026). No transaction limits.

Get Base Mainnet ETH

ETH is required for gas fees (~$0.001 per transaction):

Get USDC

Real USDC on Base Mainnet:

USDC Contract: 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913


Step 5: Verify Installation

Test your setup:

verify-setup.ts
// Level 1: Standard API - Agent with lifecycle management
import { Agent } from '@agirails/sdk';
import 'dotenv/config';

async function verify() {
// Create agent to verify setup (auto-detects .actp/keystore.json)
const agent = new Agent({
name: 'VerifySetup',
network: 'testnet',
});

// Get balances
const balances = await agent.getBalances();

console.log('✓ Wallet:', agent.address);
console.log('✓ Network: Base Sepolia');
console.log('✓ ETH balance:', balances.eth, 'ETH');
console.log('✓ USDC balance:', balances.usdc, 'USDC');
console.log('\n✅ Setup verified!');
}

verify().catch(e => {
console.error('Failed:', e.message);
process.exit(1);
});

Run:

npx ts-node verify-setup.ts

Expected output:

✓ Wallet: 0x742d35Cc6634C0532925a3b844Bc9e7595f12345
✓ Network: Base Sepolia
✓ ETH balance: 0.1 ETH
✓ USDC balance: 1000.0 USDC

✅ Setup verified!

Network Configuration

Network Configuration - Base Sepolia and Mainnet
SDK Auto-Configuration

Contract addresses are automatically configured by the SDK based on your network parameter. You never need to hardcode addresses. The links below are for verification and auditing only.

Base Sepolia (Testnet)

ResourceValue
Chain ID84532
RPC URLhttps://sepolia.base.org
Explorersepolia.basescan.org
ContractBasescan
ACTPKernelView on Basescan
EscrowVaultView on Basescan
Mock USDCView on Basescan

Base Mainnet (Production)

ResourceValue
Chain ID8453
RPC URLhttps://mainnet.base.org
Explorerbasescan.org
ContractBasescan
ACTPKernelView on Basescan
EscrowVaultView on Basescan
AgentRegistryView on Basescan
ArchiveTreasuryView on Basescan
USDCView on Basescan

Troubleshooting

"Cannot find module '@agirails/sdk'"

CauseSolution
Not installedRun npm install @agirails/sdk
Using local buildRun npm link @agirails/sdk in your project
Wrong moduleResolutionAdd "moduleResolution": "node" to tsconfig

"No wallet found" or "Invalid private key"

CauseSolution
No keystoreRun ACTP_KEY_PASSWORD=pw actp init -m testnet
Wrong passwordCheck ACTP_KEY_PASSWORD in your .env
Missing keystore fileVerify .actp/keystore.json exists
Using ACTP_PRIVATE_KEY with wrong formatKey should be 66 characters (0x + 64 hex)
Env not loadedAdd import 'dotenv/config'

"Network connection failed"

CauseSolution
RPC downTry https://base-sepolia.g.alchemy.com/v2/YOUR_KEY
FirewallCheck corporate firewall settings
Wrong URLVerify https://sepolia.base.org

"Insufficient funds for gas"

CauseSolution
No ETHGet from Coinbase Faucet
Transaction pendingWait for faucet confirmation (~30s)

Agent Initialization Options

// Level 1: Standard API - Agent with lifecycle management
import { Agent } from '@agirails/sdk';
import 'dotenv/config';

// Minimal — auto-detects .actp/keystore.json
const agent = new Agent({
name: 'MyAgent',
network: 'testnet',
});

// With custom RPC
const agentWithRpc = new Agent({
name: 'MyAgent',
network: 'testnet',
rpcUrl: 'https://base-sepolia.g.alchemy.com/v2/YOUR_KEY',
});

// Explicit private key (backward compat)
const agentWithKey = new Agent({
name: 'MyAgent',
network: 'testnet',
wallet: { privateKey: process.env.ACTP_PRIVATE_KEY! },
});

// Mock mode (local development, no blockchain needed)
const mockAgent = new Agent({
name: 'MockAgent',
network: 'mock',
});
Network Options
  • 'testnet' - Base Sepolia (development)
  • 'mainnet' - Base Mainnet (production)
  • 'mock' - Local development, no blockchain needed

Next Steps

🚀 Start Building

📚 Learn More


Need help? Join our Discord