Source Code:
cpp/examples/wifi_agent.cpp — single-file, self-contained agent (~1,100 lines including 13 tools and a custom TUI).Platform: Windows (PowerShell network commands). Compiles on Linux for CI but tools require Windows to return real data.
Prerequisite: Lemonade Server running with a model loaded.
What This Agent Does
The Wi-Fi Troubleshooter is an AI agent that acts like an IT support specialist. When a user says “my internet isn’t working”, it runs a systematic diagnostic chain, reads real output from your machine, reasons about what’s wrong, and applies fixes automatically.- Runs real commands — every tool executes an actual PowerShell command and returns real output
- LLM-driven reasoning — no hardcoded if/else tree; the LLM reads each result and decides the next step
- Pure C++ — no Python, no MCP subprocess, no external dependencies. Just a compiled binary talking to a local LLM
- Fully local — the LLM runs on your AMD hardware via Lemonade Server. No data leaves your machine
Demo
Full diagnostic run on a Ryzen AI PC: the agent calls 5 tools in sequence, reads real network output, and reports status — all powered by a local LLM on the NPU.Quick Start
Architecture
The agent loop is a conversation between your C++ code and the LLM: Your C++ code provides the tools (what the agent can do), the system prompt provides the strategy (what it should do), and the LLM connects the two.How It Works
The agent subclassesgaia::Agent with three pieces: a config, registered tools, and a system prompt.
All string arguments from the LLM are validated with
isSafeShellArg() to reject shell metacharacters before constructing commands. See the Custom Agent guide for details on tool registration patterns.Tool Reference
Diagnostic Tools (Read-Only)
| Tool | What It Runs | Parameters |
|---|---|---|
check_adapter | netsh wlan show interfaces | none |
check_wifi_drivers | netsh wlan show drivers | none |
check_ip_config | ipconfig /all | none |
test_dns_resolution | Resolve-DnsName | hostname (optional) |
test_internet | Test-NetConnection 8.8.8.8 -Port 443 | none |
test_bandwidth | Cloudflare CDN parallel download/upload | none |
ping_host | Test-NetConnection <host> | host (required) |
Fix Tools (Write Operations)
| Tool | What It Runs | When to Use |
|---|---|---|
flush_dns_cache | Clear-DnsClientCache | Stale DNS entries |
set_dns_servers | Set-DnsClientServerAddress | Default DNS not responding |
renew_dhcp_lease | ipconfig /release + /renew | No IP or APIPA address |
toggle_wifi_radio | Windows Radio Management API | Adapter shows “Software Off” |
enable_wifi_adapter | Enable-NetAdapter | Adapter administratively disabled |
restart_wifi_adapter | Disable-NetAdapter + Enable-NetAdapter | Adapter stuck in bad state |
Diagnostic Flow
The system prompt teaches the LLM this decision tree. Each fix loops back to re-verify before declaring success:Extending the Agent
Add a tool insideregisterTools() and update the system prompt:
Next Steps
System Health Agent
Compare with the MCP-based approach for system diagnostics
C++ Framework Overview
AgentConfig reference, project structure, and how the agent loop works
Integration Guide
Use gaia_core in your own CMake project via FetchContent or find_package
Customizing Your Agent
Custom prompts, typed tools, MCP servers, output capture, and tuning