A tic-tac-toe game demonstrating elizaOS's ability to run agents without an LLM.
- No Character Required: Uses the new anonymous character feature (
Agent-N) - No LLM Calls: Custom model handlers implement perfect play via minimax
- Custom Model Handlers: Intercepts
TEXT_LARGEandTEXT_SMALLto return optimal moves - plugin-sql: Uses PGLite in-memory database for persistence
TypeScript entry: game.ts.
Instead of calling an LLM, this agent registers custom model handlers that:
- Parse the board state from the text prompt
- Use the minimax algorithm to find the optimal move
- Return the move as a simple number (0-8)
The agent never loses - it will always win or draw!
# TypeScript
bun run packages/examples/tic-tac-toe/game.ts┌─────────────────────────────────────────────────────────┐
│ AgentRuntime │
│ (Anonymous Character) │
├─────────────────────────────────────────────────────────┤
│ plugins: │
│ ├── plugin-sql (persistence) │
│ ├── bootstrap-plugin (basic capabilities) │
│ └── tic-tac-toe-plugin (custom model handlers) │
├─────────────────────────────────────────────────────────┤
│ runtime.useModel(TEXT_SMALL, { prompt: boardState }) │
│ ↓ │
│ ticTacToeModelHandler() ← NOT an LLM! │
│ ↓ │
│ parseBoardFromText() → minimax() → optimal move │
└─────────────────────────────────────────────────────────┘
Since there's no LLM latency, the AI responds instantly:
- ~100 games per second on typical hardware
- Zero API calls
- Zero cost