This project has been archived by its maintainers, and is no longer receiving any updates.
autourgos-buffer-memory
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 exceededConversationBufferMemory— same shape, no truncation, keeps every message for the sessionExpiringBufferMemory— 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 forAgent(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-memoryorautourgos-token-memoryto 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.1
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_buffer_memory-2.1.1.tar.gz | 17.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| autourgos_buffer_memory-2.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 31.9 kB
Release files / autourgos_buffer_memory-2.1.1.tar.gz
| Download URL | autourgos_buffer_memory-2.1.1.tar.gz |
|---|---|
| Size | 17.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
232c74416a1d3807b726441ed5c8b20661c05b6917d586f0ef6a7aa4ec7d58eb
|
|
BLAKE2b-256 checksum How to use checksums |
9f8c36c60096cfc90fc1dc1571937e318ca6575fe6ce563298754c28586fad98
|
| 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.1-py3-none-any.whl
| Download URL | autourgos_buffer_memory-2.1.1-py3-none-any.whl |
|---|---|
| Size | 14.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
65c6a19ee2994b389ac77e0c3c004c89939b83e601bb3cd2dde72a79f89db78e
|
|
BLAKE2b-256 checksum How to use checksums |
92276d87cd32900393f4fa786eee5f5bc19c663c96cc1be033ec393011063c2d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.9
|