Skip to content

[Feature]: Add support for multi-user / multi-agent / multi-run recording #51

@Boburmirzo

Description

@Boburmirzo

Add support for multi-user / multi-agent / multi-run recording

Background

Memori currently supports recording only for a single user. While namespaces exist today, they serve other purposes and shouldn’t be overloaded for user handling.

To make Memori more flexible (for teams, experiments, and multi-agent setups), we should introduce optional identifiers for namespace, agent_id, user_id, and run_id.

Proposal

Extend the storage and SDK to allow passing these IDs as optional scoping keys:

  • namespace → optional logical grouping (e.g., environment, tenant, app)
  • agent_id → optional identifier for the AI agent
  • user_id → optional identifier for the end user
  • run_id → optional identifier for a specific execution / workflow run

If not provided, defaults should apply (e.g., default_namespace, default_agent, default_user, default_run).

Example (Python SDK)

mem = Memori(
    namespace="prod",         # optional
    agent_id="shopping_bot",  # optional
    user_id="user_123",       # optional
    run_id="run_456",         # optional
)

mem.record_message(role="user", content="Hi")
mem.record_message(role="assistant", content="Hello!")

history = mem.get_history(user_id="user_123", run_id="run_456")

user_id is more critical to provide one user -> one memory. Under the hood, Memori can manage this with the users table inside one database.

Acceptance Criteria

  • Support namespace, agent_id, user_id, run_id as optional fields in SDK and storage
  • Defaults apply when not provided (backward-compatible)
  • Queries are scoped by any provided combination of these IDs
  • Ensure no cross-leakage between different values
  • Documentation updated with examples

Why

  • Enables multi-user scenarios without breaking single-user apps
  • Adds flexibility for multi-agent systems and multi-run experiments
  • Keeps backward compatibility by making all fields optional

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions