Disk-backed memory for Autourgos agents — JSON file (LocalShortTermMemory) and SQLite (SQLiteMemory).
Project description
autourgos-local-memory
Disk-backed memory for Autourgos agents.
Two classes — a JSON file store and a SQLite store. Memory survives process restarts and can be shared across sessions.
Install
pip install autourgos-local-memory
Classes
LocalShortTermMemory — JSON file
Persists messages as a JSON array. Safe for multiple threads. Uses atomic write (tmp → replace) and a file-level lock to prevent corruption.
from autourgos_local_memory import LocalShortTermMemory
from autourgos_react_agent import ReactAgent
memory = LocalShortTermMemory(
file_path="./data/session.json",
max_messages=50,
)
agent = ReactAgent(llm=my_llm, memory=memory)
agent.invoke("Remember: my project deadline is Friday")
# Next session — history is loaded from disk automatically
agent2 = ReactAgent(llm=my_llm, memory=LocalShortTermMemory(file_path="./data/session.json"))
agent2.invoke("When is my deadline?")
# → "Your project deadline is Friday."
SQLiteMemory — SQLite database
WAL-mode SQLite. Safer than JSON for concurrent writes — no external lock file needed. Efficient for large histories.
from autourgos_local_memory import SQLiteMemory
memory = SQLiteMemory(
db_path="./data/agent.db",
max_messages=500, # None for unlimited
)
agent = ReactAgent(llm=my_llm, memory=memory)
Use ":memory:" for an ephemeral in-process database (useful for tests):
memory = SQLiteMemory(db_path=":memory:")
Parameters
LocalShortTermMemory
| Parameter | Type | Default | Description |
|---|---|---|---|
file_path |
str | "./data/local_memory.json" |
Path to JSON file. Created if missing. |
max_messages |
int | 20 |
Rolling cap — oldest pruned on each write. |
name |
str | "local" |
Human-readable identifier. |
lock_timeout_seconds |
float | 10.0 |
Seconds to wait for file lock. |
SQLiteMemory
| Parameter | Type | Default | Description |
|---|---|---|---|
db_path |
str | "./data/autourgos_memory.db" |
Path to .db file. ":memory:" for ephemeral. |
max_messages |
int or None | 500 |
Rolling cap. None = unlimited. |
name |
str | "sqlite" |
Human-readable identifier. |
Links
- PyPI: https://pypi.org/project/autourgos-local-memory/
- GitHub: https://github.com/devxjitin/autourgos-local-memory
- Issues: https://github.com/devxjitin/autourgos-local-memory/issues
License
MIT — see LICENSE
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file autourgos_local_memory-1.0.0.tar.gz.
File metadata
- Download URL: autourgos_local_memory-1.0.0.tar.gz
- Upload date:
- Size: 7.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
29fcff849eccb2313b6afbae2adde77e8ec65cef479a372e5366d4eddd1c332a
|
|
| MD5 |
c2aac8a812548cb0977f19d2d15eb375
|
|
| BLAKE2b-256 |
0e8344dd0e6a7fab4cde4b8f4f11245b2d944bbe7805d39887bf7d0a96f23919
|
File details
Details for the file autourgos_local_memory-1.0.0-py3-none-any.whl.
File metadata
- Download URL: autourgos_local_memory-1.0.0-py3-none-any.whl
- Upload date:
- Size: 8.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b26ca6ae7c05ece921021f714874f42034df37873cb2a427ea8eae381147bf3e
|
|
| MD5 |
371fecb598d74f9af21aeee65f01338d
|
|
| BLAKE2b-256 |
0c1fc820fd232279c62e55973c91fb9a0924c99f192c1d4f72d9b891ee0a3727
|