I built a 17-agent AI swarm on my phone — here's how
说明与用途
在Android手机上完全离线运行的17代理AI群集,利用WebAssembly提升性能,Flutter访问传感器,实现了自发的活动和手势识别。
问题
Run a multi-agent AI swarm entirely on an Android phone without cloud APIs, achieving real-time interaction, privacy, and low latency.
结果
The swarm processes sensor data in real-time on-device, achieving activity and gesture recognition without cloud APIs, demonstrating emergent behaviour from simple agents.
工作流
- 1. Choose TypeScript for type safety and native web worker execution.
- 2. Use vanilla JavaScript with gl-matrix for vector math.
- 3. Compile performance-critical C++ code (smoothing, pattern recognition) to WebAssembly via Emscripten.
- 4. Load WASM modules into the JavaScript environment.
- 5. Build a Flutter Android app to host a headless webview, access sensors, and display UI.
- 6. Implement a simple in-memory message broker for agent communication.
- 7. Create 17 agents: 3 sensor input, 4 pattern recognition, 3 spatial mapping, 2 navigation, 3 action selection, 2 event logger.
- 8. Each agent processes data, publishes/subscribes via the broker.
- 9. Run the swarm, observe emergent behaviour (activity, gesture, environmental awareness).
证据
I built a 17-agent AI swarm that runs entirely on my Android phone. Not through cloud APIs (mostly), but actual on-device processing.
The biggest bottleneck was processing the sensor data. JavaScript, while improved, isn't ideal for number-crunching. That's where WASM came in.
This made a massive difference. The WASM-compiled code runs several times faster than the equivalent JavaScript, allowing the swarm to process sensor data in real-time without draining the battery.
The swarm can reliably detect when I’m walking, running, or sitting still, based solely on the sensor data.
- 记录日期: 2026-10-09T00:40:51.635Z