Skip to main content
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.

Memory Count Limits

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.

Request Limits

Every API call — regardless of operation type — counts as one request against your daily quota.
PlanRequests/day
Free100
Pro10,000
EnterpriseUnlimited
Request counts reset daily. If you need higher throughput before your next reset, upgrade your plan at memlayer.online.

What Happens at the Limit

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, PlanLimitError

client = 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.

Checking Your Usage

To see how many memories your agent has stored for a given user, use client.list() and inspect the total field on the returned page object:
from memlayer import MemLayer

client = MemLayer(api_key="ml_live_xxx")

page = client.list(user_id="user_42", agent_id="support-bot")
print(f"Memories stored: {page.total}")
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.

Freeing Up Space

If you are approaching your memory limit, you can delete memories individually or in bulk. Delete a single memory by its ID:
client.forget(memory_id="mem_abc123")
Delete all memories for a specific user/agent pair:
client.forget_all(user_id="user_42", agent_id="support-bot")
forget_all() is irreversible. All memories for the specified user_id / agent_id pair will be permanently deleted. There is no undo.

TTL as a Self-Managing Strategy

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.