# psutil — card for AI agents

Cross-platform library for retrieving process and system monitoring information.

Category: Logging, monitoring and analytics · PyPI package `psutil` · latest version 7.2.2 (checked 2026-11-01)
Install: `pip install psutil`
License: BSD-3-Clause (permissive)

In your own product (generator, app, hosted service): **yes**. Permissive license: ship it inside your own product, closed or open source, and keep its license and copyright notice.

## Rules for AI agents (paste into AGENTS.md or CLAUDE.md)

## psutil
- Install with `pip install psutil`. For platform-specific details, follow https://psutil.io/install/.
- When you read several attributes of one process, put the calls inside `with p.oneshot():`, as the docs' performance section recommends.
- When you iterate over processes, pass an attrs list, e.g. `psutil.process_iter(['pid', 'name'])`, as the docs recommend.
- In `process_iter()` loops, follow Juniper's sample: wrap `proc.as_dict(attrs=[...])` in `try` / `except psutil.NoSuchProcess`.
- On Junos devices, call only the functions in Juniper's support table. It lists no sensor functions for either Junos variant.
- The docs note that `psutil.getloadavg()` on Windows is emulated.
- psutil.io documents the development version. Check psutil.readthedocs.io/stable for the current release.

## What it is
- psutil stands for "Process and System Utilities for Python". It is a cross-platform library that reports on running processes and on system use: CPU, memory, disks, network and sensors. The README and the project site both say it implements many functionalities of Unix command-line tools such as `ps`, `top`, `free`, `iotop`, `netstat`, `ifconfig` and `lsof`. It is BSD-3-Clause licensed and installs with `pip install psutil`.
- The API has two parts. System-wide functions include `psutil.cpu_percent()`, `psutil.virtual_memory()`, `psutil.disk_usage('/')` and `psutil.net_connections()`, and the doc examples show them returning named tuples such as `svmem(...)`. A `psutil.Process(pid)` object covers a single process: its name, command line, parent and children, CPU and memory use, open files and connections. The docs keep a one-page API overview, with output taken from Linux, as a quick reference.
- The site says psutil is useful mainly for system monitoring, profiling, limiting process resources, and managing running processes. It cites "390+ million downloads per month", 780,000+ GitHub repositories and 18 years in active development.

## Caveats
- psutil.io documents the development version: The main site shows the development docs. For the current release, it points to psutil.readthedocs.io/stable.
- Overview output is from Linux; load average is emulated on Windows: The API overview is shown "on Linux". A comment on `psutil.getloadavg()` notes that on Windows the value is emulated.
- Junos devices list a reduced set of functions: Juniper's table lists which psutil functions are supported on Junos OS with upgraded FreeBSD and on Junos OS Evolved. The Sensors row shows a dash in both columns.
- Per-process reads in a loop are wrapped for NoSuchProcess: Juniper's sample script calls `proc.as_dict()` inside a `try` block while it walks `process_iter()`, and it catches `psutil.NoSuchProcess`.

## Numbers (AgentGid data)
- Gid Score: 78.7 (#123 of all tools, 1 of 121 in its category)
- Used in 117 public projects set up for AI coding agents (1.9%)
- Downloads last week: 94,552,829 (as of 2026-11-24), +22.0% over 4 weeks
- GitHub stars: 11,333 (as of 2026-11-24)
- Last push: 2026-11-20

## Often used with
Pydantic 63.2%, Uvicorn 62.4%, FastAPI 59.8%, PyYAML 53.8%, NumPy 53.0%, python-dotenv 52.1%

## Links
- AgentGid page: https://agentgid.com/tools/psutil/
- Homepage: https://github.com/giampaolo/psutil
- Repository: https://github.com/giampaolo/psutil
- Source: https://github.com/giampaolo/psutil#readme
- Source: https://github.com/giampaolo/psutil
- Source: https://pypi.org/project/psutil/
- Source: https://psutil.io
- Source: https://psutil.io/api-overview/

---
AgentGid's catalog is curated: every entry was checked against the maker's official pages (registry, repository, license and pricing pages) on the date shown; a license value shows the quote it stands on wherever AgentGid has one. Usage numbers come from AgentGid's own scan of public repositories set up for AI coding agents. Claims by makers are reported, not tested by AgentGid.
