feat: remove relationship fields on identities (#5691)

This commit is contained in:
cthomas
2025-10-23 12:13:14 -07:00
committed by Caren Thomas
parent afdf0f80e3
commit 5e43291436
4 changed files with 17 additions and 15 deletions

View File

@@ -22962,7 +22962,8 @@
},
"type": "array",
"title": "Agent Ids",
"description": "The IDs of the agents associated with the identity."
"description": "The IDs of the agents associated with the identity.",
"deprecated": true
},
"block_ids": {
"items": {
@@ -22970,7 +22971,8 @@
},
"type": "array",
"title": "Block Ids",
"description": "The IDs of the blocks associated with the identity."
"description": "The IDs of the blocks associated with the identity.",
"deprecated": true
},
"properties": {
"items": {

View File

@@ -412,7 +412,7 @@ class Agent(SqlalchemyBase, OrganizationMixin, ProjectMixin, TemplateEntityMixin
)
state["blocks"] = [m.to_pydantic() for m in memory]
state["identity_ids"] = [i.id for i in identities]
state["identities"] = [] # TODO: fix this
state["identities"] = [i.to_pydantic() for i in identities]
state["multi_agent_group"] = multi_agent_group
state["managed_group"] = multi_agent_group
state["tool_exec_environment_variables"] = tool_exec_environment_variables

View File

@@ -44,15 +44,15 @@ class Identity(SqlalchemyBase, OrganizationMixin, ProjectMixin):
"Block", secondary="identities_blocks", lazy="selectin", passive_deletes=True, back_populates="identities"
)
@property
def agent_ids(self) -> List[str]:
"""Get just the agent IDs without loading the full agent objects"""
return [agent.id for agent in self.agents]
# @property
# def agent_ids(self) -> List[str]:
# """Get just the agent IDs without loading the full agent objects"""
# return [agent.id for agent in self.agents]
@property
def block_ids(self) -> List[str]:
"""Get just the block IDs without loading the full agent objects"""
return [block.id for block in self.blocks]
# @property
# def block_ids(self) -> List[str]:
# """Get just the block IDs without loading the full agent objects"""
# return [block.id for block in self.blocks]
def to_pydantic(self) -> PydanticIdentity:
state = {
@@ -61,8 +61,8 @@ class Identity(SqlalchemyBase, OrganizationMixin, ProjectMixin):
"name": self.name,
"identity_type": self.identity_type,
"project_id": self.project_id,
"agent_ids": self.agent_ids,
"block_ids": self.block_ids,
"agent_ids": [],
"block_ids": [],
"organization_id": self.organization_id,
"properties": self.properties or [],
}

View File

@@ -46,8 +46,8 @@ class Identity(IdentityBase):
name: str = Field(..., description="The name of the identity.")
identity_type: IdentityType = Field(..., description="The type of the identity.")
project_id: Optional[str] = Field(None, description="The project id of the identity, if applicable.")
agent_ids: List[str] = Field(..., description="The IDs of the agents associated with the identity.")
block_ids: List[str] = Field(..., description="The IDs of the blocks associated with the identity.")
agent_ids: List[str] = Field(..., description="The IDs of the agents associated with the identity.", deprecated=True)
block_ids: List[str] = Field(..., description="The IDs of the blocks associated with the identity.", deprecated=True)
organization_id: Optional[str] = Field(None, description="The organization id of the user")
properties: List[IdentityProperty] = Field(default_factory=list, description="List of properties associated with the identity")