swarmauri_tool_psutil 0.9.0.dev3__tar.gz → 0.9.0.dev22__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,181 @@
1
+ Metadata-Version: 2.4
2
+ Name: swarmauri_tool_psutil
3
+ Version: 0.9.0.dev22
4
+ Summary: Swarmauri Psutil Tool.
5
+ License-Expression: Apache-2.0
6
+ License-File: LICENSE
7
+ Keywords: swarmauri,tool,psutil
8
+ Author: Jacob Stewart
9
+ Author-email: jacob@swarmauri.com
10
+ Requires-Python: >=3.10,<3.13
11
+ Classifier: License :: OSI Approved :: Apache Software License
12
+ Classifier: Programming Language :: Python :: 3.10
13
+ Classifier: Programming Language :: Python :: 3.11
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Natural Language :: English
16
+ Classifier: Development Status :: 3 - Alpha
17
+ Classifier: Intended Audience :: Developers
18
+ Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
19
+ Requires-Dist: psutil (>=6.1.0)
20
+ Requires-Dist: swarmauri_base
21
+ Requires-Dist: swarmauri_core
22
+ Requires-Dist: swarmauri_standard
23
+ Description-Content-Type: text/markdown
24
+
25
+ ![Swarmauri Logo](https://github.com/swarmauri/swarmauri-sdk/blob/3d4d1cfa949399d7019ae9d8f296afba773dfb7f/assets/swarmauri.brand.theme.svg)
26
+
27
+ <p align="center">
28
+ <a href="https://pypi.org/project/swarmauri_tool_psutil/">
29
+ <img src="https://img.shields.io/pypi/dm/swarmauri_tool_psutil" alt="PyPI - Downloads"/></a>
30
+ <a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/community/swarmauri_tool_psutil/">
31
+ <img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/community/swarmauri_tool_psutil.svg"/></a>
32
+ <a href="https://pypi.org/project/swarmauri_tool_psutil/">
33
+ <img src="https://img.shields.io/pypi/pyversions/swarmauri_tool_psutil" alt="PyPI - Python Version"/></a>
34
+ <a href="https://pypi.org/project/swarmauri_tool_psutil/">
35
+ <img src="https://img.shields.io/pypi/l/swarmauri_tool_psutil" alt="PyPI - License"/></a>
36
+ <a href="https://pypi.org/project/swarmauri_tool_psutil/">
37
+ <img src="https://img.shields.io/pypi/v/swarmauri_tool_psutil?label=swarmauri_tool_psutil&color=green" alt="PyPI - swarmauri_tool_psutil"/></a>
38
+ </p>
39
+
40
+ ---
41
+
42
+ # Swarmauri Tool · psutil
43
+
44
+ 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.
45
+
46
+ - Wraps rich `psutil` APIs behind a single callable interface.
47
+ - Returns structured dictionaries that mirror psutil's native data models (converted to plain Python objects for JSON serialization).
48
+ - Handles common permission gaps gracefully (e.g., network connections, sensors) so calls do not crash automation.
49
+
50
+ ## Requirements
51
+
52
+ - Python 3.10 – 3.13.
53
+ - `psutil` installed (pulled automatically with the package).
54
+ - Optional platform support: some sensor endpoints require root/admin privileges or may not exist on virtualized hosts.
55
+
56
+ ## Installation
57
+
58
+ Select the installer that matches your environment; each command resolves transitive dependencies.
59
+
60
+ **pip**
61
+
62
+ ```bash
63
+ pip install swarmauri_tool_psutil
64
+ ```
65
+
66
+ **Poetry**
67
+
68
+ ```bash
69
+ poetry add swarmauri_tool_psutil
70
+ ```
71
+
72
+ **uv**
73
+
74
+ ```bash
75
+ # Add to the current project and update uv.lock
76
+ uv add swarmauri_tool_psutil
77
+
78
+ # or install directly into the active environment without editing pyproject.toml
79
+ uv pip install swarmauri_tool_psutil
80
+ ```
81
+
82
+ > Tip: psutil needs native build tooling on some platforms (musl-based containers, Alpine). Install the OS-level prerequisites before running the package install command.
83
+
84
+ ## Quick Start
85
+
86
+ ```python
87
+ from pprint import pprint
88
+ from swarmauri_tool_psutil import PsutilTool
89
+
90
+ psutil_tool = PsutilTool()
91
+
92
+ cpu = psutil_tool("cpu")
93
+ mem = psutil_tool("memory")
94
+
95
+ print("CPU summary:")
96
+ pprint(cpu)
97
+
98
+ print("Memory summary:")
99
+ pprint(mem)
100
+ ```
101
+
102
+ Each call returns a dictionary keyed by metrics families (e.g., `cpu_times`, `virtual_memory`). Use only the sections you need in downstream automations.
103
+
104
+ ## Usage Scenarios
105
+
106
+ ### Build a Lightweight Health Endpoint
107
+
108
+ ```python
109
+ from fastapi import FastAPI
110
+ from swarmauri_tool_psutil import PsutilTool
111
+
112
+ app = FastAPI()
113
+ ps_tool = PsutilTool()
114
+
115
+ @app.get("/health/system")
116
+ def system_health():
117
+ return {
118
+ "cpu": ps_tool("cpu"),
119
+ "memory": ps_tool("memory"),
120
+ "disk": ps_tool("disk"),
121
+ }
122
+ ```
123
+
124
+ Expose system metrics to dashboards or probes without wiring psutil manually.
125
+
126
+ ### Enrich Swarmauri Agent Responses With Telemetry
127
+
128
+ ```python
129
+ from swarmauri_core.agent.Agent import Agent
130
+ from swarmauri_core.messages.HumanMessage import HumanMessage
131
+ from swarmauri_standard.tools.registry import ToolRegistry
132
+ from swarmauri_tool_psutil import PsutilTool
133
+
134
+ registry = ToolRegistry()
135
+ registry.register(PsutilTool())
136
+ agent = Agent(tool_registry=registry)
137
+
138
+ message = HumanMessage(content="report system cpu load and memory usage")
139
+ response = agent.run(message)
140
+ print(response)
141
+ ```
142
+
143
+ Register the tool alongside other Swarmauri capabilities so agents can answer operational questions on demand.
144
+
145
+ ### Archive High-Usage Events for Later Analysis
146
+
147
+ ```python
148
+ import json
149
+ import time
150
+ from pathlib import Path
151
+ from swarmauri_tool_psutil import PsutilTool
152
+
153
+ ps_tool = PsutilTool()
154
+ log_dir = Path("telemetry_logs")
155
+ log_dir.mkdir(exist_ok=True)
156
+
157
+ while True:
158
+ snapshot = {
159
+ "ts": time.time(),
160
+ "cpu": ps_tool("cpu"),
161
+ "memory": ps_tool("memory"),
162
+ "network": ps_tool("network"),
163
+ }
164
+ (log_dir / f"snapshot-{int(snapshot['ts'])}.json").write_text(
165
+ json.dumps(snapshot, indent=2)
166
+ )
167
+ time.sleep(60)
168
+ ```
169
+
170
+ Capture periodic snapshots that can be loaded into notebooks, dashboards, or anomaly detection jobs.
171
+
172
+ ## Troubleshooting
173
+
174
+ - **`ValueError: Invalid info_type`** – Only `"cpu"`, `"memory"`, `"disk"`, `"network"`, and `"sensors"` are supported. Validate user input before calling the tool.
175
+ - **`Permission denied` retrieving connections/sensors** – Run with elevated privileges or filter out those sections. The tool returns a descriptive string when it cannot access the data.
176
+ - **`psutil.AccessDenied` on containerized hosts** – Grant the container additional capabilities (e.g., `SYS_PTRACE`) or restrict to metrics that do not require elevated rights.
177
+
178
+ ## License
179
+
180
+ `swarmauri_tool_psutil` is released under the Apache 2.0 License. See `LICENSE` for details.
181
+
@@ -0,0 +1,156 @@
1
+ ![Swarmauri Logo](https://github.com/swarmauri/swarmauri-sdk/blob/3d4d1cfa949399d7019ae9d8f296afba773dfb7f/assets/swarmauri.brand.theme.svg)
2
+
3
+ <p align="center">
4
+ <a href="https://pypi.org/project/swarmauri_tool_psutil/">
5
+ <img src="https://img.shields.io/pypi/dm/swarmauri_tool_psutil" alt="PyPI - Downloads"/></a>
6
+ <a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/community/swarmauri_tool_psutil/">
7
+ <img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/community/swarmauri_tool_psutil.svg"/></a>
8
+ <a href="https://pypi.org/project/swarmauri_tool_psutil/">
9
+ <img src="https://img.shields.io/pypi/pyversions/swarmauri_tool_psutil" alt="PyPI - Python Version"/></a>
10
+ <a href="https://pypi.org/project/swarmauri_tool_psutil/">
11
+ <img src="https://img.shields.io/pypi/l/swarmauri_tool_psutil" alt="PyPI - License"/></a>
12
+ <a href="https://pypi.org/project/swarmauri_tool_psutil/">
13
+ <img src="https://img.shields.io/pypi/v/swarmauri_tool_psutil?label=swarmauri_tool_psutil&color=green" alt="PyPI - swarmauri_tool_psutil"/></a>
14
+ </p>
15
+
16
+ ---
17
+
18
+ # Swarmauri Tool · psutil
19
+
20
+ 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.
21
+
22
+ - Wraps rich `psutil` APIs behind a single callable interface.
23
+ - Returns structured dictionaries that mirror psutil's native data models (converted to plain Python objects for JSON serialization).
24
+ - Handles common permission gaps gracefully (e.g., network connections, sensors) so calls do not crash automation.
25
+
26
+ ## Requirements
27
+
28
+ - Python 3.10 – 3.13.
29
+ - `psutil` installed (pulled automatically with the package).
30
+ - Optional platform support: some sensor endpoints require root/admin privileges or may not exist on virtualized hosts.
31
+
32
+ ## Installation
33
+
34
+ Select the installer that matches your environment; each command resolves transitive dependencies.
35
+
36
+ **pip**
37
+
38
+ ```bash
39
+ pip install swarmauri_tool_psutil
40
+ ```
41
+
42
+ **Poetry**
43
+
44
+ ```bash
45
+ poetry add swarmauri_tool_psutil
46
+ ```
47
+
48
+ **uv**
49
+
50
+ ```bash
51
+ # Add to the current project and update uv.lock
52
+ uv add swarmauri_tool_psutil
53
+
54
+ # or install directly into the active environment without editing pyproject.toml
55
+ uv pip install swarmauri_tool_psutil
56
+ ```
57
+
58
+ > Tip: psutil needs native build tooling on some platforms (musl-based containers, Alpine). Install the OS-level prerequisites before running the package install command.
59
+
60
+ ## Quick Start
61
+
62
+ ```python
63
+ from pprint import pprint
64
+ from swarmauri_tool_psutil import PsutilTool
65
+
66
+ psutil_tool = PsutilTool()
67
+
68
+ cpu = psutil_tool("cpu")
69
+ mem = psutil_tool("memory")
70
+
71
+ print("CPU summary:")
72
+ pprint(cpu)
73
+
74
+ print("Memory summary:")
75
+ pprint(mem)
76
+ ```
77
+
78
+ Each call returns a dictionary keyed by metrics families (e.g., `cpu_times`, `virtual_memory`). Use only the sections you need in downstream automations.
79
+
80
+ ## Usage Scenarios
81
+
82
+ ### Build a Lightweight Health Endpoint
83
+
84
+ ```python
85
+ from fastapi import FastAPI
86
+ from swarmauri_tool_psutil import PsutilTool
87
+
88
+ app = FastAPI()
89
+ ps_tool = PsutilTool()
90
+
91
+ @app.get("/health/system")
92
+ def system_health():
93
+ return {
94
+ "cpu": ps_tool("cpu"),
95
+ "memory": ps_tool("memory"),
96
+ "disk": ps_tool("disk"),
97
+ }
98
+ ```
99
+
100
+ Expose system metrics to dashboards or probes without wiring psutil manually.
101
+
102
+ ### Enrich Swarmauri Agent Responses With Telemetry
103
+
104
+ ```python
105
+ from swarmauri_core.agent.Agent import Agent
106
+ from swarmauri_core.messages.HumanMessage import HumanMessage
107
+ from swarmauri_standard.tools.registry import ToolRegistry
108
+ from swarmauri_tool_psutil import PsutilTool
109
+
110
+ registry = ToolRegistry()
111
+ registry.register(PsutilTool())
112
+ agent = Agent(tool_registry=registry)
113
+
114
+ message = HumanMessage(content="report system cpu load and memory usage")
115
+ response = agent.run(message)
116
+ print(response)
117
+ ```
118
+
119
+ Register the tool alongside other Swarmauri capabilities so agents can answer operational questions on demand.
120
+
121
+ ### Archive High-Usage Events for Later Analysis
122
+
123
+ ```python
124
+ import json
125
+ import time
126
+ from pathlib import Path
127
+ from swarmauri_tool_psutil import PsutilTool
128
+
129
+ ps_tool = PsutilTool()
130
+ log_dir = Path("telemetry_logs")
131
+ log_dir.mkdir(exist_ok=True)
132
+
133
+ while True:
134
+ snapshot = {
135
+ "ts": time.time(),
136
+ "cpu": ps_tool("cpu"),
137
+ "memory": ps_tool("memory"),
138
+ "network": ps_tool("network"),
139
+ }
140
+ (log_dir / f"snapshot-{int(snapshot['ts'])}.json").write_text(
141
+ json.dumps(snapshot, indent=2)
142
+ )
143
+ time.sleep(60)
144
+ ```
145
+
146
+ Capture periodic snapshots that can be loaded into notebooks, dashboards, or anomaly detection jobs.
147
+
148
+ ## Troubleshooting
149
+
150
+ - **`ValueError: Invalid info_type`** – Only `"cpu"`, `"memory"`, `"disk"`, `"network"`, and `"sensors"` are supported. Validate user input before calling the tool.
151
+ - **`Permission denied` retrieving connections/sensors** – Run with elevated privileges or filter out those sections. The tool returns a descriptive string when it cannot access the data.
152
+ - **`psutil.AccessDenied` on containerized hosts** – Grant the container additional capabilities (e.g., `SYS_PTRACE`) or restrict to metrics that do not require elevated rights.
153
+
154
+ ## License
155
+
156
+ `swarmauri_tool_psutil` is released under the Apache 2.0 License. See `LICENSE` for details.
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "swarmauri_tool_psutil"
3
- version = "0.9.0.dev3"
3
+ version = "0.9.0.dev22"
4
4
  description = "Swarmauri Psutil Tool."
5
5
  license = "Apache-2.0"
6
6
  readme = "README.md"
@@ -11,6 +11,10 @@ classifiers = [
11
11
  "Programming Language :: Python :: 3.10",
12
12
  "Programming Language :: Python :: 3.11",
13
13
  "Programming Language :: Python :: 3.12",
14
+ "Natural Language :: English",
15
+ "Development Status :: 3 - Alpha",
16
+ "Intended Audience :: Developers",
17
+ "Topic :: Software Development :: Libraries :: Application Frameworks",
14
18
  ]
15
19
  authors = [{ name = "Jacob Stewart", email = "jacob@swarmauri.com" }]
16
20
  dependencies = [
@@ -19,6 +23,11 @@ dependencies = [
19
23
  "swarmauri_base",
20
24
  "swarmauri_standard",
21
25
  ]
26
+ keywords = [
27
+ "swarmauri",
28
+ "tool",
29
+ "psutil",
30
+ ]
22
31
 
23
32
  [tool.uv.sources]
24
33
  swarmauri_core = { workspace = true }
@@ -1,74 +0,0 @@
1
- Metadata-Version: 2.3
2
- Name: swarmauri_tool_psutil
3
- Version: 0.9.0.dev3
4
- Summary: Swarmauri Psutil Tool.
5
- License: Apache-2.0
6
- Author: Jacob Stewart
7
- Author-email: jacob@swarmauri.com
8
- Requires-Python: >=3.10,<3.13
9
- Classifier: License :: OSI Approved :: Apache Software License
10
- Classifier: Programming Language :: Python :: 3.10
11
- Classifier: Programming Language :: Python :: 3.11
12
- Classifier: Programming Language :: Python :: 3.12
13
- Requires-Dist: psutil (>=6.1.0)
14
- Requires-Dist: swarmauri_base
15
- Requires-Dist: swarmauri_core
16
- Requires-Dist: swarmauri_standard
17
- Description-Content-Type: text/markdown
18
-
19
-
20
- ![Swamauri Logo](https://res.cloudinary.com/dbjmpekvl/image/upload/v1730099724/Swarmauri-logo-lockup-2048x757_hww01w.png)
21
-
22
- <p align="center">
23
- <a href="https://pypi.org/project/swarmauri_tool_psutil/">
24
- <img src="https://img.shields.io/pypi/dm/swarmauri_tool_psutil" alt="PyPI - Downloads"/></a>
25
- <a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/community/swarmauri_tool_psutil/">
26
- <img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/community/swarmauri_tool_psutil.svg"/></a>
27
- <a href="https://pypi.org/project/swarmauri_tool_psutil/">
28
- <img src="https://img.shields.io/pypi/pyversions/swarmauri_tool_psutil" alt="PyPI - Python Version"/></a>
29
- <a href="https://pypi.org/project/swarmauri_tool_psutil/">
30
- <img src="https://img.shields.io/pypi/l/swarmauri_tool_psutil" alt="PyPI - License"/></a>
31
- <a href="https://pypi.org/project/swarmauri_tool_psutil/">
32
- <img src="https://img.shields.io/pypi/v/swarmauri_tool_psutil?label=swarmauri_tool_psutil&color=green" alt="PyPI - swarmauri_tool_psutil"/></a>
33
- </p>
34
-
35
- ---
36
-
37
- # Swarmauri Tool Psutil
38
-
39
- A system monitoring tool that provides comprehensive system information using psutil library. This tool can gather information about CPU, memory, disk, network, and sensors.
40
-
41
- ## Installation
42
-
43
- ```bash
44
- pip install swarmauri_tool_psutil
45
- ```
46
-
47
- ## Usage
48
-
49
- Here's a basic example of how to use the PsutilTool:
50
-
51
- ```python
52
- from swarmauri.tools.PsutilTool import PsutilTool
53
-
54
- # Initialize the tool
55
- psutil_tool = PsutilTool()
56
-
57
- # Get CPU information
58
- cpu_info = psutil_tool("cpu")
59
- print(cpu_info) # Shows CPU times, usage percent, frequency, etc.
60
-
61
- # Get memory information
62
- memory_info = psutil_tool("memory")
63
- print(memory_info) # Shows virtual and swap memory details
64
-
65
- # Get disk information
66
- disk_info = psutil_tool("disk")
67
- print(disk_info) # Shows disk partitions, usage, and I/O counters
68
- ```
69
-
70
- ## Want to help?
71
-
72
- If you want to contribute to swarmauri-sdk, read up on our [guidelines for contributing](https://github.com/swarmauri/swarmauri-sdk/blob/master/contributing.md) that will help you get started.
73
-
74
-
@@ -1,55 +0,0 @@
1
-
2
- ![Swamauri Logo](https://res.cloudinary.com/dbjmpekvl/image/upload/v1730099724/Swarmauri-logo-lockup-2048x757_hww01w.png)
3
-
4
- <p align="center">
5
- <a href="https://pypi.org/project/swarmauri_tool_psutil/">
6
- <img src="https://img.shields.io/pypi/dm/swarmauri_tool_psutil" alt="PyPI - Downloads"/></a>
7
- <a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/community/swarmauri_tool_psutil/">
8
- <img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/community/swarmauri_tool_psutil.svg"/></a>
9
- <a href="https://pypi.org/project/swarmauri_tool_psutil/">
10
- <img src="https://img.shields.io/pypi/pyversions/swarmauri_tool_psutil" alt="PyPI - Python Version"/></a>
11
- <a href="https://pypi.org/project/swarmauri_tool_psutil/">
12
- <img src="https://img.shields.io/pypi/l/swarmauri_tool_psutil" alt="PyPI - License"/></a>
13
- <a href="https://pypi.org/project/swarmauri_tool_psutil/">
14
- <img src="https://img.shields.io/pypi/v/swarmauri_tool_psutil?label=swarmauri_tool_psutil&color=green" alt="PyPI - swarmauri_tool_psutil"/></a>
15
- </p>
16
-
17
- ---
18
-
19
- # Swarmauri Tool Psutil
20
-
21
- A system monitoring tool that provides comprehensive system information using psutil library. This tool can gather information about CPU, memory, disk, network, and sensors.
22
-
23
- ## Installation
24
-
25
- ```bash
26
- pip install swarmauri_tool_psutil
27
- ```
28
-
29
- ## Usage
30
-
31
- Here's a basic example of how to use the PsutilTool:
32
-
33
- ```python
34
- from swarmauri.tools.PsutilTool import PsutilTool
35
-
36
- # Initialize the tool
37
- psutil_tool = PsutilTool()
38
-
39
- # Get CPU information
40
- cpu_info = psutil_tool("cpu")
41
- print(cpu_info) # Shows CPU times, usage percent, frequency, etc.
42
-
43
- # Get memory information
44
- memory_info = psutil_tool("memory")
45
- print(memory_info) # Shows virtual and swap memory details
46
-
47
- # Get disk information
48
- disk_info = psutil_tool("disk")
49
- print(disk_info) # Shows disk partitions, usage, and I/O counters
50
- ```
51
-
52
- ## Want to help?
53
-
54
- If you want to contribute to swarmauri-sdk, read up on our [guidelines for contributing](https://github.com/swarmauri/swarmauri-sdk/blob/master/contributing.md) that will help you get started.
55
-