Skip to main content
Archived

This project has been archived by its maintainers, and is no longer receiving any updates.

autourgos-local-memory

Framework: Autourgos Python License: Apache 2.0 Author Contributor Contributor

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 lock
  • SQLiteMemory — WAL-mode SQLite, safer than JSON under concurrent writes, efficient for large histories
  • Both implement autourgos_memory.BaseMemory — drop-in for Agent(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.2.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 autourgos-local-memory 2.2.0
File Size Uploaded
autourgos_local_memory-2.2.0.tar.gz 18.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for autourgos-local-memory 2.2.0
File Interpreter ABI Platform
autourgos_local_memory-2.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 33.8 kB

Release files / autourgos_local_memory-2.2.0.tar.gz

Download URL autourgos_local_memory-2.2.0.tar.gz
Size 18.3 kB
Tags Source
SHA-256 checksum
How to use checksums
70137ac6c6a24fb151b8ef2fe6f769a977d5db3a30b0dcdc38f6c56d516caa6c
BLAKE2b-256 checksum
How to use checksums
092652bacd9fb34e899ba8eaa29bbeb6cb0df2732d170c0a64650eaf22ef3880
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.2.0-py3-none-any.whl

Download URL autourgos_local_memory-2.2.0-py3-none-any.whl
Size 15.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bd4690e8dcbf76e1b63f9f440e2ac6847766a1a9a831926ba8bb3f52835bb8b1
BLAKE2b-256 checksum
How to use checksums
c723a1c74c6b11f4ba002c2cf59989486ba07e31a45097f301fa28f46b95cb6a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.9
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