Patterns.

Recipes for using user_id and search_user_id together. These are patterns you implement in your app — they're not modes you configure in AgentLoop. The two fields are independent; mix and match based on how you want logging and retrieval to behave for your users.

Shared knowledge (default)

When: internal support assistant, FAQ bot, or any agent where every end-user benefits from every other end-user's corrections.
Behavior: logs are tagged by end-user (so you can audit who triggered which review), but retrieval is org-wide.
python
agentloop={
    "user_id": user.id,    # log only — retrieval stays org-wide
}

Per-user personalization

When: end-user-facing apps where each user has personal preferences or corrections that shouldn't apply to other users. Example: a personal assistant where Alice's "I prefer concise answers" shouldn't change Bob's results.
Behavior: both logging and retrieval are scoped to the same end-user identifier — each user effectively has their own memory pool.
python
agentloop={
    "user_id": user.id,
    "search_user_id": user.id,    # retrieval scoped to this user
}
Note

This partitions end-users within your AgentLoop org. Separation between different AgentLoop customers (orgs) is already enforced at the database level via org_id — you don't need to do anything for that.

Admin reviewing a user's session

When: a support engineer impersonates an end-user to debug a session, or an ops dashboard surfaces "what would the agent say to this user right now."
Behavior: log the turn under the admin (so audit trails reflect who actually made the call), but retrieve from the user's pool (so the answer matches what the user would see).
python
agentloop={
    "user_id": admin.id,                  # audit: this came from the admin
    "search_user_id": user.id,            # context: what would the user see
    "tags": ["admin_review"],
}

Workspace memory with per-seat audit

When: a team-level assistant. The team shares a knowledge base, but you want to know which seat triggered each review.
Behavior: log under the individual user, retrieve from the workspace.
python
agentloop={
    "user_id": user.id,                   # who clicked
    "search_user_id": workspace.id,       # what knowledge to draw on
}
Rule of thumb

If you can't articulate why user_id and search_user_id should differ, leave search_user_id off. The default (log-tagged, org-wide retrieval) is what most apps want, and it's the only mode where new users benefit from the corrections existing users have already made.