Skip to content

Multi-Tenant Setup

Isolate memory per customer using domains. No infrastructure changes needed.

How It Works

Every Mnemoverse API call accepts a domain parameter. Use it to scope memories per tenant:

python
from mnemoverse import MnemoClient

client = MnemoClient(api_key="mk_live_YOUR_KEY")

# Tenant A — support conversation
client.write(
    "Customer uses PostgreSQL, migrating from MySQL",
    concepts=["database", "migration"],
    domain="tenant:customer-a",
)

# Tenant B — different customer, separate memory
client.write(
    "Customer prefers weekly reports via email",
    concepts=["reports", "email"],
    domain="tenant:customer-b",
)

Reading With Isolation

When reading, specify the domain. Only memories from that domain are returned:

python
# Only gets Customer A's memories
memories = client.read(
    "What database does this customer use?",
    domain="tenant:customer-a",
)
# → "Customer uses PostgreSQL, migrating from MySQL"

# Customer B's memories are invisible
memories = client.read(
    "What database does this customer use?",
    domain="tenant:customer-b",
)
# → No results about PostgreSQL

Domain Naming Convention

We recommend this naming pattern:

ScopeDomain PatternExample
Per customertenant:{customer_id}tenant:acme-corp
Per useruser:{user_id}user:[email protected]
Per projectproject:{project_id}project:website-redesign
Shared knowledgeshared:{category}shared:product-docs
Agent-specificagent:{agent_name}agent:support-bot

Hierarchical Reading

An agent can read from multiple domains in priority order:

python
# Check tenant-specific first, then shared knowledge
tenant_memories = client.read(query, domain="tenant:acme-corp")

if not tenant_memories.items:
    # Fall back to shared product knowledge
    shared_memories = client.read(query, domain="shared:product-docs")

MCP Server With Tenants

When using the MCP server, set the domain via environment variable:

json
{
  "mcpServers": {
    "mnemoverse": {
      "command": "npx",
      "args": ["-y", "@mnemoverse/mcp-memory-server"],
      "env": {
        "MNEMOVERSE_API_KEY": "mk_live_YOUR_KEY",
        "MNEMOVERSE_DEFAULT_DOMAIN": "tenant:acme-corp"
      }
    }
  }
}

REST API

All endpoints accept domain in the request body:

bash
# Write to specific tenant
curl -X POST https://core.mnemoverse.com/api/v1/memory/write \
  -H "X-Api-Key: mk_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "content": "Customer prefers dark mode",
    "domain": "tenant:customer-123"
  }'

# Read from specific tenant
curl -X POST https://core.mnemoverse.com/api/v1/memory/read \
  -H "X-Api-Key: mk_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "UI preferences",
    "domain": "tenant:customer-123"
  }'

Monitoring

Check how many tenants and memories you have:

bash
curl https://core.mnemoverse.com/api/v1/memory/stats \
  -H "X-Api-Key: mk_live_YOUR_KEY"

Response includes domains list — each unique domain is effectively a tenant.

Limits

PlanMax Domains (Tenants)Atoms per Domain
Free101,000
Pro1,00050,000
TeamUnlimited500,000

Multi-Agent Memory Isolation

The same domain pattern works for isolating memory between agents in complex systems:

python
# Each agent has private working memory
client.write("Identified 3 relevant APIs", domain="agent:researcher")
client.write("Draft ready for review", domain="agent:writer")

# Shared project context — all agents can read
client.write("Deadline is Friday", domain="project:acme")

# Agent reads own memory + shared context
own = client.read("what have I found?", domain="agent:researcher")
shared = client.read("project deadlines", domain="project:acme")

Multi-Agent Architecture

Multi-Agent System
├── agent:planner        ← planning decisions (private)
├── agent:researcher     ← research findings (private)
├── agent:coder          ← code patterns learned (private)
├── agent:reviewer       ← review criteria (private)
├── project:acme         ← shared project context (all agents read)
├── team:engineering     ← shared team knowledge (all agents read)
└── tenant:customer-123  ← customer-specific (isolated from other customers)

Each agent writes to its own domain for private working memory. Shared domains (project:*, team:*) enable coordination. Agent reads in priority order: own → project → team → tenant.

This pattern scales from 2 agents to hundreds without architectural changes. The same API, the same domains.