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
Quick Start
my_llm below is any chat-model instance, e.g. OpenAIChatModel from autourgos-openaichat (pip install autourgos-openaichat, needs OPENAI_API_KEY set).
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
from autourgos_openaichat import OpenAIChatModel
my_llm = OpenAIChatModel(model="gpt-4o-mini")
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. |
Known limitations
LocalShortTermMemory's file lock is timeout-based (a lock file plus a wait deadline), not an OS-level advisory lock. If one process holds the lock longer than lock_timeout_seconds (e.g. due to slow disk I/O), a second process can end up believing the lock is stale and write concurrently, risking corruption. For high-concurrency multi-process use, prefer SQLiteMemory instead — it uses WAL-mode SQLite, which handles concurrent writers safely without relying on a timeout.
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
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-2.0.1.tar.gz.
File metadata
- Download URL: autourgos_local_memory-2.0.1.tar.gz
- Upload date:
- Size: 7.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
03b182ae796e862cd1bac1dfe780bd0c5caeb21b81a413d0d4ef91a35ce4e254
|
|
| MD5 |
118c3d965f01a9655e3e4ee2fe2fab62
|
|
| BLAKE2b-256 |
206a1e7aab67f18a7b9a7bcf18c34c6654f73cccc084d940f2447d3eaa7fe899
|
File details
Details for the file autourgos_local_memory-2.0.1-py3-none-any.whl.
File metadata
- Download URL: autourgos_local_memory-2.0.1-py3-none-any.whl
- Upload date:
- Size: 7.8 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 |
c6ed3326d3116d739af66af6fec3e758483b5f40530c7fa89a3877762813c8ca
|
|
| MD5 |
ce0b2a30538ac9ce7e80668fcecf2873
|
|
| BLAKE2b-256 |
8e719ead5c0815e5f92af449d4f221ef4668af7fc15aa459f0f40ec5ded3c2d6
|