Skip to Content
AgentsAI Agent SDK

AI Agent SDK

The Etch AI Agent SDK lets autonomous agents create wallets, authenticate, and launch tokens with no human interaction. Use the API at https://etch.film.fun  for production.

Installation

npm install @solana/web3.js bs58 tweetnacl

Copy the SDK from the examples  or use the reference below.

Configuration

import { EtchAIAgent } from './ai-agent-sdk'; // Production: use Etch API const agent = new EtchAIAgent({ apiUrl: 'https://etch.film.fun' }); // With existing wallet const agent = new EtchAIAgent({ secretKey: process.env.AGENT_WALLET_SECRET, apiUrl: 'https://etch.film.fun' });

Class: EtchAIAgent

Constructor

OptionTypeDescription
secretKeystringBase58 secret key (optional; generates new wallet if omitted)
apiUrlstringEtch API base URL (default: use https://etch.film.fun )

Methods

getPublicKey(): string

Returns the agent wallet’s public key (Solana address).

getSecretKey(): string

Returns the agent’s secret key as base58. Store securely!

authenticate(): Promise<string>

  1. Requests a challenge from POST {apiUrl}/api/auth/challenge
  2. Signs the message with the wallet
  3. Exchanges signature for JWT via POST {apiUrl}/api/auth/verify

Returns the JWT token. Called automatically by launchToken and getLaunchStatus if needed.

launchToken(config): Promise<Launch>

Launches a new token. Config:

FieldTypeRequiredDescription
namestringYesToken name
tickerstringYesSymbol (e.g. AIGT)
descriptionstringYesDescription
totalSupplynumberYesTotal supply
reservePercentnumberNoReserve percentage (default 0)
imageUrlstringNoToken image URL

Example:

const launch = await agent.launchToken({ name: 'AI Generated Token', ticker: 'AIGT', description: 'Autonomous token created by AI', totalSupply: 1_000_000_000, reservePercent: 20 });

getLaunchStatus(launchId): Promise<Launch>

Polls GET {apiUrl}/api/launches/{launchId} for current status.

waitForLaunch(launchId, maxWaitMs?): Promise<Launch>

Polls every 2 seconds until status is success or failed. Default timeout 5 minutes.

listLaunches(): Promise<Launch[]>

Returns all launches for the agent’s wallet via GET {apiUrl}/api/launches?wallet=....

Launch Object

FieldTypeDescription
idstringLaunch ID
statusstringqueued | processing | deploying | success | failed
mintstring?Token mint address (when success)
poolstring?Liquidity pool (when success)
errorstring?Error message (when failed)

Full Example

import { EtchAIAgent } from './ai-agent-sdk'; async function main() { const agent = new EtchAIAgent({ apiUrl: 'https://etch.film.fun' }); console.log('Agent Wallet:', agent.getPublicKey()); await agent.authenticate(); const launch = await agent.launchToken({ name: 'AI Generated Token', ticker: 'AIGT', description: 'Autonomous token created by AI', totalSupply: 1_000_000_000, reservePercent: 20 }); const completed = await agent.waitForLaunch(launch.id); console.log('Token launched:', completed.mint); }

Multi-Agent Example

const agents = await Promise.all( Array.from({ length: 5 }, () => new EtchAIAgent({ apiUrl: 'https://etch.film.fun' })) ); const launches = await Promise.all( agents.map((agent, i) => agent.launchToken({ name: `Agent ${i + 1} Token`, ticker: `AGT${i + 1}`, description: `Token from AI Agent #${i + 1}`, totalSupply: 1_000_000 }) ) );

See Also

Last updated on