Skip to main content

autourgos-memory

Framework: Autourgos Python License: Apache 2.0 Author Contributor Contributor

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_memory directly 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 datetime import datetime
from typing import Optional
from autourgos_memory import BaseMemory, MemoryMessage

class MyCustomMemory(BaseMemory):
    def add_message(self, role: str, content: str, timestamp: Optional[datetime] = None) -> MemoryMessage: ...
    def format_for_llm(self, query: str = None) -> str: ...
    def clear(self) -> None: ...

Only add_message, format_for_llm, and clear are true @abstractmethods. add_user_message/add_agent_message/add_system_message/add_tool_message are concrete defaults built on add_message(role, content, timestamp=None) — implement add_message once and every backend gets all four for free. add_agent_message and format_for_llm also carry a deprecation-shim fallback: each 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.

format_conversation_banner / ROLE_TO_OPENAI

Shared helpers for backends implementing format_for_llm/get_messages:

from autourgos_memory import format_conversation_banner, ROLE_TO_OPENAI

format_conversation_banner(messages, include_timestamps=True)
# "\n--- Previous Conversation Context ---\n[2026-...] user: hi\n--------------------------------------\n"

ROLE_TO_OPENAI  # {"user": "user", "agent": "assistant", "system": "system", "tool": "tool"}

RetrievalAugmentedMemory

Base class for a dual-store memory: a short-term buffer (recent turns, always included) plus a BaseRetriever (older, relevant turns, surfaced only when a query is given). This is the shared shape behind autourgos-semantic-memory's KeywordMemory and autourgos-vector-memory's VectorMemory — subclass it, build your own retriever, and pass both to super().__init__():

from autourgos_memory import RetrievalAugmentedMemory

class MyRetrievalMemory(RetrievalAugmentedMemory):
    def __init__(self, my_retriever, short_term=None, top_k=3):
        super().__init__(short_term=short_term or MyShortTermMemory(), retriever=my_retriever, top_k=top_k)

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.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-memory 1.2.0
File Size Uploaded
autourgos_memory-1.2.0.tar.gz 19.5 kB Details

Built distribution (wheel)

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

Total release size: 34.9 kB

Release files / autourgos_memory-1.2.0.tar.gz

Download URL autourgos_memory-1.2.0.tar.gz
Size 19.5 kB
Tags Source
SHA-256 checksum
How to use checksums
2bc7feef0cf700fb48b47d563ba36baaef44658764c71f2121dd7d3a6f7ef525
BLAKE2b-256 checksum
How to use checksums
d08a708a58915b6e67d9efce561c77b491a4150506557b27ac64db502d08e22f
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.2.0-py3-none-any.whl

Download URL autourgos_memory-1.2.0-py3-none-any.whl
Size 15.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
705dec86aa37c1600ff3a0816119832e3b793b7796c08f43f07f270e4d6e4458
BLAKE2b-256 checksum
How to use checksums
8d350562c6e7826cb44e088cd6566a70baedbca3877cd148f8154e8f6c2cde5e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.9

Release history Release notifications | RSS feed

2.1.0

2 release files

2.0.0

2 release files

This release

1.2.0 This release

2 release files

1.0.9

2 release files

1.0.8

2 release files

1.0.7

2 release files

1.0.2

2 release files

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