Observability and debugging for AI agent memory systems
Project description
MemoryLens
Observability and debugging for AI agent memory systems.
MemoryLens instruments the memory pipeline in your AI agents — write, read, compress, update — and gives you full visibility into what's happening. No more guessing why your agent "forgot" something.
Install
pip install memorylens
# With framework integrations
pip install memorylens[langchain]
pip install memorylens[mem0]
Quick Start
import memorylens
from memorylens import instrument_write, instrument_read, context
# Initialize (defaults to local SQLite storage)
memorylens.init()
# Decorate your memory functions
@instrument_write(backend="my_db")
def store(content: str) -> bool:
# your existing code
return True
@instrument_read(backend="my_db")
def search(query: str) -> list[str]:
# your existing code
return ["result"]
# Add context for session tracking
with context(agent_id="support-bot", session_id="sess-123", user_id="user-456"):
store("user prefers vegetarian meals")
results = search("dietary preferences")
# Inspect with the CLI
# memorylens traces list
# memorylens traces show <trace-id>
Auto-Instrumentation
For supported frameworks, zero code changes required:
import memorylens
memorylens.init(instrument=["langchain", "mem0"])
# All memory operations are now traced automatically
CLI
memorylens init # Set up local storage
memorylens traces list # List recent traces
memorylens traces list --status error # Filter by status
memorylens traces show <trace-id> # Inspect a trace
memorylens traces export -o traces.jsonl # Export as JSONL
memorylens stats # Summary statistics
OTLP Export
Send traces to any OpenTelemetry-compatible backend:
memorylens.init(
exporter="otlp",
otlp_endpoint="http://localhost:4317",
)
Or use environment variables:
export OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317
export OTEL_SERVICE_NAME=my-agent
Community Integrations
Want to add support for a new memory framework? See the Instrumentation Spec v1 for the protocol, required span attributes, implementation patterns, and a complete working example.
Validate your integration with:
memorylens validate integration my_package.instrumentor
License
Apache 2.0
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file memorylens-0.1.0.tar.gz.
File metadata
- Download URL: memorylens-0.1.0.tar.gz
- Upload date:
- Size: 14.7 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5f9795bf5aff0c16e3ca17ae7081c8b01e758dd9201055fd694b50ed9304cec2
|
|
| MD5 |
08c0b46e575ba42025c699f639735191
|
|
| BLAKE2b-256 |
85845c54a3652bfaa04da049cd06b029fa269ed5457a398a79a751cc7fb178aa
|
File details
Details for the file memorylens-0.1.0-py3-none-any.whl.
File metadata
- Download URL: memorylens-0.1.0-py3-none-any.whl
- Upload date:
- Size: 106.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
70419761d2826d5077b70e52c64b083cb542da9cb92950df7da905d0f0b665ef
|
|
| MD5 |
7798e0a9bef25d39ae7612beaac4adbf
|
|
| BLAKE2b-256 |
ccd624c3be8223b29243b290a52b8142eb0200f3b2371ed04b5d8a50edec2075
|