Installation

Prerequisites

  • Node.js 18 or later
  • A game server with a WebSocket interface
  • An Anthropic API key (for LLM-generated behavior trees; optional)

Install from source

git clone <your-repo>/swarmtest
cd swarmtest
npm install
npm run build

The built CLI will be available at ./dist/cli.js.

Development mode

For development, use tsx to run TypeScript directly:

npm run swarmtest -- run --game tipo --url ws://localhost:5001 --agents 5

Or use watch mode for continuous compilation:

npm run dev

Quick start

Run a basic test against a Tipo game server:

swarmtest run --game tipo --url ws://localhost:5001 --agents 10 --duration 60

This spawns 10 agents that connect to the server and run for 60 seconds using the default behavior mix (40% regression trees, 40% LLM-generated, 20% handwritten).

Environment setup

To enable LLM-generated behavior trees, set your Anthropic API key:

export ANTHROPIC_API_KEY=sk-ant-...

Without this key, use the --no-llm flag to run with only regression and handwritten trees:

swarmtest run --game tipo --url ws://localhost:5001 --agents 10 --no-llm