Skip to main content
Archived

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

autourgos-buffer-memory

Framework: Autourgos Python License: Apache 2.0 Author Contributor Contributor

In-memory short-term buffer for Autourgos agents. Three classes — a message-count bounded ring buffer, an unbounded conversation buffer, and a TTL-expiring buffer. Fast, zero I/O, ideal for single-session use.

from autourgos_buffer_memory import RuntimeShortTermMemory
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)

agent.invoke("My name is Jitin")
agent.invoke("What is my name?")
# → "Your name is Jitin."

Features

  • RuntimeShortTermMemory — keeps the last N messages in RAM, oldest dropped when the cap is exceeded
  • ConversationBufferMemory — same shape, no truncation, keeps every message for the session
  • ExpiringBufferMemory — messages carry a time-to-live and are purged once expired; for a long-running/background agent's temporary, run-scoped facts that shouldn't outlive the run
  • Implements autourgos_memory.BaseMemory — drop-in for Agent(memory=...)
  • Zero I/O, fastest option in the memory family

Table of Contents


Install

pip install autourgos-buffer-memory

Classes

RuntimeShortTermMemory

Keeps the last N messages in RAM. Oldest messages are dropped when the cap is exceeded.

from autourgos_buffer_memory import RuntimeShortTermMemory
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)

agent.invoke("My name is Jitin")
agent.invoke("What is my name?")
# → "Your name is Jitin."

ConversationBufferMemory

Same as RuntimeShortTermMemory but with no truncation — keeps every message for the session.

from autourgos_buffer_memory import ConversationBufferMemory

memory = ConversationBufferMemory()
agent  = Agent(llm=my_llm, memory=memory)

For long conversations, use autourgos-summary-memory or autourgos-token-memory to stay within context window limits.

ExpiringBufferMemory

Each message carries a time-to-live; expired messages are purged automatically (lazily, on the next add/read — no background thread) and never appear in get_messages()/format_for_llm(). Meant for a long-running or background agent's temporary, run-scoped facts — worth remembering for the next few minutes or hours of a task, but that shouldn't silently persist the way an unbounded buffer would.

from autourgos_buffer_memory import ExpiringBufferMemory

memory = ExpiringBufferMemory(default_ttl_seconds=3600)  # 1 hour default
agent  = Agent(llm=my_llm, memory=memory)

memory.add_user_message("Skip the venv folder for this run.")          # expires in 1 hour
memory.add_user_message("The deploy target is us-east-1.", ttl_seconds=None)  # never expires

Pass ttl_seconds= to any add_*_message() call to override default_ttl_seconds for that one message; ttl_seconds=None (explicit) makes that message permanent even with a default TTL set.


Parameters

RuntimeShortTermMemory

Parameter Type Default Description
max_messages int 20 Max messages kept. Oldest dropped when exceeded.
name str "runtime" Human-readable identifier.

ConversationBufferMemory

Parameter Type Default Description
name str "conversation" Human-readable identifier.

ExpiringBufferMemory

Parameter Type Default Description
default_ttl_seconds float, optional None Applied when a message doesn't pass its own ttl_seconds. None = messages never expire unless given a per-call TTL.
max_messages int, optional None Ring-buffer cap on live (non-expired) messages. None = unbounded.
name str "expiring" Human-readable identifier.

API

memory.add_user_message("Hello")
memory.add_agent_message("Hi there!")
memory.add_tool_message("search", "Found 5 results")
memory.add_system_message("You are a helpful assistant")

messages = memory.get_messages()   # list of role/content dicts
context  = memory.format_for_llm() # formatted string for LLM prompt
memory.clear()

License

Apache License 2.0, Copyright (c) 2026 Jitin Kumar Sengar

Metadata

Release files for autourgos-buffer-memory 2.1.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-buffer-memory 2.1.0
File Size Uploaded
autourgos_buffer_memory-2.1.0.tar.gz 17.2 kB Details

Built distribution (wheel)

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

Total release size: 31.8 kB

Release files / autourgos_buffer_memory-2.1.0.tar.gz

Download URL autourgos_buffer_memory-2.1.0.tar.gz
Size 17.2 kB
Tags Source
SHA-256 checksum
How to use checksums
9bdfc169474bbb8b931b1e08873f53f0f5b6aa8fe412751c6a6cf82a5ca9f7c9
BLAKE2b-256 checksum
How to use checksums
5b1f09b1bde476a0fb7b44b21e21546658234f0b3fe526637d8c0cd63333ec62
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.9

Release files / autourgos_buffer_memory-2.1.0-py3-none-any.whl

Download URL autourgos_buffer_memory-2.1.0-py3-none-any.whl
Size 14.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
73867907b760b8ada809aa578a32e1c5b08ed333062425ae10503e0fac595c55
BLAKE2b-256 checksum
How to use checksums
45b19688b79fa4bcbea31e1f4d43eb0fc37a06bcfa5c1d061e4192e3e8abcc60
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