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.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-buffer-memory 2.2.0
File Size Uploaded
autourgos_buffer_memory-2.2.0.tar.gz 17.2 kB Details

Built distribution (wheel)

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

Total release size: 31.8 kB

Release files / autourgos_buffer_memory-2.2.0.tar.gz

Download URL autourgos_buffer_memory-2.2.0.tar.gz
Size 17.2 kB
Tags Source
SHA-256 checksum
How to use checksums
16d2181e236ae24945c055e6a5c559cd2a71bb48415511c029a6983781a3c16a
BLAKE2b-256 checksum
How to use checksums
021b7c6316bf9a52f57d8c47d1c9854301aa577fb71e0e025c8f9adfd2b5f1c8
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.2.0-py3-none-any.whl

Download URL autourgos_buffer_memory-2.2.0-py3-none-any.whl
Size 14.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
de8faaf8c3799c2d74e8bbe71272a7dfa09c1b4d86616c1e05d1b8b2b011220c
BLAKE2b-256 checksum
How to use checksums
2ea17a730636540ca85fa91778f7695e2b73eb94289bc3ced16bd6330b94a611
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