Skip to content
Cette page a été générée et traduite avec l'aide de l'IA. Si vous remarquez des inexactitudes, n'hésitez pas à contribuer. Modifier sur GitHub

Identity Management

Le systeme d'identite de PRX fournit un cadrage au niveau de l'espace de travail et de l'utilisateur pour toutes les operations d'agent. In multi-tenant deployments, identity context determine which memories, configurations, tools, et resources a given session can access. The identity module is the foundation for access control, journalisation d'audit, et personalization.

Apercu

Chaque session PRX opere dans an identity context that includes:

ComponentDescription
UserL'humain ou le bot interagissant avec l'agent
WorkspaceA logical boundary grouping users, configurations, and data
SessionA single conversation between a user and l'agent
PrincipalThe effective identity for access control decisions
┌─────────────────────────────────────────┐
│              Workspace: "acme"          │
│                                         │
│  ┌──────────┐  ┌──────────┐            │
│  │ User: A  │  │ User: B  │  ...       │
│  │          │  │          │            │
│  │ Sessions │  │ Sessions │            │
│  │ Memories │  │ Memories │            │
│  │ Config   │  │ Config   │            │
│  └──────────┘  └──────────┘            │
│                                         │
│  Shared: workspace config, tools, keys │
└─────────────────────────────────────────┘

Configuration

Workspace Setup

toml
[identity]
# Enable multi-tenant identity scoping.
enabled = true

# Default workspace for sessions that do not specify one.
default_workspace = "default"

# Allow users to create new workspaces.
allow_workspace_creation = true

# Maximum workspaces per deployment.
max_workspaces = 100

User Profiles

User profiles store per-user preferences and metadata:

toml
[identity.profiles]
# Storage backend for user profiles: "memory" | "sqlite" | "postgres"
backend = "sqlite"
path = "~/.local/share/openprx/identities.db"

Workspace Configuration

Each espace de travail can have its own configuration overlay:

toml
# Workspace-specific overrides in config.toml
[workspaces.acme]
display_name = "ACME Corp"
default_provider = "openai"
default_model = "gpt-4o"

[workspaces.acme.memory]
backend = "postgres"

[workspaces.acme.security.tool_policy]
default = "supervised"

Identity Context

La structure IdentityContext est transmise dans tout le pipeline de requetes. Elle contient : user_id, display_name, espace de travail_id, session_id, role (Owner/Admin/Member/Guest), channel, and arbitrary metadata.

Le contexte d'identite se propage a travers chaque couche: la passerelle l'extrait des requetes entrantes, la boucle de l'agent uses it to scope memory et tool access, the systeme de memoire namespaces data by espace de travail et user, cost tracking attributes usage, et the journal d'audit records the actor.

Multi-Tenancy

PRX prend en charge multi-tenant deployments where multiple organizations share un seul PRX instance. Tenancy boundaries are enforced au espace de travail level:

Data Isolation

ResourceIsolation Level
MemoriesPer-espace de travail + per-user
ConfigurationPer-espace de travail overlay on global defaults
Tool policiesPer-espace de travail overrides
SecretsPer-espace de travail vault
Cost budgetsPer-espace de travail limits
Audit logsPer-espace de travail filtering

Cross-Workspace Access

By default, users ne peut que access resources within their espace de travail. Cross-espace de travail access necessite explicit configuration:

toml
[identity.cross_workspace]
# Allow workspace admins to access other workspaces.
admin_cross_access = false

# Allow specific users to access multiple workspaces.
[[identity.cross_workspace.grants]]
user_id = "shared-bot"
workspaces = ["acme", "beta-corp"]
role = "member"

User Resolution

PRX resolves user identity differently en fonction de the communication channel:

ChannelIdentity SourceUser ID Format
TelegramTelegram user IDtelegram:<user_id>
DiscordDiscord user IDdiscord:<user_id>
SlackSlack user IDslack:<espace de travail_id>:<user_id>
CLISystem usernamecli:<username>
API/GatewayBearer token / API keyapi:<key_hash>
WeChatWeChat OpenIDwechat:<open_id>
QQQQ numberqq:<qq_number>

First-Contact Registration

Lorsqu'un nouvel utilisateur interagit avec PRX pour la premiere fois, un enregistrement d'identite est cree automatiquement: the channel adapter extracts l'utilisateur identifier, creates a profile with default settings, et assigns l'utilisateur vers le default_espace de travail avec le Member role.

Manual User Management

bash
# List all known users
prx identity list

# Show user details
prx identity info telegram:123456

# Assign a user to a workspace
prx identity assign telegram:123456 --workspace acme --role admin

# Remove a user from a workspace
prx identity remove telegram:123456 --workspace acme

# Set user metadata
prx identity set telegram:123456 --key language --value en

Workspace Management

bash
# List all workspaces
prx workspace list

# Create a new workspace
prx workspace create acme --display-name "ACME Corp"

# Show workspace details
prx workspace info acme

# Set workspace configuration
prx workspace config acme --set default_provider=anthropic

# Delete a workspace (requires confirmation)
prx workspace delete acme --confirm

User Profiles

User profiles store preferences that personalize la reponse de l'agent behavior:

ChampTypeDescription
user_idstringUnique identifier
display_namestringHuman-readable name
languagestringPreferred language (ISO 639-1)
timezonestringPreferred timezone (IANA format)
roleenumWorkspace role (owner, admin, member, guest)
preferencesmapKey-value preferences (model, verbosity, etc.)
created_atdatetimeFirst interaction timestamp
last_seen_atdatetimeMost recent interaction timestamp

Profile Access in System Prompts

L'agent's system prompt can include user profile information via template variables (e.g. {{identity.display_name}}, {{identity.language}}), resolved depuis le identity context before the prompt est envoye a le LLM.

Role-Based Access Control

Workspace roles determine what actions a user can perform:

PermissionOwnerAdminMemberGuest
Use agent (chat)OuiOuiOuiOui
Store memoriesOuiOuiOuiNon
Configure toolsOuiOuiNonNon
Manage usersOuiOuiNonNon
Manage espace de travailOuiNonNonNon
View journal d'auditsOuiOuiNonNon

Integration Points

When identity.enabled = true, all memory operations are scoped by espace de travail:{espace de travail_id}:user:{user_id}:{key}, ensuring data isolation. Tool policies peut etre overridden per-espace de travail, et token usage is attributed vers le identity context for per-user cost reporting.

Securite Nontes

  • Identity spoofing -- the identity system trusts the channel adapter to correctly identify users. Ensure channel authentication is properly configured (bot tokens, OAuth, etc.).
  • Workspace isolation -- espace de travail boundaries are enforced in application logic. The underlying storage (SQLite, Postgres) ne fait pas provide database-level isolation. A bug in the scoping logic could leak data.
  • Guest access -- guests have minimal permissions par defaut. Review the guest role configuration when enabling public-facing agents.
  • Profile data -- user profiles may contain personal information. Handle in accordance with your privacy policy and applicable regulations.
  • Cross-espace de travail grants -- grant cross-espace de travail access sparingly. Each grant expands the blast radius of a compromised account.

Voir aussi Pages

Released under the Apache-2.0 License.