RRSSM-agent-os 0.1.0__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.
- rrssm_agent_os-0.1.0/PKG-INFO +258 -0
- rrssm_agent_os-0.1.0/README.md +217 -0
- rrssm_agent_os-0.1.0/pyproject.toml +90 -0
- rrssm_agent_os-0.1.0/setup.cfg +4 -0
- rrssm_agent_os-0.1.0/src/RRSSM_agent_os.egg-info/PKG-INFO +258 -0
- rrssm_agent_os-0.1.0/src/RRSSM_agent_os.egg-info/SOURCES.txt +96 -0
- rrssm_agent_os-0.1.0/src/RRSSM_agent_os.egg-info/dependency_links.txt +1 -0
- rrssm_agent_os-0.1.0/src/RRSSM_agent_os.egg-info/entry_points.txt +2 -0
- rrssm_agent_os-0.1.0/src/RRSSM_agent_os.egg-info/requires.txt +20 -0
- rrssm_agent_os-0.1.0/src/RRSSM_agent_os.egg-info/top_level.txt +1 -0
- rrssm_agent_os-0.1.0/src/agent_os/__init__.py +62 -0
- rrssm_agent_os-0.1.0/src/agent_os/api/__init__.py +5 -0
- rrssm_agent_os-0.1.0/src/agent_os/api/app.py +83 -0
- rrssm_agent_os-0.1.0/src/agent_os/api/routes.py +449 -0
- rrssm_agent_os-0.1.0/src/agent_os/cli.py +47 -0
- rrssm_agent_os-0.1.0/src/agent_os/config/__init__.py +0 -0
- rrssm_agent_os-0.1.0/src/agent_os/config/settings.py +203 -0
- rrssm_agent_os-0.1.0/src/agent_os/ipc/__init__.py +13 -0
- rrssm_agent_os-0.1.0/src/agent_os/ipc/channel.py +30 -0
- rrssm_agent_os-0.1.0/src/agent_os/ipc/deduplication.py +21 -0
- rrssm_agent_os-0.1.0/src/agent_os/ipc/ipc_manager.py +165 -0
- rrssm_agent_os-0.1.0/src/agent_os/ipc/message.py +16 -0
- rrssm_agent_os-0.1.0/src/agent_os/ipc/queue.py +82 -0
- rrssm_agent_os-0.1.0/src/agent_os/kernel/__init__.py +0 -0
- rrssm_agent_os-0.1.0/src/agent_os/kernel/agent_process.py +86 -0
- rrssm_agent_os-0.1.0/src/agent_os/kernel/process_manager.py +337 -0
- rrssm_agent_os-0.1.0/src/agent_os/kernel/process_table.py +114 -0
- rrssm_agent_os-0.1.0/src/agent_os/kernel/state_machine.py +191 -0
- rrssm_agent_os-0.1.0/src/agent_os/llm/__init__.py +11 -0
- rrssm_agent_os-0.1.0/src/agent_os/llm/base.py +21 -0
- rrssm_agent_os-0.1.0/src/agent_os/llm/manager.py +22 -0
- rrssm_agent_os-0.1.0/src/agent_os/llm/mock.py +55 -0
- rrssm_agent_os-0.1.0/src/agent_os/memory/__init__.py +4 -0
- rrssm_agent_os-0.1.0/src/agent_os/memory/checkpoint.py +55 -0
- rrssm_agent_os-0.1.0/src/agent_os/memory/context_manager.py +172 -0
- rrssm_agent_os-0.1.0/src/agent_os/memory/context_page.py +18 -0
- rrssm_agent_os-0.1.0/src/agent_os/memory/lru.py +22 -0
- rrssm_agent_os-0.1.0/src/agent_os/memory/swap_manager.py +40 -0
- rrssm_agent_os-0.1.0/src/agent_os/metrics/__init__.py +4 -0
- rrssm_agent_os-0.1.0/src/agent_os/metrics/collector.py +144 -0
- rrssm_agent_os-0.1.0/src/agent_os/metrics/events.py +194 -0
- rrssm_agent_os-0.1.0/src/agent_os/persistence/__init__.py +21 -0
- rrssm_agent_os-0.1.0/src/agent_os/persistence/database.py +32 -0
- rrssm_agent_os-0.1.0/src/agent_os/persistence/models.py +103 -0
- rrssm_agent_os-0.1.0/src/agent_os/persistence/repository.py +87 -0
- rrssm_agent_os-0.1.0/src/agent_os/resources/__init__.py +0 -0
- rrssm_agent_os-0.1.0/src/agent_os/resources/manager.py +110 -0
- rrssm_agent_os-0.1.0/src/agent_os/resources/quota.py +37 -0
- rrssm_agent_os-0.1.0/src/agent_os/resources/usage.py +37 -0
- rrssm_agent_os-0.1.0/src/agent_os/runtime/__init__.py +13 -0
- rrssm_agent_os-0.1.0/src/agent_os/runtime/cancellation.py +23 -0
- rrssm_agent_os-0.1.0/src/agent_os/runtime/event_loop.py +73 -0
- rrssm_agent_os-0.1.0/src/agent_os/runtime/executor.py +89 -0
- rrssm_agent_os-0.1.0/src/agent_os/runtime/timeout.py +16 -0
- rrssm_agent_os-0.1.0/src/agent_os/sandbox/__init__.py +0 -0
- rrssm_agent_os-0.1.0/src/agent_os/sandbox/sandbox.py +91 -0
- rrssm_agent_os-0.1.0/src/agent_os/scheduler/__init__.py +13 -0
- rrssm_agent_os-0.1.0/src/agent_os/scheduler/aging.py +38 -0
- rrssm_agent_os-0.1.0/src/agent_os/scheduler/base.py +12 -0
- rrssm_agent_os-0.1.0/src/agent_os/scheduler/priority.py +76 -0
- rrssm_agent_os-0.1.0/src/agent_os/scheduler/scheduler.py +32 -0
- rrssm_agent_os-0.1.0/src/agent_os/scheduler/weighted_fair.py +81 -0
- rrssm_agent_os-0.1.0/src/agent_os/sdk/__init__.py +64 -0
- rrssm_agent_os-0.1.0/src/agent_os/sdk/agent.py +45 -0
- rrssm_agent_os-0.1.0/src/agent_os/sdk/kernel.py +951 -0
- rrssm_agent_os-0.1.0/src/agent_os/sdk/registry.py +116 -0
- rrssm_agent_os-0.1.0/src/agent_os/sdk/wrapper.py +131 -0
- rrssm_agent_os-0.1.0/src/agent_os/security/__init__.py +0 -0
- rrssm_agent_os-0.1.0/src/agent_os/security/capability.py +32 -0
- rrssm_agent_os-0.1.0/src/agent_os/security/policy.py +19 -0
- rrssm_agent_os-0.1.0/src/agent_os/supervisor/__init__.py +12 -0
- rrssm_agent_os-0.1.0/src/agent_os/supervisor/failure.py +28 -0
- rrssm_agent_os-0.1.0/src/agent_os/supervisor/restart.py +48 -0
- rrssm_agent_os-0.1.0/src/agent_os/supervisor/supervisor.py +135 -0
- rrssm_agent_os-0.1.0/src/agent_os/synchronization/__init__.py +14 -0
- rrssm_agent_os-0.1.0/src/agent_os/synchronization/deadlock.py +73 -0
- rrssm_agent_os-0.1.0/src/agent_os/synchronization/lock.py +62 -0
- rrssm_agent_os-0.1.0/src/agent_os/synchronization/semaphore.py +52 -0
- rrssm_agent_os-0.1.0/src/agent_os/synchronization/sync_manager.py +67 -0
- rrssm_agent_os-0.1.0/tests/test_bugfixes.py +139 -0
- rrssm_agent_os-0.1.0/tests/test_checkpoint.py +76 -0
- rrssm_agent_os-0.1.0/tests/test_context_manager.py +129 -0
- rrssm_agent_os-0.1.0/tests/test_deadlock.py +100 -0
- rrssm_agent_os-0.1.0/tests/test_events.py +109 -0
- rrssm_agent_os-0.1.0/tests/test_ipc.py +89 -0
- rrssm_agent_os-0.1.0/tests/test_llm.py +74 -0
- rrssm_agent_os-0.1.0/tests/test_process_manager.py +150 -0
- rrssm_agent_os-0.1.0/tests/test_process_table.py +124 -0
- rrssm_agent_os-0.1.0/tests/test_resources.py +103 -0
- rrssm_agent_os-0.1.0/tests/test_scheduler.py +127 -0
- rrssm_agent_os-0.1.0/tests/test_sdk_kernel.py +406 -0
- rrssm_agent_os-0.1.0/tests/test_sdk_registry.py +197 -0
- rrssm_agent_os-0.1.0/tests/test_sdk_wrapper.py +198 -0
- rrssm_agent_os-0.1.0/tests/test_settings.py +81 -0
- rrssm_agent_os-0.1.0/tests/test_showcase_full.py +42 -0
- rrssm_agent_os-0.1.0/tests/test_state_machine.py +120 -0
- rrssm_agent_os-0.1.0/tests/test_supervisor.py +130 -0
- rrssm_agent_os-0.1.0/tests/test_testbed.py +46 -0
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: RRSSM-agent-os
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: An operating-system kernel for LLM agents — scheduling, IPC, memory, supervisor, and deadlock detection.
|
|
5
|
+
Author: Agent-OS Contributors
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/your-org/agent-os
|
|
8
|
+
Project-URL: Documentation, https://github.com/your-org/agent-os#readme
|
|
9
|
+
Project-URL: Repository, https://github.com/your-org/agent-os
|
|
10
|
+
Project-URL: Bug Tracker, https://github.com/your-org/agent-os/issues
|
|
11
|
+
Keywords: agents,llm,multi-agent,operating-system,scheduler,ipc,process-manager,ai,autonomous-agents
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Intended Audience :: Science/Research
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
19
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
20
|
+
Classifier: Framework :: AsyncIO
|
|
21
|
+
Classifier: Operating System :: OS Independent
|
|
22
|
+
Requires-Python: >=3.12
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
Requires-Dist: pyyaml>=6.0
|
|
25
|
+
Requires-Dist: fastapi>=0.110.0
|
|
26
|
+
Requires-Dist: uvicorn[standard]>=0.29.0
|
|
27
|
+
Requires-Dist: pydantic>=2.0
|
|
28
|
+
Provides-Extra: persistence
|
|
29
|
+
Requires-Dist: sqlalchemy>=2.0; extra == "persistence"
|
|
30
|
+
Requires-Dist: aiosqlite>=0.20; extra == "persistence"
|
|
31
|
+
Provides-Extra: dev
|
|
32
|
+
Requires-Dist: pytest>=9.0; extra == "dev"
|
|
33
|
+
Requires-Dist: pytest-asyncio>=0.23; extra == "dev"
|
|
34
|
+
Requires-Dist: pytest-cov>=5.0; extra == "dev"
|
|
35
|
+
Requires-Dist: httpx>=0.27; extra == "dev"
|
|
36
|
+
Requires-Dist: build>=1.0; extra == "dev"
|
|
37
|
+
Requires-Dist: twine>=5.0; extra == "dev"
|
|
38
|
+
Provides-Extra: all
|
|
39
|
+
Requires-Dist: sqlalchemy>=2.0; extra == "all"
|
|
40
|
+
Requires-Dist: aiosqlite>=0.20; extra == "all"
|
|
41
|
+
|
|
42
|
+
# Agent-OS 🤖
|
|
43
|
+
|
|
44
|
+
> An operating-system kernel for LLM agents.
|
|
45
|
+
> Scheduling · IPC · Memory · Supervisor · Deadlock Detection · Persistence
|
|
46
|
+
|
|
47
|
+
Agent-OS treats LLM agents as first-class OS processes — each agent gets a PID,
|
|
48
|
+
priority, resource quota, and lifecycle managed by a real scheduler and supervisor,
|
|
49
|
+
just like threads in an operating system.
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## Features
|
|
54
|
+
|
|
55
|
+
| OS Concept | Agent-OS Implementation |
|
|
56
|
+
|---|---|
|
|
57
|
+
| **Process Management** | Spawn, list, pause, resume, cancel, terminate agents |
|
|
58
|
+
| **Priority Scheduling** | Preemptive priority queue with starvation prevention via aging |
|
|
59
|
+
| **IPC** | Per-PID message queues, point-to-point routing, and deduplication |
|
|
60
|
+
| **Memory / Context** | Context pages, swap-in/swap-out, LRU eviction |
|
|
61
|
+
| **Supervisor** | Auto-restart on failure with configurable policies (`ONCE`, `N_TIMES`, `EXPONENTIAL_BACKOFF`) |
|
|
62
|
+
| **Deadlock Detection** | Cycle detection on resource wait graphs with automatic kernel resolution |
|
|
63
|
+
| **Resource Quotas** | Hard kernel limits: token, step, LLM-call, and wall-time quotas |
|
|
64
|
+
| **Persistence Layer** | Async SQLite storage via SQLAlchemy for processes, states, checkpoints, and events |
|
|
65
|
+
| **Event System** | Full audit log of every kernel transition and state change |
|
|
66
|
+
| **REST API** | FastAPI server with interactive Swagger documentation at `/docs` |
|
|
67
|
+
| **React Dashboard** | Real-time UI: 6 live panels, one-click `▶ Run Demo`, adaptive polling |
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## Installation & Quick Start
|
|
72
|
+
|
|
73
|
+
### 1. From PyPI / Wheel
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
# Core kernel + SDK
|
|
77
|
+
pip install agent-os-kernel
|
|
78
|
+
|
|
79
|
+
# With SQLite persistence support
|
|
80
|
+
pip install "agent-os-kernel[persistence]"
|
|
81
|
+
|
|
82
|
+
# Or full dev environment
|
|
83
|
+
pip install "agent-os-kernel[all,dev]"
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### 2. From Source
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
# Clone repository
|
|
90
|
+
git clone https://github.com/Rutika4521/Agent_OS.git
|
|
91
|
+
cd Agent_OS
|
|
92
|
+
|
|
93
|
+
# Install in editable mode
|
|
94
|
+
pip install -e ".[all,dev]"
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### 3. Run the CLI / API Server
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
# Start the API server via CLI
|
|
101
|
+
agent-os server --host 0.0.0.0 --port 8000
|
|
102
|
+
|
|
103
|
+
# Or using the run script
|
|
104
|
+
python run.py server
|
|
105
|
+
# Interactive Swagger UI available at: http://localhost:8000/docs
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### 4. Start the React UI Dashboard
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
cd frontend
|
|
112
|
+
npm install
|
|
113
|
+
npm run dev
|
|
114
|
+
# Dashboard available at: http://localhost:3000
|
|
115
|
+
```
|
|
116
|
+
Click **`▶ Run Demo`** on the top bar to trigger the multi-agent pipeline and watch live process transitions, scheduler ordering, IPC messages, and resource meters in real time!
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## SDK — 10-line Quickstart
|
|
121
|
+
|
|
122
|
+
```python
|
|
123
|
+
import agent_os
|
|
124
|
+
import asyncio
|
|
125
|
+
|
|
126
|
+
@agent_os.register(priority=8, name="Researcher", steps=[
|
|
127
|
+
{"args": ["quantum computing"]},
|
|
128
|
+
{"args": ["neural networks"]},
|
|
129
|
+
])
|
|
130
|
+
class ResearchAgent:
|
|
131
|
+
async def run(self, topic: str) -> str:
|
|
132
|
+
return f"Findings on {topic}"
|
|
133
|
+
|
|
134
|
+
@agent_os.register(priority=6, name="Writer")
|
|
135
|
+
class WriterAgent:
|
|
136
|
+
async def run(self) -> str:
|
|
137
|
+
return "Report compiled."
|
|
138
|
+
|
|
139
|
+
async def main():
|
|
140
|
+
kernel = agent_os.Kernel()
|
|
141
|
+
await kernel.boot()
|
|
142
|
+
await kernel.spawn_registered()
|
|
143
|
+
await kernel.run()
|
|
144
|
+
|
|
145
|
+
asyncio.run(main())
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
## Showcase Application — Autonomous Incident Response
|
|
151
|
+
|
|
152
|
+
A standalone enterprise incident response system demonstrating every Agent-OS capability:
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
# Run standalone terminal demo
|
|
156
|
+
cd showcase
|
|
157
|
+
python main.py
|
|
158
|
+
|
|
159
|
+
# Or start the showcase live server
|
|
160
|
+
python run_server.py
|
|
161
|
+
# (Open http://localhost:3000 and click ▶ Run Demo)
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
| Agent | Priority | OS Feature Demonstrated |
|
|
165
|
+
|---|---|---|
|
|
166
|
+
| `IncidentCommanderAgent` | 10 | Preemptive Priority Scheduling (always scheduled first) |
|
|
167
|
+
| `SecurityAuditorAgent` | 8 | Resource Quotas (token burn) & IPC report dispatch |
|
|
168
|
+
| `BugFixerAgent` | 7 | WAITING state & decoupled IPC receipt |
|
|
169
|
+
| `ContendedWorkerA / B` | 6 | Circular lock dependency & Deadlock Detection |
|
|
170
|
+
| `FlakyTestRunnerAgent` | 5 | FAILED state & Supervisor auto-restart (`N_TIMES`) |
|
|
171
|
+
| `TelemetryAgent` | 2 | Starvation prevention via dynamic Priority Aging |
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
## Architecture
|
|
176
|
+
|
|
177
|
+
```
|
|
178
|
+
agent-os/
|
|
179
|
+
├── src/agent_os/ # Core OS Kernel
|
|
180
|
+
│ ├── kernel/ # Process table, state machine, process manager
|
|
181
|
+
│ ├── scheduler/ # Priority scheduler with aging
|
|
182
|
+
│ ├── ipc/ # Message queues, routing, deduplication
|
|
183
|
+
│ ├── memory/ # Context manager, checkpointing, LRU eviction
|
|
184
|
+
│ ├── resources/ # Hard quota enforcement (tokens, steps, wall-time)
|
|
185
|
+
│ ├── supervisor/ # Failure detection & auto-restart manager
|
|
186
|
+
│ ├── deadlock/ # Resource wait graph cycle detection
|
|
187
|
+
│ ├── persistence/ # Async SQLite database, models, and repositories
|
|
188
|
+
│ ├── metrics/ # Event manager & metrics collector
|
|
189
|
+
│ ├── api/ # FastAPI REST server & demo endpoints
|
|
190
|
+
│ └── cli.py # CLI entrypoint (`agent-os`)
|
|
191
|
+
├── sdk/ # Developer SDK
|
|
192
|
+
│ ├── __init__.py # Public API exports
|
|
193
|
+
│ ├── kernel.py # Kernel bootstrap class
|
|
194
|
+
│ ├── registry.py # @agent_os.register() decorator
|
|
195
|
+
│ ├── wrapper.py # AutoWrapper (run/execute/__call__ → step)
|
|
196
|
+
│ └── agent.py # Agent protocol & AgentContext
|
|
197
|
+
├── frontend/ # React Dashboard (Vite, Recharts, Lucide)
|
|
198
|
+
├── examples/ # Research pipeline demo & SDK examples
|
|
199
|
+
├── showcase/ # Standalone 7-agent showcase application
|
|
200
|
+
└── tests/ # 340+ unit and integration tests
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
---
|
|
204
|
+
|
|
205
|
+
## Process States
|
|
206
|
+
|
|
207
|
+
```
|
|
208
|
+
CREATED → READY → RUNNING → COMPLETED → TERMINATED
|
|
209
|
+
↓ ↑
|
|
210
|
+
WAITING / BLOCKED
|
|
211
|
+
↓
|
|
212
|
+
CANCELLING → CANCELLED → TERMINATED
|
|
213
|
+
↓
|
|
214
|
+
FAILED → RESTARTING → READY
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
---
|
|
218
|
+
|
|
219
|
+
## REST API Endpoints
|
|
220
|
+
|
|
221
|
+
| Method | Endpoint | Description |
|
|
222
|
+
|---|---|---|
|
|
223
|
+
| `GET` | `/processes` | List all processes in the system |
|
|
224
|
+
| `POST` | `/processes` | Spawn an agent process |
|
|
225
|
+
| `GET` | `/processes/{pid}` | Inspect state and resource usage for PID |
|
|
226
|
+
| `POST` | `/processes/{pid}/pause` | Pause process execution |
|
|
227
|
+
| `POST` | `/processes/{pid}/resume` | Resume paused process |
|
|
228
|
+
| `POST` | `/processes/{pid}/cancel` | Gracefully cancel a process |
|
|
229
|
+
| `POST` | `/processes/{pid}/terminate` | Force terminate a process |
|
|
230
|
+
| `POST` | `/ipc/send` | Send an IPC message between two PIDs |
|
|
231
|
+
| `GET` | `/ipc/receive/{pid}` | Retrieve queued message for a PID |
|
|
232
|
+
| `GET` | `/events` | Query audit trail of kernel events |
|
|
233
|
+
| `GET` | `/metrics` | Aggregated CPU/tokens/state metrics |
|
|
234
|
+
| `GET` | `/health` | System health check and status |
|
|
235
|
+
| `POST` | `/demo/run` | Trigger multi-agent pipeline in background |
|
|
236
|
+
| `GET` | `/demo/status` | Current status of running pipeline |
|
|
237
|
+
| `POST` | `/demo/reset` | Clear process table and reset demo state |
|
|
238
|
+
|
|
239
|
+
---
|
|
240
|
+
|
|
241
|
+
## Running Tests
|
|
242
|
+
|
|
243
|
+
```bash
|
|
244
|
+
# Run complete test suite (340+ tests)
|
|
245
|
+
python run_tests.py
|
|
246
|
+
|
|
247
|
+
# Or via pytest directly
|
|
248
|
+
pytest tests/ -v
|
|
249
|
+
|
|
250
|
+
# Run with test coverage
|
|
251
|
+
pytest tests/ --cov=agent_os
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
---
|
|
255
|
+
|
|
256
|
+
## License
|
|
257
|
+
|
|
258
|
+
MIT — see [LICENSE](LICENSE)
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
# Agent-OS 🤖
|
|
2
|
+
|
|
3
|
+
> An operating-system kernel for LLM agents.
|
|
4
|
+
> Scheduling · IPC · Memory · Supervisor · Deadlock Detection · Persistence
|
|
5
|
+
|
|
6
|
+
Agent-OS treats LLM agents as first-class OS processes — each agent gets a PID,
|
|
7
|
+
priority, resource quota, and lifecycle managed by a real scheduler and supervisor,
|
|
8
|
+
just like threads in an operating system.
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## Features
|
|
13
|
+
|
|
14
|
+
| OS Concept | Agent-OS Implementation |
|
|
15
|
+
|---|---|
|
|
16
|
+
| **Process Management** | Spawn, list, pause, resume, cancel, terminate agents |
|
|
17
|
+
| **Priority Scheduling** | Preemptive priority queue with starvation prevention via aging |
|
|
18
|
+
| **IPC** | Per-PID message queues, point-to-point routing, and deduplication |
|
|
19
|
+
| **Memory / Context** | Context pages, swap-in/swap-out, LRU eviction |
|
|
20
|
+
| **Supervisor** | Auto-restart on failure with configurable policies (`ONCE`, `N_TIMES`, `EXPONENTIAL_BACKOFF`) |
|
|
21
|
+
| **Deadlock Detection** | Cycle detection on resource wait graphs with automatic kernel resolution |
|
|
22
|
+
| **Resource Quotas** | Hard kernel limits: token, step, LLM-call, and wall-time quotas |
|
|
23
|
+
| **Persistence Layer** | Async SQLite storage via SQLAlchemy for processes, states, checkpoints, and events |
|
|
24
|
+
| **Event System** | Full audit log of every kernel transition and state change |
|
|
25
|
+
| **REST API** | FastAPI server with interactive Swagger documentation at `/docs` |
|
|
26
|
+
| **React Dashboard** | Real-time UI: 6 live panels, one-click `▶ Run Demo`, adaptive polling |
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## Installation & Quick Start
|
|
31
|
+
|
|
32
|
+
### 1. From PyPI / Wheel
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
# Core kernel + SDK
|
|
36
|
+
pip install agent-os-kernel
|
|
37
|
+
|
|
38
|
+
# With SQLite persistence support
|
|
39
|
+
pip install "agent-os-kernel[persistence]"
|
|
40
|
+
|
|
41
|
+
# Or full dev environment
|
|
42
|
+
pip install "agent-os-kernel[all,dev]"
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### 2. From Source
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
# Clone repository
|
|
49
|
+
git clone https://github.com/Rutika4521/Agent_OS.git
|
|
50
|
+
cd Agent_OS
|
|
51
|
+
|
|
52
|
+
# Install in editable mode
|
|
53
|
+
pip install -e ".[all,dev]"
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### 3. Run the CLI / API Server
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
# Start the API server via CLI
|
|
60
|
+
agent-os server --host 0.0.0.0 --port 8000
|
|
61
|
+
|
|
62
|
+
# Or using the run script
|
|
63
|
+
python run.py server
|
|
64
|
+
# Interactive Swagger UI available at: http://localhost:8000/docs
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### 4. Start the React UI Dashboard
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
cd frontend
|
|
71
|
+
npm install
|
|
72
|
+
npm run dev
|
|
73
|
+
# Dashboard available at: http://localhost:3000
|
|
74
|
+
```
|
|
75
|
+
Click **`▶ Run Demo`** on the top bar to trigger the multi-agent pipeline and watch live process transitions, scheduler ordering, IPC messages, and resource meters in real time!
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## SDK — 10-line Quickstart
|
|
80
|
+
|
|
81
|
+
```python
|
|
82
|
+
import agent_os
|
|
83
|
+
import asyncio
|
|
84
|
+
|
|
85
|
+
@agent_os.register(priority=8, name="Researcher", steps=[
|
|
86
|
+
{"args": ["quantum computing"]},
|
|
87
|
+
{"args": ["neural networks"]},
|
|
88
|
+
])
|
|
89
|
+
class ResearchAgent:
|
|
90
|
+
async def run(self, topic: str) -> str:
|
|
91
|
+
return f"Findings on {topic}"
|
|
92
|
+
|
|
93
|
+
@agent_os.register(priority=6, name="Writer")
|
|
94
|
+
class WriterAgent:
|
|
95
|
+
async def run(self) -> str:
|
|
96
|
+
return "Report compiled."
|
|
97
|
+
|
|
98
|
+
async def main():
|
|
99
|
+
kernel = agent_os.Kernel()
|
|
100
|
+
await kernel.boot()
|
|
101
|
+
await kernel.spawn_registered()
|
|
102
|
+
await kernel.run()
|
|
103
|
+
|
|
104
|
+
asyncio.run(main())
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
## Showcase Application — Autonomous Incident Response
|
|
110
|
+
|
|
111
|
+
A standalone enterprise incident response system demonstrating every Agent-OS capability:
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
# Run standalone terminal demo
|
|
115
|
+
cd showcase
|
|
116
|
+
python main.py
|
|
117
|
+
|
|
118
|
+
# Or start the showcase live server
|
|
119
|
+
python run_server.py
|
|
120
|
+
# (Open http://localhost:3000 and click ▶ Run Demo)
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
| Agent | Priority | OS Feature Demonstrated |
|
|
124
|
+
|---|---|---|
|
|
125
|
+
| `IncidentCommanderAgent` | 10 | Preemptive Priority Scheduling (always scheduled first) |
|
|
126
|
+
| `SecurityAuditorAgent` | 8 | Resource Quotas (token burn) & IPC report dispatch |
|
|
127
|
+
| `BugFixerAgent` | 7 | WAITING state & decoupled IPC receipt |
|
|
128
|
+
| `ContendedWorkerA / B` | 6 | Circular lock dependency & Deadlock Detection |
|
|
129
|
+
| `FlakyTestRunnerAgent` | 5 | FAILED state & Supervisor auto-restart (`N_TIMES`) |
|
|
130
|
+
| `TelemetryAgent` | 2 | Starvation prevention via dynamic Priority Aging |
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
## Architecture
|
|
135
|
+
|
|
136
|
+
```
|
|
137
|
+
agent-os/
|
|
138
|
+
├── src/agent_os/ # Core OS Kernel
|
|
139
|
+
│ ├── kernel/ # Process table, state machine, process manager
|
|
140
|
+
│ ├── scheduler/ # Priority scheduler with aging
|
|
141
|
+
│ ├── ipc/ # Message queues, routing, deduplication
|
|
142
|
+
│ ├── memory/ # Context manager, checkpointing, LRU eviction
|
|
143
|
+
│ ├── resources/ # Hard quota enforcement (tokens, steps, wall-time)
|
|
144
|
+
│ ├── supervisor/ # Failure detection & auto-restart manager
|
|
145
|
+
│ ├── deadlock/ # Resource wait graph cycle detection
|
|
146
|
+
│ ├── persistence/ # Async SQLite database, models, and repositories
|
|
147
|
+
│ ├── metrics/ # Event manager & metrics collector
|
|
148
|
+
│ ├── api/ # FastAPI REST server & demo endpoints
|
|
149
|
+
│ └── cli.py # CLI entrypoint (`agent-os`)
|
|
150
|
+
├── sdk/ # Developer SDK
|
|
151
|
+
│ ├── __init__.py # Public API exports
|
|
152
|
+
│ ├── kernel.py # Kernel bootstrap class
|
|
153
|
+
│ ├── registry.py # @agent_os.register() decorator
|
|
154
|
+
│ ├── wrapper.py # AutoWrapper (run/execute/__call__ → step)
|
|
155
|
+
│ └── agent.py # Agent protocol & AgentContext
|
|
156
|
+
├── frontend/ # React Dashboard (Vite, Recharts, Lucide)
|
|
157
|
+
├── examples/ # Research pipeline demo & SDK examples
|
|
158
|
+
├── showcase/ # Standalone 7-agent showcase application
|
|
159
|
+
└── tests/ # 340+ unit and integration tests
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
## Process States
|
|
165
|
+
|
|
166
|
+
```
|
|
167
|
+
CREATED → READY → RUNNING → COMPLETED → TERMINATED
|
|
168
|
+
↓ ↑
|
|
169
|
+
WAITING / BLOCKED
|
|
170
|
+
↓
|
|
171
|
+
CANCELLING → CANCELLED → TERMINATED
|
|
172
|
+
↓
|
|
173
|
+
FAILED → RESTARTING → READY
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
## REST API Endpoints
|
|
179
|
+
|
|
180
|
+
| Method | Endpoint | Description |
|
|
181
|
+
|---|---|---|
|
|
182
|
+
| `GET` | `/processes` | List all processes in the system |
|
|
183
|
+
| `POST` | `/processes` | Spawn an agent process |
|
|
184
|
+
| `GET` | `/processes/{pid}` | Inspect state and resource usage for PID |
|
|
185
|
+
| `POST` | `/processes/{pid}/pause` | Pause process execution |
|
|
186
|
+
| `POST` | `/processes/{pid}/resume` | Resume paused process |
|
|
187
|
+
| `POST` | `/processes/{pid}/cancel` | Gracefully cancel a process |
|
|
188
|
+
| `POST` | `/processes/{pid}/terminate` | Force terminate a process |
|
|
189
|
+
| `POST` | `/ipc/send` | Send an IPC message between two PIDs |
|
|
190
|
+
| `GET` | `/ipc/receive/{pid}` | Retrieve queued message for a PID |
|
|
191
|
+
| `GET` | `/events` | Query audit trail of kernel events |
|
|
192
|
+
| `GET` | `/metrics` | Aggregated CPU/tokens/state metrics |
|
|
193
|
+
| `GET` | `/health` | System health check and status |
|
|
194
|
+
| `POST` | `/demo/run` | Trigger multi-agent pipeline in background |
|
|
195
|
+
| `GET` | `/demo/status` | Current status of running pipeline |
|
|
196
|
+
| `POST` | `/demo/reset` | Clear process table and reset demo state |
|
|
197
|
+
|
|
198
|
+
---
|
|
199
|
+
|
|
200
|
+
## Running Tests
|
|
201
|
+
|
|
202
|
+
```bash
|
|
203
|
+
# Run complete test suite (340+ tests)
|
|
204
|
+
python run_tests.py
|
|
205
|
+
|
|
206
|
+
# Or via pytest directly
|
|
207
|
+
pytest tests/ -v
|
|
208
|
+
|
|
209
|
+
# Run with test coverage
|
|
210
|
+
pytest tests/ --cov=agent_os
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
---
|
|
214
|
+
|
|
215
|
+
## License
|
|
216
|
+
|
|
217
|
+
MIT — see [LICENSE](LICENSE)
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "RRSSM-agent-os"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "An operating-system kernel for LLM agents — scheduling, IPC, memory, supervisor, and deadlock detection."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = { text = "MIT" }
|
|
11
|
+
requires-python = ">=3.12"
|
|
12
|
+
authors = [
|
|
13
|
+
{ name = "Agent-OS Contributors" }
|
|
14
|
+
]
|
|
15
|
+
keywords = [
|
|
16
|
+
"agents", "llm", "multi-agent", "operating-system",
|
|
17
|
+
"scheduler", "ipc", "process-manager", "ai", "autonomous-agents"
|
|
18
|
+
]
|
|
19
|
+
classifiers = [
|
|
20
|
+
"Development Status :: 3 - Alpha",
|
|
21
|
+
"Intended Audience :: Developers",
|
|
22
|
+
"Intended Audience :: Science/Research",
|
|
23
|
+
"License :: OSI Approved :: MIT License",
|
|
24
|
+
"Programming Language :: Python :: 3",
|
|
25
|
+
"Programming Language :: Python :: 3.12",
|
|
26
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
27
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
28
|
+
"Framework :: AsyncIO",
|
|
29
|
+
"Operating System :: OS Independent",
|
|
30
|
+
]
|
|
31
|
+
dependencies = [
|
|
32
|
+
"pyyaml>=6.0",
|
|
33
|
+
"fastapi>=0.110.0",
|
|
34
|
+
"uvicorn[standard]>=0.29.0",
|
|
35
|
+
"pydantic>=2.0",
|
|
36
|
+
]
|
|
37
|
+
|
|
38
|
+
[project.optional-dependencies]
|
|
39
|
+
persistence = [
|
|
40
|
+
"sqlalchemy>=2.0",
|
|
41
|
+
"aiosqlite>=0.20",
|
|
42
|
+
]
|
|
43
|
+
dev = [
|
|
44
|
+
"pytest>=9.0",
|
|
45
|
+
"pytest-asyncio>=0.23",
|
|
46
|
+
"pytest-cov>=5.0",
|
|
47
|
+
"httpx>=0.27",
|
|
48
|
+
"build>=1.0",
|
|
49
|
+
"twine>=5.0",
|
|
50
|
+
]
|
|
51
|
+
all = [
|
|
52
|
+
"sqlalchemy>=2.0",
|
|
53
|
+
"aiosqlite>=0.20",
|
|
54
|
+
]
|
|
55
|
+
|
|
56
|
+
[project.urls]
|
|
57
|
+
Homepage = "https://github.com/your-org/agent-os"
|
|
58
|
+
Documentation = "https://github.com/your-org/agent-os#readme"
|
|
59
|
+
Repository = "https://github.com/your-org/agent-os"
|
|
60
|
+
"Bug Tracker" = "https://github.com/your-org/agent-os/issues"
|
|
61
|
+
|
|
62
|
+
[project.scripts]
|
|
63
|
+
agent-os = "agent_os.cli:main"
|
|
64
|
+
|
|
65
|
+
# ── Package discovery ──────────────────────────────────────────────────────────
|
|
66
|
+
# agent_os.sdk is physically inside src/agent_os/sdk/ — auto-discovered.
|
|
67
|
+
|
|
68
|
+
[tool.setuptools.packages.find]
|
|
69
|
+
where = ["src"]
|
|
70
|
+
include = ["agent_os*"]
|
|
71
|
+
|
|
72
|
+
[tool.setuptools.package-dir]
|
|
73
|
+
"" = "src"
|
|
74
|
+
|
|
75
|
+
# ── Pytest ────────────────────────────────────────────────────────────────────
|
|
76
|
+
|
|
77
|
+
[tool.pytest.ini_options]
|
|
78
|
+
asyncio_mode = "auto"
|
|
79
|
+
testpaths = ["tests"]
|
|
80
|
+
pythonpath = ["src", "."]
|
|
81
|
+
|
|
82
|
+
# ── Coverage ──────────────────────────────────────────────────────────────────
|
|
83
|
+
|
|
84
|
+
[tool.coverage.run]
|
|
85
|
+
source = ["agent_os"]
|
|
86
|
+
omit = ["tests/*", "examples/*"]
|
|
87
|
+
|
|
88
|
+
[tool.coverage.report]
|
|
89
|
+
show_missing = true
|
|
90
|
+
skip_covered = false
|