Guide

Agent memory in Python, with receipts

Most agent memory is a list of facts, and when two of them disagree the newer one silently wins. This guide sets up memory that works like testimony instead: every belief carries evidence, disagreement stays visible, and anything can answer why.

Install

pip install omem-infrastructure
omem-server

Zero runtime dependencies (CI fails the build if one appears), SQLite by default, works air-gapped. The first run prints your project id and API key.

Remember, and ask why

from omem import Memory
 
mem = Memory(api_key="omem_sk_...", project="proj_...",
base_url="http://127.0.0.1:8787")
 
a = mem.remember("agent:support", "customer:alice", "prefers_annual_billing")
 
mem.believes("customer:alice", "prefers_annual_billing")
# -> "BELIEVED_TRUE"
 
mem.why(a["id"])
# -> who said it, when, its evidence, and anything that contradicts it

Disagreement stays on the record

mem.remember("agent:sales", "customer:alice", "not:prefers_annual_billing")
 
mem.conflicts()
# -> both sides, each with its observations, agents and recency.
# Nothing was overwritten; nothing was decided by timestamp.

Claims named X and not:X are declared mutually exclusive automatically; anything else conflicts only if you declare it. The engine never resolves a disagreement on its own, because arrival order is not evidence.

Take things back, completely

mem.declare_rule(when=[("works_at", "fwd"), ("owns", "rev")],
then=("involves", "rev"))
mem.infer() # concludes from what is believed
 
mem.retract(assertion_id, agent="agent:support")
# the fact is withdrawn, and every conclusion resting on it
# is withdrawn in the same request, cascade included

History survives all of it. Supersede a fact and the old value keeps the interval it was believed; retract one and the record shows what was withdrawn and when. The whole state rebuilds from an append-only log, and omem-verify proves the state follows from the log instead of asserting it.

Where to go next

The quickstart takes this to a running dashboard in about a minute. Using LangGraph? The LangGraph guide plugs this engine into the standard store interface. Using Claude? The MCP guide is one JSON block.