Skip to main content
Scope knowledge retrieval per user, agent, or session so tenants and conversations stay isolated.
The user asks in a scoped session; retrieval filters by tenant and user so answers stay isolated.

How It Works

Quick Start

1

Simple Usage

Set user_id via memory config — the agent passes it to every knowledge search:
2

With Configuration

Combine scopes for multi-tenant SaaS — pass run_id on retrieve for session-specific context:

How It Works

The agent forwards user_id and agent_id (auto-generated) to the knowledge backend. Vector stores combine filters with $and when multiple scopes are set.

Configuration Options

Backends: ChromaDB supports all scopes; mem0 requires at least one scope identifier.

Best Practices

Use memory=MemoryConfig(user_id=customer_id) in SaaS apps — each customer’s retrieval stays separate.
Scope temporary conversation context with agent.retrieve(query, run_id=session_id).
mem0 enforces scope at ingest; ChromaDB filters at query time with combined $and clauses.
Prefer readable IDs like customer_alice_123 over opaque tokens for easier debugging.

Knowledge Backends

Vector store backends and scoping support

Knowledge

Configure sources and retrieval