Skip to main content

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


License

MIT — see LICENSE

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

autourgos_local_memory-1.0.0.tar.gz (7.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

autourgos_local_memory-1.0.0-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

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

Hashes for autourgos_local_memory-1.0.0.tar.gz
Algorithm Hash digest
SHA256 29fcff849eccb2313b6afbae2adde77e8ec65cef479a372e5366d4eddd1c332a
MD5 c2aac8a812548cb0977f19d2d15eb375
BLAKE2b-256 0e8344dd0e6a7fab4cde4b8f4f11245b2d944bbe7805d39887bf7d0a96f23919

See more details on using hashes here.

File details

Details for the file autourgos_local_memory-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for autourgos_local_memory-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b26ca6ae7c05ece921021f714874f42034df37873cb2a427ea8eae381147bf3e
MD5 371fecb598d74f9af21aeee65f01338d
BLAKE2b-256 0c1fc820fd232279c62e55973c91fb9a0924c99f192c1d4f72d9b891ee0a3727

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page