Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.
feat: replace agent.identity_ids with agent.identities [LET-5803] (#5673)
cthomas14faa2786992
diff --git a/fern/openapi.json b/fern/openapi.jsonindex c12370e80..121a1b650 100644--- a/fern/openapi.json+++ b/fern/openapi.json@@ -16692,6 +16692,16 @@"type": "array","title": "Identity Ids","description": "The ids of the identities associated with this agent.",+ "default": [],+ "deprecated": true+ },+ "identities": {+ "items": {+ "$ref": "#/components/schemas/Identity"+ },+ "type": "array",+ "title": "Identities",+ "description": "The identities associated with this agent.","default": []},"message_buffer_autoclear": {diff --git a/letta/orm/agent.py b/letta/orm/agent.pyindex 8b4499aea..e7a0cac74 100644--- a/letta/orm/agent.py+++ b/letta/orm/agent.py@@ -243,6 +243,7 @@ class Agent(SqlalchemyBase, OrganizationMixin, ProjectMixin, TemplateEntityMixin"memory": Memory(blocks=[]),"blocks": [],"identity_ids": [],+ "identities": [],"multi_agent_group": None,"tool_exec_environment_variables": [],"secrets": [],@@ -265,6 +266,7 @@ class Agent(SqlalchemyBase, OrganizationMixin, ProjectMixin, TemplateEntityMixin),"blocks": lambda: [b.to_pydantic() for b in self.core_memory],"identity_ids": lambda: [i.id for i in self.identities],+ "identities": lambda: [i.to_pydantic() for i in self.identities],"multi_agent_group": lambda: self.multi_agent_group,"tool_exec_environment_variables": lambda: self.tool_exec_environment_variables,"secrets": lambda: self.tool_exec_environment_variables,@@ -338,6 +340,7 @@ class Agent(SqlalchemyBase, OrganizationMixin, ProjectMixin, TemplateEntityMixin"memory": Memory(blocks=[]),"blocks": [],"identity_ids": [],+ "identities": [],"multi_agent_group": None,"tool_exec_environment_variables": [],"secrets": [],@@ -384,6 +387,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"] = [i.to_pydantic() for i in identities]state["multi_agent_group"] = multi_agent_groupstate["tool_exec_environment_variables"] = tool_exec_environment_variablesstate["secrets"] = tool_exec_environment_variablesdiff --git a/letta/schemas/agent.py b/letta/schemas/agent.pyindex 26050c334..ebd3d9ba8 100644--- a/letta/schemas/agent.py+++ b/letta/schemas/agent.py@@ -12,6 +12,7 @@ from letta.schemas.enums import PrimitiveTypefrom letta.schemas.environment_variables import AgentEnvironmentVariablefrom letta.schemas.file import FileStatusfrom letta.schemas.group import Group+from letta.schemas.identity import Identityfrom letta.schemas.letta_base import OrmMetadataBasefrom letta.schemas.llm_config import LLMConfigfrom letta.schemas.memory import Memory@@ -104,7 +105,8 @@ class AgentState(OrmMetadataBase, validate_assignment=True):base_template_id: Optional[str] = Field(None, description="The base template id of the agent.")deployment_id: Optional[str] = Field(None, description="The id of the deployment.")entity_id: Optional[str] = Field(None, description="The id of the entity within the template.")- identity_ids: List[str] = Field([], description="The ids of the identities associated with this agent.")+ identity_ids: List[str] = Field([], description="The ids of the identities associated with this agent.", deprecated=True)+ identities: List[Identity] = Field([], description="The identities associated with this agent.")# An advanced configuration that makes it so this agent does not remember any previous messagesmessage_buffer_autoclear: bool = Field(diff --git a/tests/managers/test_agent_manager.py b/tests/managers/test_agent_manager.pyindex 49a57fc3c..1da064052 100644--- a/tests/managers/test_agent_manager.py+++ b/tests/managers/test_agent_manager.py@@ -1076,6 +1076,7 @@ async def test_agent_state_schema_unchanged(server: SyncServer):"deployment_id": (str, type(None)),"entity_id": (str, type(None)),"identity_ids": list,+ "identities": list,# Advanced configuration"message_buffer_autoclear": bool,"enable_sleeptime": (bool, type(None)),