Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.
fix: fix tool rule serialization for rules with extra fields getting dropped (#1441)
Sarah Woodersdb6455303bd4
diff --git a/letta/serialize_schemas/marshmallow_agent.py b/letta/serialize_schemas/marshmallow_agent.pyindex 12ce873d7..834f7545f 100644--- a/letta/serialize_schemas/marshmallow_agent.py+++ b/letta/serialize_schemas/marshmallow_agent.py@@ -32,6 +32,7 @@ class MarshmallowAgentSchema(BaseSchema):llm_config = LLMConfigField()embedding_config = EmbeddingConfigField()+tool_rules = ToolRulesField()messages = fields.List(fields.Nested(SerializedMessageSchema))diff --git a/letta/serialize_schemas/pydantic_agent_schema.py b/letta/serialize_schemas/pydantic_agent_schema.pyindex 5cd1805f0..8d11b7811 100644--- a/letta/serialize_schemas/pydantic_agent_schema.py+++ b/letta/serialize_schemas/pydantic_agent_schema.py@@ -1,4 +1,4 @@-from typing import Any, Dict, List, Optional+from typing import Any, Dict, List, Optional, Unionfrom pydantic import BaseModel, Field@@ -45,11 +45,31 @@ class ToolEnvVarSchema(BaseModel):value: str-class ToolRuleSchema(BaseModel):+# Tool rules+++class BaseToolRuleSchema(BaseModel):tool_name: strtype: str+class ChildToolRuleSchema(BaseToolRuleSchema):+ children: List[str]+++class MaxCountPerStepToolRuleSchema(BaseToolRuleSchema):+ max_count_limit: int+++class ConditionalToolRuleSchema(BaseToolRuleSchema):+ default_child: Optional[str]+ child_output_mapping: Dict[Any, str]+ require_output_mapping: bool+++ToolRuleSchema = Union[BaseToolRuleSchema, ChildToolRuleSchema, MaxCountPerStepToolRuleSchema, ConditionalToolRuleSchema]++class ParameterProperties(BaseModel):type: strdescription: Optional[str] = None