This project has been archived by its maintainers, and is no longer receiving any updates.
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.
from autourgos_local_memory import SQLiteMemory
from autourgos_agent import Agent
from autourgos_openaichat import OpenAIChatModel
my_llm = OpenAIChatModel(model="gpt-4o-mini")
memory = SQLiteMemory(db_path="./data/agent.db", max_messages=500)
agent = Agent(llm=my_llm, memory=memory)
Features
LocalShortTermMemory— JSON file, atomic write (tmp → replace), file-level lockSQLiteMemory— WAL-mode SQLite, safer than JSON under concurrent writes, efficient for large histories- Both implement
autourgos_memory.BaseMemory— drop-in forAgent(memory=...) ":memory:"for an ephemeral in-process SQLite database (useful for tests)
Table of Contents
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_agent import Agent
from autourgos_openaichat import OpenAIChatModel
my_llm = OpenAIChatModel(model="gpt-4o-mini")
memory = LocalShortTermMemory(file_path="./data/session.json", max_messages=50)
agent = Agent(llm=my_llm, memory=memory)
agent.invoke("Remember: my project deadline is Friday")
# Next session — history is loaded from disk automatically
agent2 = Agent(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 = Agent(llm=my_llm, memory=memory)
Use ":memory:" for an ephemeral in-process database:
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.
License
Apache License 2.0, Copyright (c) 2026 Jitin Kumar Sengar
Metadata
Release files for autourgos-local-memory 2.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| autourgos_local_memory-2.0.2.tar.gz | 17.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| autourgos_local_memory-2.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 32.8 kB
Release files / autourgos_local_memory-2.0.2.tar.gz
| Download URL | autourgos_local_memory-2.0.2.tar.gz |
|---|---|
| Size | 17.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
77ae25ebad608db0c790c740aaf20b7b5da6ca94f7d1c36061a33f2f3059e548
|
|
BLAKE2b-256 checksum How to use checksums |
103208751b39358efb6cbbaf4b671f34fd1f9ca3bc5068f86a237fba5f2f2739
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.9
|
Release files / autourgos_local_memory-2.0.2-py3-none-any.whl
| Download URL | autourgos_local_memory-2.0.2-py3-none-any.whl |
|---|---|
| Size | 15.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e7470cf7cc9744c43888a4bbccc524ee16ee189b14a4c4624fbee3d8652dcff1
|
|
BLAKE2b-256 checksum How to use checksums |
6377b5d6960f659fd954630653027a2cda83d62d18c41794e10c4ae36be07464
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.9
|