# Machine Guard: CPU, RAM and GPU Limits for Heavy Agent Jobs

> Runs builds, tests, renders and training through one command that keeps CPU, RAM and GPU under your limits, stops a runaway job before the computer freezes or crashes, and reports the peak of every part.

Machine Guard: CPU, RAM and GPU Limits for Heavy Agent Jobs is a free AI agent skill on Agensi by asad eisa, in LLM Ops. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: Free
- Creator: [asad eisa](https://www.agensi.io/creators/asad-eisa)
- Category: [LLM Ops](https://www.agensi.io/skills/llm-ops)
- Version: 1.0
- Last updated: 2026-11-29
- Security: scan passed (2026-11-29); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/machine-guard-cpu-ram-and-gpu-limits-for-heavy-agent-jobs
- Tags: llm-ops, python, devops, system-monitoring, automation, cpu, ram, crash-prevention

## About this skill

AI agents size jobs for a server. They run make -j$(nproc), start one test worker per core, fill the GPU with a render, or run a script that leaks memory. On a laptop that means a frozen desktop, fans at full speed, an out-of-memory crash or a blue screen. The agent never notices, because from inside the job everything looked fine. This skill was written after exactly that: an agent's render blue-screened a 12-core laptop.

This skill gives your agent one command that runs any job inside CPU, RAM and GPU limits, stops it before the machine falls over, and tells the agent how to retry it lighter.

What it handles

Check first: guard.py check shows the load of every part, how many workers fit (-j6, --workers 6), how much RAM is left for the job, and OK or WAIT.
Every core is not an option: guard.py run -- <command> starts the job at low priority and pinned to part of this machine's cores (about half at the default 65 % limit: 2 of 4, 4 of 8, 8 of 16). Every compiler, browser, ffmpeg or worker process the job starts later inherits both. On Windows the job is pinned before it runs a single instruction.
Throttling: if CPU stays over the limit anyway (on macOS, or because of other load), the job is paused and resumed within each second until it is back under the limit.
Runaway stop: RAM over its limit for 3 seconds (or 3 points over it at once), the NVIDIA card too hot, the CPU too hot, or the job over its own memory cap: the job and every process it started are stopped, and the agent gets exit code 75 plus a next: line telling it how to retry lighter.
Every part watched: CPU, RAM, the job's own memory, NVIDIA use, encoder, temperature and memory (nvidia-smi), and on Windows also Intel and AMD GPU use from the same counters Task Manager shows. A warning when one part sits at 95 % while others are idle.
Peaks and a machine-readable result: a peaks: line and one GUARD_RESULT {json} line after every job, plus an optional per-second CSV log.
Fits your machine, not ours: core counts, worker counts and free RAM are read from the computer it runs on, from a 4-core laptop to a 64-core workstation. The defaults (CPU 65 %, RAM 80 %, NVIDIA 85 C) are a cautious starting point. Raise them for more speed or lower them for more safety, per run (--cpu 90) or once for every project (guard.py config --cpu 90 --ram 90 --global). --cpu 100 lifts the CPU limit entirely.
Windows, Linux and macOS. Needs only Python and psutil. Free and open source (MIT).

## Requires

- Runs on Windows only
- Python
- psutil

Run: pip install psutil. Pinning to cores works on Windows and Linux; macOS uses throttling instead. NVIDIA readings need the NVIDIA driver (nvidia-smi). Intel/AMD GPU use is read on Windows only.

## Known limitations

macOS cannot pin processes to cores; the CPU limit is held by throttling instead, which is coarser.
GPU temperature is read for NVIDIA cards only (nvidia-smi). Intel and AMD GPU use is read on Windows only, without temperature. Apple GPUs are not read.
CPU temperature is read on Linux only, when the kernel exposes it.
The RAM limit is for the whole machine. A job is stopped when the machine as a whole passes it, even if another program used the memory. Use --job-ram to cap the job itself.
A very fast leak can pass the RAM limit by a few points in the second before it is stopped.
It guards jobs started through it. It does not limit programs that are already running or that the agent starts some other way.
Shell syntax (&&, pipes, redirects) is not interpreted; wrap it in bash -c or cmd /c.

## How to use this skill

1. Connect your AI agent to Agensi once: add the MCP server https://mcp.agensi.io/mcp/auth and sign in with your Agensi account (OAuth, no API key). Steps for Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and other agents: https://www.agensi.io/docs/mcp-setup
2. Ask your agent: "Use the Machine Guard: CPU, RAM and GPU Limits for Heavy Agent Jobs skill from Agensi" and describe your task.
3. Your agent loads the skill from Agensi when it needs it. Nothing is downloaded.

## Frequently asked questions

### Does it slow my builds down?

Only as much as you allow. At the default 65 % CPU limit a job gets about half of your cores (4 of 8, 8 of 16), so a build that would have used all of them takes longer, but the desktop and the agent stay responsive. Want more speed? Raise it: --cpu 90 for one run, guard.py config --cpu 90 --global for every project, or --cpu 100 to lift the CPU limit.

### What happens when the guard stops a job?

It stops the job and every process the job started, prints why, the peaks, and a next: line ("retry with fewer workers or a smaller batch"), and exits with code 75. The skill tells the agent to make the job lighter before trying again, never to rerun it unchanged or raise the limit by itself.

### Do I need an NVIDIA card?

No. CPU, RAM and job-memory limits work on any machine. With an NVIDIA card (and its driver), the guard also reads GPU use, encoder, temperature and memory, and stops a job that overheats the card. On Windows it also reads Intel and AMD GPU use.

### Are the limits right for my machine?

The defaults (CPU 65 %, RAM 80 %, NVIDIA 85 C) are cautious, meant for a laptop. Everything else is measured on your computer: cores, free RAM, GPU. On a desktop or workstation you will probably want higher limits; on a small or hot laptop, lower ones. Every limit goes both ways and can be saved once with guard.py config.

### Does it work on macOS?

Yes, with one difference: macOS cannot pin a process to cores, so the guard holds the CPU limit by pausing and resuming the job within each second. RAM, job memory and the summary work the same as on Windows and Linux.

---

Source: [Agensi](https://www.agensi.io), the marketplace of skills for AI agents. Any MCP-compatible agent (Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and more) connects at https://mcp.agensi.io/mcp/auth and signs in with an Agensi account; setup for every agent: https://www.agensi.io/docs/mcp-setup. Append .md to any skill, guide or docs address on agensi.io for its markdown version.
