How a $5 chip becomes an autonomous AI agent.
From user message to real-world action — every step on a single chip.
Telegram bot, USB serial console, or NATS messaging — all three feed into the same processing pipeline. The agent doesn't care how you talk to it.
Up to 5 iterations per request. WireClaw reasons about the task, selects tools, executes them, observes results, and decides whether to continue or respond. True agent behavior, not scripted logic.
Direct HTTPS calls to OpenRouter (or any OpenAI-compatible endpoint). Model is runtime-configurable via flash config. No proxy, no middleware — the ESP32 talks to the API directly.
Seven built-in tools give the agent direct hardware control — LEDs, GPIO, sensors, filesystem, and device-to-device messaging via NATS.
Each tool maps to a real hardware or system capability.
Control the onboard RGB LED — set any color, brightness, or turn it off. Visual feedback for every action.
Drive output pins to control relays, motors, actuators, or any digital output.
Read digital and analog values from sensors, switches, or voltage dividers.
Query free heap, uptime, WiFi signal strength, chip temperature, and more.
Read files from the onboard flash filesystem — configs, logs, persisted data.
Write data to flash — persist sensor readings, update configuration, save notes.
Publish messages to NATS subjects for device-to-device communication and IoT mesh coordination.
The onboard LED tells you what the agent is doing at a glance.
A 6-turn circular buffer stored on flash. Context persists across power cycles.
← oldest ··· newest → (write head)
| MCU | ESP32-C6 (RISC-V, 160 MHz, 512 KB SRAM) |
|---|---|
| Framework | Arduino + PlatformIO |
| Language | C++ (Arduino-flavored) |
| RAM Usage | ~280 KB with active conversation |
| JSON Parsing | Streaming token-by-token (ArduinoJson) |
| Buffer Strategy | Chunked HTTP reads, reused scratch buffers |
| Flash Storage | LittleFS partition for config + conversation history |
| API Protocol | HTTPS with TLS 1.2, OpenAI-compatible chat completions |
| NATS Support | Lightweight publish over TCP |
| Configuration | JSON config on flash — WiFi, API key, model, system prompt |
| History Buffer | 6-turn circular buffer persisted to flash |
Three steps from zero to a working AI agent.
Clone the repo and upload with PlatformIO: pio run -t upload
Edit the JSON config with your WiFi credentials, API key, and preferred model.
Send natural language via Telegram, serial console, or NATS — the agent handles the rest.