venkateshannabathina/agent-memory-compressor
๐ง Agent Memory Compressor
An OpenEnv reinforcement learning environment that trains AI agents to compress bloated conversation histories while preserving critical facts, avoiding hallucinations, and resolving contradictions.
Motivation
AI agents in production break down as conversations grow long. They lose track of key facts, get confused by contradictions across sessions, and eventually exceed their context window. This environment simulates that exact problem โ giving agents a real memory dump and challenging them to compress it intelligently. Every decision (what to keep, what to cut, what to resolve) is scored automatically.
ex:- The goal is to compress a long conversation into the shortest possible memory that still tells the full story. Like turning "Venky left home at 8:30am, took the bus, reached school by 9:00am, attended all classes, had lunch at 1pm, finished at 5:00pm and went home" into just "Venky: school 9amโ5pm." Same information, fraction of the size. ---
Environment Overview
Observation Space
Returned by /reset. Contains everything the agent needs to attempt compression.
Action Space
Submitted to /step. The agent's compressed response.
Reward Function
Scores are computed deterministically by grader.py.
Final score is clamped between 0.0 and 1.0.
Tasks
Easy โ Subscription Cancellation
A customer support conversation where a user wants to cancel their Pro subscription. The agent must extract the key facts (email, deadline, intent) and compress the conversation tightly.
- Token budget: 150
- Key facts: 3
- Hallucination traps: 2
Medium โ API Debugging Session
A technical troubleshooting conversation about a broken API integration. The root cause is buried deep in the conversation. The agent must identify it and preserve it without getting distracted by noise.
- Token budget: 200
- Key facts: 4
- Hallucination traps: 3
Hard โ Multi-session Address Conflict
A conversation spanning multiple sessions where the user's delivery address changes and contradicts earlier sessions. The agent must identify the conflict, resolve it, and produce a clean compressed memory.
- Token budget: 180
- Key facts: 3
- Hallucination traps: 2
- Conflicts to resolve: 1
Inference Scores
Inference run using LLM via compatible API.
API Endpoints
Setup & Usage
Local
git clone https://huggingface.co/spaces/venkateshannabathina/agent-memory-compressor
cd agent-memory-compressor
pip install -r requirements.txt
uvicorn app.main:app --host 0.0.0.0 --port 7860Docker
docker build -t agent-memory-compressor .
docker run -p 7860:7860 \
-e HF_TOKEN=your_key \
-e API_BASE_URL=https://api.groq.com/openai/v1 \
agent-memory-compressorEnvironment Variables
Running Inference
python inference.pyProject Structure
agent_memory_compressor/
โโโ app/
โ โโโ main.py # FastAPI server and endpoints
โ โโโ env.py # Environment logic (reset, step, state)
โ โโโ grader.py # Scoring engine
โ โโโ dataset.py # Raw memory dumps and gold standards
โ โโโ tasks.py # Public task catalog
โ โโโ models.py # Pydantic data models
โโโ server/
โ โโโ app.py # Entry point for openenv
โโโ inference.py # Inference script
โโโ Dockerfile
โโโ requirements.txt
โโโ openenv.yamlBuilt With
Built for the Meta x Scaler OpenEnv Hackathon 2026 by Venkatesh Annabathina,praneeth,aryashi.
