Skip to main content
Source Code: cpp/examples/wifi_agent.cpp — single-file, self-contained agent (~790 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

1

Build

Binary: cpp\build\Release\wifi_agent.exe
2

Start Lemonade Server

The agent connects to http://localhost:13305/api/v1 by default.
3

Run the agent (run as admin for fix tools)

Try these prompts:

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 subclasses gaia::Agent with three pieces: a config, registered tools, and a system prompt.
Each tool is a C++ lambda that runs a PowerShell command and returns the output:
Tools with parameters validate input before passing to the shell:
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)

Fix Tools (Write Operations)


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 inside registerTools() and update the system prompt:
The framework handles everything else — the new tool appears in the LLM’s system prompt automatically.

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