Skip to main content
When the same person uses your agent on both Telegram and Discord, they appear as two different users with separate memory stores. Identity resolution merges these into a single canonical identity, so the agent remembers context across platforms.

How It Works

The IdentityResolver maps (platform, platform_user_id) pairs to a single canonical_user_id. This canonical ID is then used for memory scoping, so all platforms share the same memory store.

Quick Example

IdentityResolver Protocol

Any identity resolver must implement:

SQLiteIdentityResolver

The built-in implementation uses SQLite for persistence:
str
default:"./identity.db"
Path to the SQLite database file. Created automatically.
Supports async context manager:

PlatformIdentity

The get_identities() method returns PlatformIdentity objects:

Integration with BaseInterface

Pass identity_resolver when creating any interface:
When a message arrives, the interface calls resolver.resolve(platform, platform_user_id) before creating the agent session. If a canonical ID is found, it’s used as the user_id for memory and session scoping.

Integration with serve()

When using serve() for multi-interface deployments, pass the resolver once and it propagates to all interfaces: