Skip to main content

autourgos-buffer-memory

In-memory short-term buffer for Autourgos agents.

Two classes — a message-count bounded ring buffer and an unbounded conversation buffer. Fast, zero I/O, ideal for single-session use.


Install

pip install autourgos-buffer-memory

Quick Start

my_llm below is any chat-model instance, e.g. OpenAIChatModel from autourgos-openaichat (pip install autourgos-openaichat, needs OPENAI_API_KEY set).

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_react_agent import ReactAgent
from autourgos_openaichat import OpenAIChatModel

my_llm = OpenAIChatModel(model="gpt-4o-mini")
memory = RuntimeShortTermMemory(max_messages=20)
agent  = ReactAgent(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  = ReactAgent(llm=my_llm, memory=memory)  # my_llm as shown in Quick Start above

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


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.

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()

Links


License

MIT — see LICENSE

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

autourgos_buffer_memory-2.0.1.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

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

autourgos_buffer_memory-2.0.1-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for autourgos_buffer_memory-2.0.1.tar.gz
Algorithm Hash digest
SHA256 2c9763f0f8eebe69569d5b8c0e517b8372e8462239e529d9e7b45e078002c45b
MD5 599ca01d07381a28aa15e29efe149392
BLAKE2b-256 13c998b2fa908937d142ae55e9c6caa50023e4072baa2ecf4c55ae9694346eac

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for autourgos_buffer_memory-2.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 674eff1559893017e623649e49a1c894727d056256369a409553892cc00868e5
MD5 861b484198707cf51527d4c1b1df3242
BLAKE2b-256 f2e77724f16d320673b93217c3b5757d39468423ac0f2b2f6ce49de26d4d0839

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 Sentry Error logging StatusPage Status page