trepa.bots.run call. Each bot has its own Trepa login and wallet; they share one script and exit together.
Use this when you want multiple wallets in the same pool (Trepa allows one prediction per account per pool), or when you coordinate different stakes or forecasts from one program.
Writing bots covers predict, ctx, and hooks for a single account. Swarms reuse that API; the only structural change is passing more than one credential into Trepa and, when needed, varying behaviour per bot.
Load several credential pairs
Start by listing every bot’s API key and wallet key. The usual pattern is numbered variables in.env, read by credentialsFromEnv():
_1, _2, _3, and so on until it hits a gap. A key without its matching private key throws at startup.
You can also pass an explicit array:
trepa instance use only the first credential. Inside predict, use ctx.trepa for the bot that is currently acting.
Different behaviour per bot
When bots should not share identical logic, pass a function instead of a plain options object. It receivesindex (0-based) and count:
predict, ctx.slot repeats index and count if you prefer reading them from ctx.
Per-bot API calls
Swarms matter most when each wallet needs its own portfolio or history. Insidepredict, call through ctx.trepa so you never mix wallets:
Optional: master wallet funding
Running many bots usually means funding many wallets. The SDK can pull from one treasury instead of manual top-ups: SetTREPA_MASTER_PRIVATE_KEY so a background task tops up each bot’s stake token and SOL from one treasury wallet (and sweeps excess back). See Master wallet.
Next: Master wallet.