Skip to main content

LLM-compressed rolling summary memory for Autourgos agents — SummaryBufferedMemory.

Project description

autourgos-summary-memory

LLM-compressed rolling summary memory for Autourgos agents.

Keeps the last N messages in full. When the buffer overflows, older messages are fed to an LLM for compression and merged into a rolling summary. The summary + recent messages are both included in every LLM prompt.


Install

pip install autourgos-summary-memory

Quick Start

from autourgos_summary_memory import SummaryBufferedMemory
from autourgos_openaichat import OpenAIChatModel
from autourgos_react_agent import ReactAgent

# Use a cheap model for summarization
summarizer_llm = OpenAIChatModel(model="gpt-4o-mini")  # needs OPENAI_API_KEY set
my_llm = summarizer_llm  # or any other chat-model instance for the main agent

memory = SummaryBufferedMemory(
    llm=summarizer_llm,
    max_messages=10,   # keep last 10 messages in full; compress the rest
)
agent = ReactAgent(llm=my_llm, memory=memory)
agent.invoke("Start a long research task...")

Without an LLM

If no LLM is provided, overflow messages are concatenated verbatim (no AI compression). Still prevents unbounded growth:

memory = SummaryBufferedMemory(max_messages=10)

Parameters

Parameter Type Default Description
llm any None LLM with .invoke(prompt). Falls back to raw concat if not set.
max_messages int 10 Recent messages kept in full before compression triggers.
moving_summary str "" Seed summary to start with (optional).

What format_for_llm returns

--- Summary of Past Conversation ---
[compressed history here]
------------------------------------

--- Recent Conversation Context ---
[2024-...] user: latest messages
[2024-...] agent: in full
-----------------------------------

Pair with autourgos-summarizer

For scratchpad compression (not memory), see autourgos-summarizer — it compresses the agent's reasoning chain, not the conversation history.


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_summary_memory-2.0.1.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

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

autourgos_summary_memory-2.0.1-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file autourgos_summary_memory-2.0.1.tar.gz.

File metadata

  • Download URL: autourgos_summary_memory-2.0.1.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for autourgos_summary_memory-2.0.1.tar.gz
Algorithm Hash digest
SHA256 2355b2a957e30ac2fd7413921015ba17f994369257b23ada2cf6c0cda0b8ab0a
MD5 618aeacc4e578fde4a6ace6c2d3553e0
BLAKE2b-256 f0bf7088d1a982736dad72c056f9f6cc32bf93bf8a877314a47def71803e3e89

See more details on using hashes here.

File details

Details for the file autourgos_summary_memory-2.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for autourgos_summary_memory-2.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 465981b01f3fb39383b0b0cddbe6ce0cbca75975740e9381c3c0e896702115d8
MD5 ba23730e1ce5bb09ae1ca06cf6f0a82d
BLAKE2b-256 fdbd652949000d00f6a9fff0ab784e0571602a429be74d4d510c2135b0976fbf

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