Skip to main content

In-memory short-term buffer for Autourgos agents — RuntimeShortTermMemory, ConversationBufferMemory.

Project description

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

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

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)

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

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_buffer_memory-1.0.0.tar.gz (5.1 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-1.0.0-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: autourgos_buffer_memory-1.0.0.tar.gz
  • Upload date:
  • Size: 5.1 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-1.0.0.tar.gz
Algorithm Hash digest
SHA256 4cb1b60e8ff07d889e6262281028023170128d943bab573d4be90f9cca8fe2c2
MD5 e6ffa13bc56e71ebe795c1ad2a8831e2
BLAKE2b-256 f69b5daafac7fba6b9452144be0d965228dfa05acc2a2d1501e945f20a637210

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for autourgos_buffer_memory-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 496d8660bc8e8935ccf088aaac1207993ef9cb4149db7a63a7ec92513d37474c
MD5 c721e518ef8f0e15bb392c258845b8fe
BLAKE2b-256 099e20b81eae721848428f66d4aa3479b17592fafd1959b79f3cad7131fdd24d

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