Skip to main content

AgentRuntime — systemd for AI Agents

License: MIT Python 3.10+ Tests

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.

Architecture

┌─────────────┐     ┌──────────────────┐     ┌────────────────┐
│   CLI       │────▶│   FastAPI Server │────▶│  SessionManager│
│  (agentd)   │     │   (port 8721)    │     │                │
└─────────────┘     └──────────────────┘     └───────┬────────┘
                                                      │
                              ┌─────────────────────────┼─────────────────────┐
                              │                         │                     │
                     ┌────────▼────────┐      ┌────────▼────────┐   ┌───────▼──────┐
                     │ StateSerializer │      │   MemoryStore   │   │    Daemon     │
                     │   (SQLite)      │      │  (Short+Long)   │   │  (Heartbeat)  │
                     └─────────────────┘      └─────────────────┘   └──────────────┘

Features

  • Session Lifecycle: Create, start, pause, resume, stop agent sessions
  • State Persistence: Full session state serialized to SQLite
  • Checkpoints: Save and restore complete state at any point
  • Memory Management: Short-term (conversation context) and long-term (key-value with semantic search)
  • Memory Consolidation: Auto-summarize old short-term memories
  • Auto-Checkpoint: Configurable interval for automatic state snapshots
  • Graceful Shutdown: State preservation on daemon stop
  • Session Timeout: Automatic cleanup of stopped sessions
  • REST API: Full HTTP API via FastAPI
  • CLI: Command-line interface for all operations
  • Docker: Production-ready container image

Quick Start

Install

pip install -e .

Start the Daemon

agentd start --port 8721

Create a Session

agentd create --name "my-agent" --model fableforge-14b --system-prompt "You are a helpful assistant"

List Sessions

agentd list

Resume a Session

agentd resume <session-id> --checkpoint-id <checkpoint-id>

Stop the Daemon

agentd stop

API Reference

POST /sessions

Create a new session.

{
  "name": "my-agent",
  "model": "fableforge-14b",
  "system_prompt": "You are a helpful assistant.",
  "tools": ["search", "calculator"]
}

GET /sessions

List all sessions.

GET /sessions/{id}

Get session state.

POST /sessions/{id}/start

Start a session (begins heartbeat and auto-checkpoint).

POST /sessions/{id}/pause

Pause a running session (creates checkpoint, cancels heartbeat).

POST /sessions/{id}/resume

Resume a paused or stopped session.

{
  "session_id": "abc123",
  "checkpoint_id": "cp_456"
}

POST /sessions/{id}/stop

Stop a session (creates final checkpoint).

GET /sessions/{id}/memory

List memory keys or retrieve specific key: ?key=my_key

POST /sessions/{id}/memory

Store a memory entry.

{
  "key": "user_preference",
  "value": {"theme": "dark", "language": "en"}
}

GET /sessions/{id}/checkpoints

List all checkpoints for a session.

POST /sessions/{id}/checkpoints

Create a checkpoint. Query param: ?label=my-checkpoint

GET /health

Daemon health status.

Session States

CREATED ──▶ RUNNING ──◆──▶ PAUSED ──▶ RUNNING
              │    │         │
              │    └──▶ STOPPED
              └──▶ ERROR

Memory Architecture

Short-Term Memory

  • Last N messages per session (default 50)
  • Automatic pruning when window exceeded
  • Used for conversation context

Long-Term Memory

  • Key-value store with optional embeddings
  • Cosine similarity semantic search
  • Persistent across sessions
  • Consolidation: summarizes old short-term into long-term

Consolidation

When short-term memory exceeds a threshold, the daemon:

  1. Summarizes the recent conversation
  2. Stores the summary in long-term memory
  3. Prunes old short-term entries

Configuration

Env Variable Default Description
AGENT_RUNTIME_DB ~/.agent_runtime/state.db SQLite database path
AGENT_RUNTIME_MEMORY_DB ~/.agent_runtime/memory.db Memory database path
AGENT_RUNTIME_PORT 8721 HTTP server port
AGENT_RUNTIME_HOST 0.0.0.0 HTTP server bind address
AGENT_RUNTIME_CHECKPOINT_INTERVAL 60 Auto-checkpoint interval (seconds)
AGENT_RUNTIME_SESSION_TIMEOUT 3600 Session timeout (seconds)

Docker

docker build -f docker/Dockerfile -t agent-runtime .
docker run -p 8721:8721 -v agent_data:/root/.agent_runtime agent-runtime

Testing

pip install -e ".[dev]"
pytest tests/ -v

Project Structure

agent-runtime/
├── pyproject.toml
├── docker/
│   └── Dockerfile
├── src/
│   └── agent_runtime/
│       ├── __init__.py
│       ├── models.py              # Pydantic models
│       ├── state_serializer.py    # SQLite state persistence
│       ├── memory_store.py        # Short/long-term memory
│       ├── session_manager.py     # Session lifecycle
│       ├── daemon.py              # Background daemon process
│       ├── server.py              # FastAPI HTTP server
│       └── cli.py                 # CLI interface
├── tests/
│   └── test_state_serializer.py
└── README.md

License

MIT

Ecosystem

Part of the FableForge ecosystem — 21 open-source projects built from 210K real agent traces:

Project Description
Anvil Self-verified coding agent
VerifyLoop Plan→Execute→Verify→Recover framework
ErrorRecovery Self-healing middleware (3,725 error patterns)
FableForge-14B The fine-tuned 14B model (4-stage training)
ShellWhisperer 1.5B edge agent (phone/RPi, 50ms)
ReasonCritic Verification model (130 benchmark tasks)
TraceCompiler Compile traces → LoRA skills
AgentRuntime Persistent agent daemon (systemd for AI)
AgentSwarm Multi-agent from real trace transitions
AgentTelemetry Datadog for agents (token tracking, costs)
BenchAgent HumanEval for tool-use (107 tasks)
AgentDev VSCode extension with verification
TraceViz Trace replay visualizer (Next.js)
AgentSkills npm for agent behaviors
AgentCurriculum 5-stage progressive training
AgentFuzzer Adversarial testing for agents
AgentConstitution Safety guardrails from traces
CostOptimizer Token cost reduction (50-80%)
AgentProfiler Behavioral fingerprinting
TrajectoryDistiller Trace→training data pipeline
Fable5-Dataset HuggingFace dataset release

Release files for fableforge-agent-runtime 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fableforge-agent-runtime 0.1.0
File Size Uploaded
fableforge_agent_runtime-0.1.0.tar.gz 14.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for fableforge-agent-runtime 0.1.0
File Interpreter ABI Platform
fableforge_agent_runtime-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 31.2 kB

Release files / fableforge_agent_runtime-0.1.0.tar.gz

Download URL fableforge_agent_runtime-0.1.0.tar.gz
Size 14.4 kB
Tags Source
SHA-256 checksum
How to use checksums
9c77738e3e160aa139346b88c1566897ef7ca5ca46c2fc8d33b72155649b7776
BLAKE2b-256 checksum
How to use checksums
3c9e55a07aebe5e893bf80d2ea86c176b1527e408964f3a7cff0ca7227f649ea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 14, 2026.

Transparency log

Release files / fableforge_agent_runtime-0.1.0-py3-none-any.whl

Download URL fableforge_agent_runtime-0.1.0-py3-none-any.whl
Size 16.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
50e6ce6bfffda1e34080beae72633ee704ea9896dd62093855e6da450e332bd1
BLAKE2b-256 checksum
How to use checksums
cc65407bdcfd98e25fd1f7d766236fdb5adcc423ac99719a8aa9032d40987bdc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 14, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page