Swarmauri Tool · psutil
A Swarmauri-compatible system inspection tool powered by psutil. Use it to surface CPU, memory, disk, network, and sensor telemetry inside agents, observability workflows, or health checks.
- Wraps rich
psutilAPIs behind a single callable interface. - Returns structured dictionaries that mirror psutil's native data models (converted to plain Python objects for JSON serialization).
- Handles common permission gaps gracefully (e.g., network connections, sensors) so calls do not crash automation.
Requirements
- Python 3.10 – 3.13.
psutilinstalled (pulled automatically with the package).- Optional platform support: some sensor endpoints require root/admin privileges or may not exist on virtualized hosts.
Installation
Select the installer that matches your environment; each command resolves transitive dependencies.
pip
pip install swarmauri_tool_psutil
Poetry
poetry add swarmauri_tool_psutil
uv
# Add to the current project and update uv.lock
uv add swarmauri_tool_psutil
# or install directly into the active environment without editing pyproject.toml
uv pip install swarmauri_tool_psutil
Tip: psutil needs native build tooling on some platforms (musl-based containers, Alpine). Install the OS-level prerequisites before running the package install command.
Quick Start
from pprint import pprint
from swarmauri_tool_psutil import PsutilTool
psutil_tool = PsutilTool()
cpu = psutil_tool("cpu")
mem = psutil_tool("memory")
print("CPU summary:")
pprint(cpu)
print("Memory summary:")
pprint(mem)
Each call returns a dictionary keyed by metrics families (e.g., cpu_times, virtual_memory). Use only the sections you need in downstream automations.
Usage Scenarios
Build a Lightweight Health Endpoint
from fastapi import FastAPI
from swarmauri_tool_psutil import PsutilTool
app = FastAPI()
ps_tool = PsutilTool()
@app.get("/health/system")
def system_health():
return {
"cpu": ps_tool("cpu"),
"memory": ps_tool("memory"),
"disk": ps_tool("disk"),
}
Expose system metrics to dashboards or probes without wiring psutil manually.
Enrich Swarmauri Agent Responses With Telemetry
from swarmauri_core.agent.Agent import Agent
from swarmauri_core.messages.HumanMessage import HumanMessage
from swarmauri_standard.tools.registry import ToolRegistry
from swarmauri_tool_psutil import PsutilTool
registry = ToolRegistry()
registry.register(PsutilTool())
agent = Agent(tool_registry=registry)
message = HumanMessage(content="report system cpu load and memory usage")
response = agent.run(message)
print(response)
Register the tool alongside other Swarmauri capabilities so agents can answer operational questions on demand.
Archive High-Usage Events for Later Analysis
import json
import time
from pathlib import Path
from swarmauri_tool_psutil import PsutilTool
ps_tool = PsutilTool()
log_dir = Path("telemetry_logs")
log_dir.mkdir(exist_ok=True)
while True:
snapshot = {
"ts": time.time(),
"cpu": ps_tool("cpu"),
"memory": ps_tool("memory"),
"network": ps_tool("network"),
}
(log_dir / f"snapshot-{int(snapshot['ts'])}.json").write_text(
json.dumps(snapshot, indent=2)
)
time.sleep(60)
Capture periodic snapshots that can be loaded into notebooks, dashboards, or anomaly detection jobs.
Troubleshooting
ValueError: Invalid info_type– Only"cpu","memory","disk","network", and"sensors"are supported. Validate user input before calling the tool.Permission deniedretrieving connections/sensors – Run with elevated privileges or filter out those sections. The tool returns a descriptive string when it cannot access the data.psutil.AccessDeniedon containerized hosts – Grant the container additional capabilities (e.g.,SYS_PTRACE) or restrict to metrics that do not require elevated rights.
License
swarmauri_tool_psutil is released under the Apache 2.0 License. See LICENSE for details.
Metadata
Release files for swarmauri_tool_psutil 0.10.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| swarmauri_tool_psutil-0.10.0.tar.gz | 9.1 kB | Without provenance | Details for swarmauri_tool_psutil-0.10.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| swarmauri_tool_psutil-0.10.0-py3-none-any.whl | Python 3 | none | any | Details for swarmauri_tool_psutil-0.10.0-py3-none-any.whl |
Total release size: 19.3 kB
Release files / swarmauri_tool_psutil-0.10.0.tar.gz
| Download URL | swarmauri_tool_psutil-0.10.0.tar.gz |
|---|---|
| Size | 9.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6de22694c4dfff96b41d3ac0f0b54da0a344ed8eec3c4894fd3ed6850bd51e13
|
|
BLAKE2b-256 checksum How to use checksums |
692362b6796369149dcab999a17401fc11628c21b704dca58c0da96a4e20db35
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.0 {"installer":{"name":"uv","version":"0.11.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / swarmauri_tool_psutil-0.10.0-py3-none-any.whl
| Download URL | swarmauri_tool_psutil-0.10.0-py3-none-any.whl |
|---|---|
| Size | 10.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
adc50d9e35931ceb89d8efd7ff5c16f4aadc1a85ba942e1e6e70e58de8f45ce3
|
|
BLAKE2b-256 checksum How to use checksums |
5fa8d02f922951193289e8a3f1ddefccb026ceb03d6a44f088b87fc7f9c6ca1b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.0 {"installer":{"name":"uv","version":"0.11.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for swarmauri_tool_psutil 0.10.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.