Skip to content

armgit / letta

Public Imported from GitHub
0

Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.

feat: remove `identities` from .af (#1388)

Sarah Woodersbd4a23a1f92a
diff --git a/letta/serialize_schemas/marshmallow_agent.py b/letta/serialize_schemas/marshmallow_agent.py
index 182fb559c..12ce873d7 100644
--- a/letta/serialize_schemas/marshmallow_agent.py
+++ b/letta/serialize_schemas/marshmallow_agent.py
@@ -105,4 +105,7 @@ class MarshmallowAgentSchema(BaseSchema):
"sources",
"source_passages",
"agent_passages",
+ "identities",
+ "is_deleted",
+ "groups",
)
diff --git a/letta/serialize_schemas/marshmallow_block.py b/letta/serialize_schemas/marshmallow_block.py
index 6432f6423..6325f2c88 100644
--- a/letta/serialize_schemas/marshmallow_block.py
+++ b/letta/serialize_schemas/marshmallow_block.py
@@ -12,4 +12,4 @@ class SerializedBlockSchema(BaseSchema):
class Meta(BaseSchema.Meta):
model = Block
- exclude = BaseSchema.Meta.exclude + ("agents",)
+ exclude = BaseSchema.Meta.exclude + ("agents", "identities", "is_deleted")
diff --git a/letta/serialize_schemas/marshmallow_tool.py b/letta/serialize_schemas/marshmallow_tool.py
index 3ae65ceb9..44f64a97a 100644
--- a/letta/serialize_schemas/marshmallow_tool.py
+++ b/letta/serialize_schemas/marshmallow_tool.py
@@ -12,4 +12,4 @@ class SerializedToolSchema(BaseSchema):
class Meta(BaseSchema.Meta):
model = Tool
- exclude = BaseSchema.Meta.exclude
+ exclude = BaseSchema.Meta.exclude + ("is_deleted",)
diff --git a/letta/serialize_schemas/pydantic_agent_schema.py b/letta/serialize_schemas/pydantic_agent_schema.py
index a3ab28e3a..5cd1805f0 100644
--- a/letta/serialize_schemas/pydantic_agent_schema.py
+++ b/letta/serialize_schemas/pydantic_agent_schema.py
@@ -10,8 +10,6 @@ from letta.schemas.llm_config import LLMConfig
class CoreMemoryBlockSchema(BaseModel):
created_at: str
description: Optional[str]
- identities: List[Any]
- is_deleted: bool
is_template: bool
label: str
limit: int
@@ -42,7 +40,6 @@ class TagSchema(BaseModel):
class ToolEnvVarSchema(BaseModel):
created_at: str
description: Optional[str]
- is_deleted: bool
key: str
updated_at: str
value: str
@@ -76,7 +73,6 @@ class ToolSchema(BaseModel):
args_json_schema: Optional[Any]
created_at: str
description: str
- is_deleted: bool
json_schema: ToolJSONSchema
name: str
return_char_limit: int
@@ -94,9 +90,6 @@ class AgentSchema(BaseModel):
created_at: str
description: Optional[str]
embedding_config: EmbeddingConfig
- groups: List[Any]
- identities: List[Any]
- is_deleted: bool
llm_config: LLMConfig
message_buffer_autoclear: bool
messages: List[MessageSchema]
diff --git a/tests/test_agent_serialization.py b/tests/test_agent_serialization.py
index b2607291a..6d8c25c97 100644
--- a/tests/test_agent_serialization.py
+++ b/tests/test_agent_serialization.py
@@ -351,6 +351,11 @@ def test_append_copy_suffix_simple(local_client, server, serialize_test_agent, d
"""Test deserializing JSON into an Agent instance."""
result = server.agent_manager.serialize(agent_id=serialize_test_agent.id, actor=default_user)
+ # write file
+ with open("test_agent_serialization.json", "w") as f:
+ # write json
+ f.write(json.dumps(result.model_dump(), indent=4))
+
# Deserialize the agent
agent_copy = server.agent_manager.deserialize(serialized_agent=result, actor=other_user, append_copy_suffix=append_copy_suffix)