closedhumanPR #81Memory

/tani-decaying-memory

I have implemented a new plugin for Layer 10 (Memory) called DecayingMemory. This introduces a Time-To-Live (TTL) mechanism to agent memory, allowing for "biological-inspired forgetting" within the Nanda Town simulator.

Author

tanishaacodes avatar

@tanishaacodes

github profile →
Status
Closed without merging
Opened on
Jul 7
Branch
hackathon/tani-decaying-memory

Description

The pitch.

### Overview
I have implemented a new plugin for **Layer 10 (Memory)** called **DecayingMemory.** This introduces a **Time-To-Live (TTL)** mechanism to agent memory, allowing for "biological-inspired forgetting" within the Nanda Town simulator.
### Problem 
In high-density scenarios like the Kumbh Mela, agents are flooded with real-time data (crowd density, vendor prices, resource locations). If an agent remembers every update forever, its context window becomes bloated with stale, irrelevant information, leading to slow processing and incorrect decision-making based on outdated facts.
### Solution: Layer 10 Decaying Memory
My implementation ensures that:
Every memory entry is timestamped upon storage (put).
When an agent retrieves data (get), the system checks if the time elapsed exceeds the ttl_seconds.
Stale data is automatically deleted and returns None, forcing the agent to fetch fresh data from the network/discovery layer.
### Technical Implementation & Compatibility
Interface Fit:I implemented  the nest_sdk.Memory abstract base class.
Python 3.14 Support: Fixed pyproject.toml issues (removed deprecated license classifiers and added explicit package discovery) to ensure compatibility with the latest Python versions and uv build systems.
Registration: Registered via [project.entry-points."nest.plugins.memory"] as decaying.
### Testing 
I have included a test_memory.py script. The results show the protocol working exactly as intended:
code
--- Starting Test ---
Immediate check: crowded
Waiting 3 seconds for memory to decay...
After 3s check: None
--- Test Passed ---
### How to verify
Run uv sync or pip install -e .
Run uv run python test_memory.py
Optionally, use it in a scenario by setting memory: decaying in a .yaml config.

Try it

Open PR on GitHubView diff

Checkout locally

git fetch origin pull/81/head:pr-81
git checkout pr-81