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:")
SQLiteMemory supports the context-manager protocol, closing its connection automatically:
with SQLiteMemory(db_path="./data/agent.db") as memory:
agent = Agent(llm=my_llm, memory=memory)
agent.invoke("Hello!")
# connection is closed here automatically
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.1.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.1.2.tar.gz | 18.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| autourgos_local_memory-2.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 34.0 kB
Release files / autourgos_local_memory-2.1.2.tar.gz
| Download URL | autourgos_local_memory-2.1.2.tar.gz |
|---|---|
| Size | 18.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9aa15d3f0f3b0324f6ab355da6e95331bf63079683487a7b0dc314af685793a9
|
|
BLAKE2b-256 checksum How to use checksums |
de4ef81caae213ba8a02f82efa681651dae2eee940d92b9799b705b559016932
|
| 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.1.2-py3-none-any.whl
| Download URL | autourgos_local_memory-2.1.2-py3-none-any.whl |
|---|---|
| Size | 15.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
861bf4f7ef46e9d8faef39623a1eb8a65a64b50f3b11aed6bcb62550b718efc2
|
|
BLAKE2b-256 checksum How to use checksums |
a72d4262adb4723d5faae75e35001bf8dbfad5cf166de1e1c0523173c120622b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.9
|