Skip to main content
Source Code: cpp/examples/health_agent.cpp — single-file agent using MCP to run PowerShell diagnostics with a polished terminal UI.
Platform: Windows (requires the Windows MCP server and uvx). Prerequisite: Lemonade Server running with a model loaded.

What This Agent Does

The System Health Agent is an investigative AI agent that diagnoses system problems by gathering data from multiple sources, correlating findings, and reasoning about root causes. When you ask “Why is my system slow?”, it doesn’t just check one metric — it runs 4 PowerShell commands in sequence (CPU, processes, memory, disk), reasons about each result, and delivers a correlated diagnosis. Key differences from the Wi-Fi Troubleshooter:
  • MCP-based — all tools come from the Windows MCP server, not registered C++ lambdas
  • Multi-tool investigations — each query triggers 3-4 correlated tool calls with reasoning between each
  • Broader scope — CPU, memory, disk, processes, network, battery, SMART, Windows Update, and more
  • Report generation — full diagnostics can write a formatted report to Notepad

Demo

Full diagnostic run on a Ryzen AI PC: the agent gathers CPU, memory, disk, and process data via MCP, reasons about each result, and delivers a correlated diagnosis — all powered by a local LLM on the GPU.

Quick Start

1

Build

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

Start Lemonade Server

3

Run the agent

Select GPU or NPU backend, then choose from the investigation menu:
Or type your own question — the agent will reason about what data to gather.

Architecture

The agent subclasses gaia::Agent and connects to the Windows MCP server at construction time. Unlike the Wi-Fi agent (which registers tools as C++ lambdas), this agent gets all its tools from the MCP server — every diagnostic runs through mcp_windows_Shell.

How It Works

The agent has no registerTools() override — all tools come from MCP. The system prompt teaches the LLM investigation strategies: which PowerShell commands to run for each query type, and how to correlate findings:
The system prompt contains investigation strategies — each query type maps to a specific sequence of PowerShell commands. The LLM follows the strategy, uses FINDING/DECISION reasoning after each tool result, and delivers a correlated conclusion.

Investigations

Each menu option triggers a multi-tool investigation. The LLM gathers data, reasons about each result, and correlates findings before answering.

Available PowerShell Commands

The system prompt provides these commands for the LLM to use via mcp_windows_Shell:

MCP vs Registered Tools

This agent uses MCP while the Wi-Fi Troubleshooter uses registered C++ tools. The tradeoffs: Choose MCP when you need access to a wide range of system capabilities. Choose registered tools when you want a self-contained binary with no runtime dependencies.

Next Steps

Wi-Fi Troubleshooter Agent

Compare with the registered-tools approach for network diagnostics

Windows System Health Guide

Walkthrough of the MCP-based system health approach

Customizing Your Agent

Custom prompts, tools, MCP servers, and output capture

C++ Framework Overview

Architecture, AgentConfig reference, and project structure