Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.
fix: fern default types for tool rules (#848)
cthomas36e831c3a39d
diff --git a/letta/schemas/tool_rule.py b/letta/schemas/tool_rule.pyindex faf94fe42..fd1f66cd7 100644--- a/letta/schemas/tool_rule.py+++ b/letta/schemas/tool_rule.py@@ -1,4 +1,4 @@-from typing import Any, Dict, List, Optional, Union+from typing import Annotated, Any, Dict, List, Literal, Optional, Unionfrom pydantic import Field@@ -17,7 +17,7 @@ class ChildToolRule(BaseToolRule):A ToolRule represents a tool that can be invoked by the agent."""- type: ToolRuleType = ToolRuleType.constrain_child_tools+ type: Literal[ToolRuleType.constrain_child_tools] = ToolRuleType.constrain_child_toolschildren: List[str] = Field(..., description="The children tools that can be invoked.")@@ -26,7 +26,7 @@ class ConditionalToolRule(BaseToolRule):A ToolRule that conditionally maps to different child tools based on the output."""- type: ToolRuleType = ToolRuleType.conditional+ type: Literal[ToolRuleType.conditional] = ToolRuleType.conditionaldefault_child: Optional[str] = Field(None, description="The default child tool to be called. If None, any tool can be called.")child_output_mapping: Dict[Any, str] = Field(..., description="The output case to check for mapping")require_output_mapping: bool = Field(default=False, description="Whether to throw an error when output doesn't match any case")@@ -37,7 +37,7 @@ class InitToolRule(BaseToolRule):Represents the initial tool rule configuration."""- type: ToolRuleType = ToolRuleType.run_first+ type: Literal[ToolRuleType.run_first] = ToolRuleType.run_firstclass TerminalToolRule(BaseToolRule):@@ -45,7 +45,10 @@ class TerminalToolRule(BaseToolRule):Represents a terminal tool rule configuration where if this tool gets called, it must end the agent loop."""- type: ToolRuleType = ToolRuleType.exit_loop+ type: Literal[ToolRuleType.exit_loop] = ToolRuleType.exit_loop-ToolRule = Union[ChildToolRule, InitToolRule, TerminalToolRule, ConditionalToolRule]+ToolRule = Annotated[+ Union[ChildToolRule, InitToolRule, TerminalToolRule, ConditionalToolRule],+ Field(discriminator="type"),+]