fableforge-agent-runtime 0.1.0__py3-none-any.whl

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,274 @@
1
+ Metadata-Version: 2.4
2
+ Name: fableforge-agent-runtime
3
+ Version: 0.1.0
4
+ Summary: Persistent agent daemon — systemd for AI agents
5
+ License-File: LICENSE
6
+ Requires-Python: >=3.11
7
+ Requires-Dist: fastapi>=0.111.0
8
+ Requires-Dist: pydantic>=2.7.0
9
+ Requires-Dist: redis>=5.0.0
10
+ Requires-Dist: sqlalchemy>=2.0.30
11
+ Requires-Dist: uvicorn[standard]>=0.30.0
12
+ Provides-Extra: dev
13
+ Requires-Dist: httpx>=0.27; extra == 'dev'
14
+ Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
15
+ Requires-Dist: pytest>=8.0; extra == 'dev'
16
+ Description-Content-Type: text/markdown
17
+
18
+ # AgentRuntime — systemd for AI Agents
19
+
20
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE) [![Python 3.10+](https://img.shields.io/badge/python-3.10%2B-blue.svg)](https://www.python.org/downloads/) [![Tests](https://img.shields.io/badge/tests-0-yellow.svg)](tests/)
21
+
22
+
23
+ A persistent agent daemon that manages AI agent processes, serializes state, and resumes sessions. Think of it as **systemd for AI agents** — start, pause, resume, and checkpoint agent sessions with full state persistence.
24
+
25
+ ## Architecture
26
+
27
+ ```
28
+ ┌─────────────┐ ┌──────────────────┐ ┌────────────────┐
29
+ │ CLI │────▶│ FastAPI Server │────▶│ SessionManager│
30
+ │ (agentd) │ │ (port 8721) │ │ │
31
+ └─────────────┘ └──────────────────┘ └───────┬────────┘
32
+
33
+ ┌─────────────────────────┼─────────────────────┐
34
+ │ │ │
35
+ ┌────────▼────────┐ ┌────────▼────────┐ ┌───────▼──────┐
36
+ │ StateSerializer │ │ MemoryStore │ │ Daemon │
37
+ │ (SQLite) │ │ (Short+Long) │ │ (Heartbeat) │
38
+ └─────────────────┘ └─────────────────┘ └──────────────┘
39
+ ```
40
+
41
+ ## Features
42
+
43
+ - **Session Lifecycle**: Create, start, pause, resume, stop agent sessions
44
+ - **State Persistence**: Full session state serialized to SQLite
45
+ - **Checkpoints**: Save and restore complete state at any point
46
+ - **Memory Management**: Short-term (conversation context) and long-term (key-value with semantic search)
47
+ - **Memory Consolidation**: Auto-summarize old short-term memories
48
+ - **Auto-Checkpoint**: Configurable interval for automatic state snapshots
49
+ - **Graceful Shutdown**: State preservation on daemon stop
50
+ - **Session Timeout**: Automatic cleanup of stopped sessions
51
+ - **REST API**: Full HTTP API via FastAPI
52
+ - **CLI**: Command-line interface for all operations
53
+ - **Docker**: Production-ready container image
54
+
55
+ ## Quick Start
56
+
57
+ ### Install
58
+
59
+ ```bash
60
+ pip install -e .
61
+ ```
62
+
63
+ ### Start the Daemon
64
+
65
+ ```bash
66
+ agentd start --port 8721
67
+ ```
68
+
69
+ ### Create a Session
70
+
71
+ ```bash
72
+ agentd create --name "my-agent" --model fableforge-14b --system-prompt "You are a helpful assistant"
73
+ ```
74
+
75
+ ### List Sessions
76
+
77
+ ```bash
78
+ agentd list
79
+ ```
80
+
81
+ ### Resume a Session
82
+
83
+ ```bash
84
+ agentd resume <session-id> --checkpoint-id <checkpoint-id>
85
+ ```
86
+
87
+ ### Stop the Daemon
88
+
89
+ ```bash
90
+ agentd stop
91
+ ```
92
+
93
+ ## API Reference
94
+
95
+ ### POST /sessions
96
+
97
+ Create a new session.
98
+
99
+ ```json
100
+ {
101
+ "name": "my-agent",
102
+ "model": "fableforge-14b",
103
+ "system_prompt": "You are a helpful assistant.",
104
+ "tools": ["search", "calculator"]
105
+ }
106
+ ```
107
+
108
+ ### GET /sessions
109
+
110
+ List all sessions.
111
+
112
+ ### GET /sessions/{id}
113
+
114
+ Get session state.
115
+
116
+ ### POST /sessions/{id}/start
117
+
118
+ Start a session (begins heartbeat and auto-checkpoint).
119
+
120
+ ### POST /sessions/{id}/pause
121
+
122
+ Pause a running session (creates checkpoint, cancels heartbeat).
123
+
124
+ ### POST /sessions/{id}/resume
125
+
126
+ Resume a paused or stopped session.
127
+
128
+ ```json
129
+ {
130
+ "session_id": "abc123",
131
+ "checkpoint_id": "cp_456"
132
+ }
133
+ ```
134
+
135
+ ### POST /sessions/{id}/stop
136
+
137
+ Stop a session (creates final checkpoint).
138
+
139
+ ### GET /sessions/{id}/memory
140
+
141
+ List memory keys or retrieve specific key: `?key=my_key`
142
+
143
+ ### POST /sessions/{id}/memory
144
+
145
+ Store a memory entry.
146
+
147
+ ```json
148
+ {
149
+ "key": "user_preference",
150
+ "value": {"theme": "dark", "language": "en"}
151
+ }
152
+ ```
153
+
154
+ ### GET /sessions/{id}/checkpoints
155
+
156
+ List all checkpoints for a session.
157
+
158
+ ### POST /sessions/{id}/checkpoints
159
+
160
+ Create a checkpoint. Query param: `?label=my-checkpoint`
161
+
162
+ ### GET /health
163
+
164
+ Daemon health status.
165
+
166
+ ## Session States
167
+
168
+ ```
169
+ CREATED ──▶ RUNNING ──◆──▶ PAUSED ──▶ RUNNING
170
+ │ │ │
171
+ │ └──▶ STOPPED
172
+ └──▶ ERROR
173
+ ```
174
+
175
+ ## Memory Architecture
176
+
177
+ ### Short-Term Memory
178
+
179
+ - Last N messages per session (default 50)
180
+ - Automatic pruning when window exceeded
181
+ - Used for conversation context
182
+
183
+ ### Long-Term Memory
184
+
185
+ - Key-value store with optional embeddings
186
+ - Cosine similarity semantic search
187
+ - Persistent across sessions
188
+ - Consolidation: summarizes old short-term into long-term
189
+
190
+ ### Consolidation
191
+
192
+ When short-term memory exceeds a threshold, the daemon:
193
+ 1. Summarizes the recent conversation
194
+ 2. Stores the summary in long-term memory
195
+ 3. Prunes old short-term entries
196
+
197
+ ## Configuration
198
+
199
+ | Env Variable | Default | Description |
200
+ |---|---|---|
201
+ | `AGENT_RUNTIME_DB` | `~/.agent_runtime/state.db` | SQLite database path |
202
+ | `AGENT_RUNTIME_MEMORY_DB` | `~/.agent_runtime/memory.db` | Memory database path |
203
+ | `AGENT_RUNTIME_PORT` | `8721` | HTTP server port |
204
+ | `AGENT_RUNTIME_HOST` | `0.0.0.0` | HTTP server bind address |
205
+ | `AGENT_RUNTIME_CHECKPOINT_INTERVAL` | `60` | Auto-checkpoint interval (seconds) |
206
+ | `AGENT_RUNTIME_SESSION_TIMEOUT` | `3600` | Session timeout (seconds) |
207
+
208
+ ## Docker
209
+
210
+ ```bash
211
+ docker build -f docker/Dockerfile -t agent-runtime .
212
+ docker run -p 8721:8721 -v agent_data:/root/.agent_runtime agent-runtime
213
+ ```
214
+
215
+ ## Testing
216
+
217
+ ```bash
218
+ pip install -e ".[dev]"
219
+ pytest tests/ -v
220
+ ```
221
+
222
+ ## Project Structure
223
+
224
+ ```
225
+ agent-runtime/
226
+ ├── pyproject.toml
227
+ ├── docker/
228
+ │ └── Dockerfile
229
+ ├── src/
230
+ │ └── agent_runtime/
231
+ │ ├── __init__.py
232
+ │ ├── models.py # Pydantic models
233
+ │ ├── state_serializer.py # SQLite state persistence
234
+ │ ├── memory_store.py # Short/long-term memory
235
+ │ ├── session_manager.py # Session lifecycle
236
+ │ ├── daemon.py # Background daemon process
237
+ │ ├── server.py # FastAPI HTTP server
238
+ │ └── cli.py # CLI interface
239
+ ├── tests/
240
+ │ └── test_state_serializer.py
241
+ └── README.md
242
+ ```
243
+
244
+ ## License
245
+
246
+ MIT
247
+
248
+ ## Ecosystem
249
+
250
+ Part of the [FableForge](../) ecosystem — 21 open-source projects built from 210K real agent traces:
251
+
252
+ | Project | Description |
253
+ | --- | --- |
254
+ | **[Anvil](../anvil)** | Self-verified coding agent |
255
+ | **[VerifyLoop](../verifyloop)** | Plan→Execute→Verify→Recover framework |
256
+ | **[ErrorRecovery](../error-recovery)** | Self-healing middleware (3,725 error patterns) |
257
+ | **[FableForge-14B](../fableforge-14b)** | The fine-tuned 14B model (4-stage training) |
258
+ | **[ShellWhisperer](../shell-whisperer)** | 1.5B edge agent (phone/RPi, 50ms) |
259
+ | **[ReasonCritic](../reason-critic)** | Verification model (130 benchmark tasks) |
260
+ | **[TraceCompiler](../trace-compiler)** | Compile traces → LoRA skills |
261
+ | **[AgentRuntime](../agent-runtime)** | Persistent agent daemon (systemd for AI) |
262
+ | **[AgentSwarm](../agent-swarm)** | Multi-agent from real trace transitions |
263
+ | **[AgentTelemetry](../agent-telemetry)** | Datadog for agents (token tracking, costs) |
264
+ | **[BenchAgent](../bench-agent)** | HumanEval for tool-use (107 tasks) |
265
+ | **[AgentDev](../agent-dev)** | VSCode extension with verification |
266
+ | **[TraceViz](../trace-viz)** | Trace replay visualizer (Next.js) |
267
+ | **[AgentSkills](../agent-skills)** | npm for agent behaviors |
268
+ | **[AgentCurriculum](../agent-curriculum)** | 5-stage progressive training |
269
+ | **[AgentFuzzer](../agent-fuzzer)** | Adversarial testing for agents |
270
+ | **[AgentConstitution](../agent-constitution)** | Safety guardrails from traces |
271
+ | **[CostOptimizer](../cost-optimizer)** | Token cost reduction (50-80%) |
272
+ | **[AgentProfiler](../agent-profiler)** | Behavioral fingerprinting |
273
+ | **[TrajectoryDistiller](../trajectory-distiller)** | Trace→training data pipeline |
274
+ | **[Fable5-Dataset](../fable5-dataset)** | HuggingFace dataset release |
@@ -0,0 +1,13 @@
1
+ agent_runtime/__init__.py,sha256=HCkdbvhIirs0dDUGH7TNnLj_l985Kb3FWYVxL06QXyY,103
2
+ agent_runtime/cli.py,sha256=QKoeJf4Nv_c7a5z7H-UsMriaH0fVWi3tFxhBkyXJoRA,3971
3
+ agent_runtime/daemon.py,sha256=4nqk2G5UxrS45nmDXnBWsueFi4dmOYbRqG9lGR27iEI,6137
4
+ agent_runtime/memory_store.py,sha256=__4rxl5TUKs1MCKWYddGjG462RhienuMVhSQL9Jbe6c,8595
5
+ agent_runtime/models.py,sha256=x_PhQSxUXiLWWS35Cs_aMqWvF9UkRfasI6aUY_eOpvU,2201
6
+ agent_runtime/server.py,sha256=0fRM6250Nq9jRKJCyfsvo0WezxI1rqJBg9KCQmenI7I,4333
7
+ agent_runtime/session_manager.py,sha256=1G-NtBGUC3_lmYToCnaru5GO0-IOQ8nARR_TlyiUvWw,6450
8
+ agent_runtime/state_serializer.py,sha256=I5KE-Km5GjOuBQR_xIXgoBfqDSis70QU4KLLzDC7SZU,7794
9
+ fableforge_agent_runtime-0.1.0.dist-info/METADATA,sha256=Acs94sJ9BmZ2TyBXrkUDG9q3eFxvYQ0UY0te6x_cN5E,8826
10
+ fableforge_agent_runtime-0.1.0.dist-info/WHEEL,sha256=mffPy8wBnZQn2VnJUU5jE99KsxaSfiyMHV9Yt0aLVxs,87
11
+ fableforge_agent_runtime-0.1.0.dist-info/entry_points.txt,sha256=1Hi8iBp-bzK_fyX5v7y9UCO8CR_yJ05v9RhW5KscJv4,49
12
+ fableforge_agent_runtime-0.1.0.dist-info/licenses/LICENSE,sha256=w5aFYmJW6UW4AWlHHzPSfzaK9jMabxY0EPRzd12k7V0,1080
13
+ fableforge_agent_runtime-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.30.1
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ agentd = agent_runtime.cli:app
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 FableForge Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.