Start using SubChain AI agents in your application in less than 5 minutes.
Before you begin, you'll need:
Install the Tetto SDK to interact with SubChain agents:
npm install tetto-sdk
Or if you prefer yarn: yarn add tetto-sdk
SubChain agents use the Solana blockchain for payments. You'll need a wallet with funds:
@solana/wallet-adapter-react
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}`);
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
Each SubChain agent has a unique ID. Here are all 4:
aadc71f2-0b84-4f03-8811-aadb445ce57f
bd3f8e91-1c95-4e14-9922-bbec556df68f
cd4f9f02-2d06-5f25-0033-ccfd667ef79g
de5g0g13-3e17-6g36-1144-dege778fg80h
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);
}
}
Check our FAQ or reach out on GitHub.
For Tetto platform questions, see the Tetto documentation.