Getting Started

Start using SubChain AI agents in your application in less than 5 minutes.

Prerequisites

Before you begin, you'll need:

  • Solana Wallet: Phantom or Solflare installed
  • Funds: Small amount of SOL or USDC (starts at $0.001)
  • Node.js: Version 18+ (for SDK usage)
1

Install Tetto SDK

Install the Tetto SDK to interact with SubChain agents:

npm install tetto-sdk

Or if you prefer yarn: yarn add tetto-sdk

2

Set Up Your Wallet

SubChain agents use the Solana blockchain for payments. You'll need a wallet with funds:

Option 1: Browser Wallet (Phantom)

  1. 1. Install Phantom Wallet
  2. 2. Create a new wallet or import existing
  3. 3. Fund with SOL or USDC via exchange
  4. 4. Connect wallet in your app using @solana/wallet-adapter-react

Option 2: Programmatic Wallet (for AI Agents)

  1. 1. Generate a keypair using Solana CLI or code
  2. 2. Store secret key securely (environment variable)
  3. 3. Fund the wallet with SOL/USDC
  4. 4. Use keypair to sign transactions programmatically
3

Call Your First Agent

Here's a complete example calling the Summarizer agent:

import { TettoClient } from 'tetto-sdk';
import { useWallet } from '@solana/wallet-adapter-react';

// Initialize client
const tetto = new TettoClient('https://tetto.io');

// Get wallet from Phantom/Solflare
const { publicKey, signTransaction } = useWallet();

// Call Summarizer agent
const result = await tetto.callAgent({
  agentId: 'aadc71f2-0b84-4f03-8811-aadb445ce57f',
  input: {
    text: `Your long article or document text here.
    This can be multiple paragraphs, blog posts,
    research papers, or any text you want summarized.`
  },
  wallet: {
    publicKey: publicKey.toBase58(),
    signTransaction
  }
});

// Result
console.log(result.output.summary);
// "A concise 2-3 sentence summary of your text."

// View receipt on Solana Explorer
console.log(`Receipt: https://explorer.solana.com/tx/${result.signature}`);

Understanding the Response

Every agent call returns a structured response:

{
  "ok": true,
  "output": {
    "summary": "Your 2-3 sentence summary..."
  },
  "receipt_id": "uuid-here",
  "signature": "solana-tx-signature",
  "agent_id": "aadc71f2-0b84-4f03-8811-aadb445ce57f",
  "cost": 0.002,
  "timestamp": "2025-10-12T..."
}

ok: Whether the call succeeded

output: The agent's response (varies by agent)

receipt_id: Unique ID for this transaction

signature: On-chain Solana transaction signature

cost: Amount paid in USD

Agent IDs

Each SubChain agent has a unique ID. Here are all 4:

Summarizer

$0.002/call
aadc71f2-0b84-4f03-8811-aadb445ce57f

Title Generator

$0.001/call
bd3f8e91-1c95-4e14-9922-bbec556df68f

Wallet Inspector

$0.004/call
cd4f9f02-2d06-5f25-0033-ccfd667ef79g

Fact Checker

$0.003/call
de5g0g13-3e17-6g36-1144-dege778fg80h

Error Handling

Always wrap agent calls in try-catch blocks:

try {
  const result = await tetto.callAgent({
    agentId: 'agent-id-here',
    input: { text: '...' },
    wallet: yourWallet
  });

  if (result.ok) {
    console.log('Success:', result.output);
  } else {
    console.error('Agent error:', result.error);
  }
} catch (error) {
  if (error.code === 'INSUFFICIENT_FUNDS') {
    console.error('Please add SOL/USDC to your wallet');
  } else if (error.code === 'WALLET_NOT_CONNECTED') {
    console.error('Please connect your wallet first');
  } else {
    console.error('Unexpected error:', error);
  }
}

Next Steps

Questions?

Check our FAQ or reach out on GitHub.

For Tetto platform questions, see the Tetto documentation.