Understand what counts toward your MemLayer plan limits, how to check your usage, and what happens when you hit a limit.
MemLayer enforces two types of limits: memory count (the total number of memories stored in your account) and daily request count (the number of API calls made in a rolling 24-hour window). Understanding how each limit works helps you design agents that stay within budget and degrade gracefully when limits are approached.
Each successful call to remember() (SDK) or POST /memories (REST) that stores a new memory counts as one memory toward your plan’s total.
Free
500 memories total
Pro
50,000 memories total
Enterprise
Unlimited memories
What counts: a memory that is successfully written to storage.What does NOT count: duplicate memories that MemLayer detects and skips (deduplication is handled automatically — you are not charged a memory slot for a no-op write).Memory count is cumulative and does not reset on a schedule. To free up space, you must explicitly delete memories — see Freeing Up Space below.
When your account reaches its memory count limit, any further remember() call will be rejected.
SDK: raises a PlanLimitError exception
REST API: returns HTTP 402 Payment Required
All other operations — recall(), context(), list(), and forget() — continue to work normally. Hitting the memory limit never prevents you from reading or deleting existing memories.Handling PlanLimitError in your agent:
from memlayer import MemLayer, PlanLimitErrorclient = MemLayer(api_key="ml_live_xxx")try: client.remember( user_id="user_42", agent_id="support-bot", content="User prefers email over SMS for notifications." )except PlanLimitError: # Memory limit reached — prompt the user to upgrade # or free up space before retrying print("Memory limit reached. Visit memlayer.online to upgrade your plan.")
Catching PlanLimitError and surfacing a friendly message (rather than letting it propagate) keeps your agent experience smooth even when a limit is hit.
page.total reflects the count of memories matching the supplied user_id and agent_id pair. To get an account-wide total, omit the filters or aggregate across all pairs.You can also view your live usage at any time from the Billing section of your dashboard at memlayer.online.
For memories that capture temporary context — a session summary, a short-term preference, or a one-off instruction — use the ttl_days parameter when storing. Memories with a TTL expire automatically and free up your memory slot without any manual cleanup.
client.remember( user_id="user_42", agent_id="support-bot", content="User is in the middle of a refund request for order #8821.", ttl_days=7 # Auto-expires after 7 days)
Using TTL for ephemeral data keeps your memory count lean and ensures stale context never surfaces in future recall() or context() calls.