autourgos-memory
Base memory interfaces for Autourgos agents — the foundation package. It
defines the abstract interfaces (BaseMemory, BaseRetriever, MemoryMessage, Document) that every
concrete memory implementation uses.
from autourgos_memory import RuntimeShortTermMemory # requires autourgos-buffer-memory installed
from autourgos_agent import Agent
from autourgos_openaichat import OpenAIChatModel
my_llm = OpenAIChatModel(model="gpt-4o-mini")
memory = RuntimeShortTermMemory(max_messages=20)
agent = Agent(llm=my_llm, memory=memory)
Features
- Abstract interfaces:
BaseMemory(short-term conversational),BaseRetriever(relevance-scored recall),MemoryMessage,Document - Soft re-exports: concrete backends resolve from
autourgos_memorydirectly if their own package is installed —RuntimeShortTermMemory,ConversationBufferMemory,LocalShortTermMemory,SQLiteMemory,KeywordRetriever,KeywordMemory,SimpleSemanticRetriever,HierarchicalSemanticMemory,SummaryBufferedMemory,TokenBufferedMemory,VectorMemory,VectorRetriever,Episode,EpisodicMemory - Zero required dependencies — install only the concrete backends you actually need
Table of Contents
Install
# Base interfaces only
pip install autourgos-memory
# Or install concrete implementations individually
pip install autourgos-buffer-memory # in-memory ring buffer
pip install autourgos-local-memory # JSON file + SQLite
pip install autourgos-semantic-memory # TF-IDF keyword retrieval
pip install autourgos-summary-memory # LLM-compressed rolling summary
pip install autourgos-token-memory # token-bounded buffer
pip install autourgos-vector-memory # local, provider-agnostic embedding recall
pip install autourgos-episodic-memory # structured task/outcome log
Memory Types at a Glance
| Package | Class | Best for |
|---|---|---|
autourgos-buffer-memory |
RuntimeShortTermMemory |
Fast in-memory buffer, message-count bounded |
autourgos-buffer-memory |
ConversationBufferMemory |
Unbounded in-memory buffer |
autourgos-local-memory |
LocalShortTermMemory |
Disk persistence via JSON file |
autourgos-local-memory |
SQLiteMemory |
Disk persistence via SQLite, concurrent-safe |
autourgos-semantic-memory |
KeywordMemory |
TF-IDF retrieval of relevant past context |
autourgos-summary-memory |
SummaryBufferedMemory |
LLM-compressed history to save tokens |
autourgos-token-memory |
TokenBufferedMemory |
Token-budget bounded buffer |
autourgos-vector-memory |
VectorMemory |
Embedding-based recall (you supply the embedding function) |
autourgos-episodic-memory |
EpisodicMemory |
Structured task/outcome log — what was tried, what happened |
Quick Start
RuntimeShortTermMemory is soft re-exported from autourgos_memory — it only resolves if
autourgos-buffer-memory is also installed:
pip install autourgos-memory autourgos-buffer-memory autourgos-openaichat
from autourgos_memory import RuntimeShortTermMemory
from autourgos_agent import Agent
from autourgos_openaichat import OpenAIChatModel
my_llm = OpenAIChatModel(model="gpt-4o-mini") # needs OPENAI_API_KEY set
memory = RuntimeShortTermMemory(max_messages=20)
agent = Agent(llm=my_llm, memory=memory)
result = agent.invoke("What did I ask you last time?")
Base Interfaces
MemoryMessage
from autourgos_memory import MemoryMessage
from datetime import datetime, timezone
msg = MemoryMessage(role="user", content="Hello", timestamp=datetime.now(timezone.utc))
print(msg.to_dict())
# {"role": "user", "content": "Hello", "timestamp": "2024-..."}
Allowed roles: user, agent, system, tool.
BaseMemory
Implement this to create your own memory backend:
from autourgos_memory import BaseMemory, MemoryMessage
class MyCustomMemory(BaseMemory):
def add_user_message(self, content: str) -> MemoryMessage: ...
def add_agent_message(self, content: str) -> MemoryMessage: ...
def add_tool_message(self, tool_name: str, result: str) -> MemoryMessage: ...
def format_for_llm(self, query: str = None) -> str: ...
def clear(self) -> None: ...
Only add_user_message, add_tool_message, and clear are true @abstractmethods.
add_agent_message and format_for_llm are concrete methods with a deprecation-shim fallback:
each one calls through to an older method name (add_ai_message / get_context respectively)
if your subclass implements that one instead, emitting a DeprecationWarning. This exists
only to keep a memory backend written against the pre-rename API working unchanged — new
backends should implement add_agent_message/format_for_llm directly and can ignore
add_ai_message/get_context entirely.
BaseRetriever
Implement this to plug in your own vector database:
from autourgos_memory import BaseRetriever, Document
class MyVectorDB(BaseRetriever):
def retrieve(self, query: str, top_k: int = 5) -> list[Document]: ...
Document
from autourgos_memory import Document
doc = Document(content="Paris is the capital of France.", score=0.92, source="wiki")
License
Apache License 2.0, Copyright (c) 2026 Jitin Kumar Sengar
Metadata
Release files for autourgos-memory 1.0.9
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_memory-1.0.9.tar.gz | 16.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| autourgos_memory-1.0.9-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 30.7 kB
Release files / autourgos_memory-1.0.9.tar.gz
| Download URL | autourgos_memory-1.0.9.tar.gz |
|---|---|
| Size | 16.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
62b686c10de7078e72231f9ff55c8df070b5bd4c7136a4e517067a70891576c2
|
|
BLAKE2b-256 checksum How to use checksums |
7d638de007732f66df6546b1e3cdbec3c06322e5c284c7eca2bea88e9628355c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.9
|
Release files / autourgos_memory-1.0.9-py3-none-any.whl
| Download URL | autourgos_memory-1.0.9-py3-none-any.whl |
|---|---|
| Size | 14.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5d9d79eafb4c2ba70d0d939c60bdfd1646a36438b60a1438b9046b385b1dd0c7
|
|
BLAKE2b-256 checksum How to use checksums |
b3f8cca3fd987d0c7771605e32ca8f664b5dec5a19752aa8c062305dbb91e3b7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.9
|