Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.
fix: prevent cross tenancy attaching sources
Ari Webb015a209f407f
diff --git a/letta/services/agent_manager.py b/letta/services/agent_manager.pyindex ce883bae8..64754f521 100644--- a/letta/services/agent_manager.py+++ b/letta/services/agent_manager.py@@ -1568,7 +1568,7 @@ class AgentManager:actor: User performing the actionRaises:- ValueError: If either agent or source doesn't exist+ NoResultFound: If either agent or source doesn't exist or actor lacks permission to access themIntegrityError: If the source is already attached to the agent"""@@ -1576,6 +1576,9 @@ class AgentManager:# Verify both agent and source exist and user has permission to access themagent = await AgentModel.read_async(db_session=session, identifier=agent_id, actor=actor)+ # Verify the actor has permission to access the source+ await SourceModel.read_async(db_session=session, identifier=source_id, actor=actor)+# The _process_relationship helper already handles duplicate checking via unique constraintawait _process_relationship_async(session=session,