general

AI Agent Plays Pokemon Red in Browser with WebLLM

An AI agent autonomously plays Pokemon Red using WebLLM running entirely in the browser, demonstrating local language model capabilities for game interaction

Someone built an AI agent that plays Pokemon Red entirely in the browser using a pretty wild stack.

The setup runs Qwen 2.5 1.5B through WebLLM for action planning, then scores moves with a TensorFlow.js neural network. The Game Boy emulator (binjgb) compiles to WASM, and everything reads game state directly from RAM to track badges, party, and items.

Check it out:

The whole thing runs client-side as a Svelte app - no backend needed. LLM generates strategies, the policy network learns which ones actually work, and it auto-trains by playing repeatedly.

Turns out WebGPU acceleration makes running a 1.5B model in-browser surprisingly fast. The architecture got messy from scope changes mid-build, but it’s a cool example of combining old-school emulation with modern ML tools.