diff --git a/fern/openapi.json b/fern/openapi.json index 9ef69f2c..d20c3629 100644 --- a/fern/openapi.json +++ b/fern/openapi.json @@ -29731,7 +29731,7 @@ "anyOf": [ { "items": { - "$ref": "#/components/schemas/ToolReturn" + "$ref": "#/components/schemas/letta__schemas__message__ToolReturn" }, "type": "array" }, @@ -34073,7 +34073,7 @@ "required": ["name", "description", "parameters"], "title": "ToolJSONSchema" }, - "ToolReturn": { + "ToolReturn-Input": { "properties": { "tool_call_id": { "anyOf": [ @@ -34264,16 +34264,19 @@ }, "tool_return": { "type": "string", - "title": "Tool Return" + "title": "Tool Return", + "deprecated": true }, "status": { "type": "string", "enum": ["success", "error"], - "title": "Status" + "title": "Status", + "deprecated": true }, "tool_call_id": { "type": "string", - "title": "Tool Call Id" + "title": "Tool Call Id", + "deprecated": true }, "stdout": { "anyOf": [ @@ -34287,7 +34290,8 @@ "type": "null" } ], - "title": "Stdout" + "title": "Stdout", + "deprecated": true }, "stderr": { "anyOf": [ @@ -34301,13 +34305,28 @@ "type": "null" } ], - "title": "Stderr" + "title": "Stderr", + "deprecated": true + }, + "tool_returns": { + "anyOf": [ + { + "items": { + "$ref": "#/components/schemas/letta__schemas__letta_message__ToolReturn" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "title": "Tool Returns" } }, "type": "object", "required": ["id", "date", "tool_return", "status", "tool_call_id"], "title": "ToolReturnMessage", - "description": "A message representing the return value of a tool call (generated by Letta executing the requested tool).\n\nArgs:\n id (str): The ID of the message\n date (datetime): The date the message was created in ISO format\n name (Optional[str]): The name of the sender of the message\n tool_return (str): The return value of the tool\n status (Literal[\"success\", \"error\"]): The status of the tool call\n tool_call_id (str): A unique identifier for the tool call that generated this message\n stdout (Optional[List(str)]): Captured stdout (e.g. prints, logs) from the tool invocation\n stderr (Optional[List(str)]): Captured stderr from the tool invocation" + "description": "A message representing the return value of a tool call (generated by Letta executing the requested tool).\n\nArgs:\n id (str): The ID of the message\n date (datetime): The date the message was created in ISO format\n name (Optional[str]): The name of the sender of the message\n tool_return (str): The return value of the tool (deprecated, use tool_returns)\n status (Literal[\"success\", \"error\"]): The status of the tool call (deprecated, use tool_returns)\n tool_call_id (str): A unique identifier for the tool call that generated this message (deprecated, use tool_returns)\n stdout (Optional[List(str)]): Captured stdout (e.g. prints, logs) from the tool invocation (deprecated, use tool_returns)\n stderr (Optional[List(str)]): Captured stderr from the tool invocation (deprecated, use tool_returns)\n tool_returns (Optional[List[ToolReturn]]): List of tool returns for multi-tool support" }, "ToolRunFromSource": { "properties": { @@ -36449,7 +36468,7 @@ "anyOf": [ { "items": { - "$ref": "#/components/schemas/ToolReturn" + "$ref": "#/components/schemas/ToolReturn-Input" }, "type": "array" }, @@ -36695,6 +36714,119 @@ "title": "ToolSchema", "description": "Tool with human-readable ID for agent file" }, + "letta__schemas__letta_message__ToolReturn": { + "properties": { + "tool_return": { + "type": "string", + "title": "Tool Return" + }, + "status": { + "type": "string", + "enum": ["success", "error"], + "title": "Status" + }, + "tool_call_id": { + "type": "string", + "title": "Tool Call Id" + }, + "stdout": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "title": "Stdout" + }, + "stderr": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "title": "Stderr" + } + }, + "type": "object", + "required": ["tool_return", "status", "tool_call_id"], + "title": "ToolReturn" + }, + "letta__schemas__message__ToolReturn": { + "properties": { + "tool_call_id": { + "anyOf": [ + {}, + { + "type": "null" + } + ], + "title": "Tool Call Id", + "description": "The ID for the tool call" + }, + "status": { + "type": "string", + "enum": ["success", "error"], + "title": "Status", + "description": "The status of the tool call" + }, + "stdout": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "title": "Stdout", + "description": "Captured stdout (e.g. prints, logs) from the tool invocation" + }, + "stderr": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "title": "Stderr", + "description": "Captured stderr from the tool invocation" + }, + "func_response": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Func Response", + "description": "The function response string" + } + }, + "type": "object", + "required": ["status"], + "title": "ToolReturn" + }, "letta__serialize_schemas__pydantic_agent_schema__AgentSchema": { "properties": { "agent_type": { diff --git a/letta/schemas/letta_message.py b/letta/schemas/letta_message.py index 1d1904e0..2c436b41 100644 --- a/letta/schemas/letta_message.py +++ b/letta/schemas/letta_message.py @@ -226,6 +226,14 @@ class ToolCallMessage(LettaMessage): return v +class ToolReturn(BaseModel): + tool_return: str + status: Literal["success", "error"] + tool_call_id: str + stdout: Optional[List[str]] = None + stderr: Optional[List[str]] = None + + class ToolReturnMessage(LettaMessage): """ A message representing the return value of a tool call (generated by Letta executing the requested tool). @@ -234,21 +242,23 @@ class ToolReturnMessage(LettaMessage): id (str): The ID of the message date (datetime): The date the message was created in ISO format name (Optional[str]): The name of the sender of the message - tool_return (str): The return value of the tool - status (Literal["success", "error"]): The status of the tool call - tool_call_id (str): A unique identifier for the tool call that generated this message - stdout (Optional[List(str)]): Captured stdout (e.g. prints, logs) from the tool invocation - stderr (Optional[List(str)]): Captured stderr from the tool invocation + tool_return (str): The return value of the tool (deprecated, use tool_returns) + status (Literal["success", "error"]): The status of the tool call (deprecated, use tool_returns) + tool_call_id (str): A unique identifier for the tool call that generated this message (deprecated, use tool_returns) + stdout (Optional[List(str)]): Captured stdout (e.g. prints, logs) from the tool invocation (deprecated, use tool_returns) + stderr (Optional[List(str)]): Captured stderr from the tool invocation (deprecated, use tool_returns) + tool_returns (Optional[List[ToolReturn]]): List of tool returns for multi-tool support """ message_type: Literal[MessageType.tool_return_message] = Field( default=MessageType.tool_return_message, description="The type of the message." ) - tool_return: str - status: Literal["success", "error"] - tool_call_id: str - stdout: Optional[List[str]] = None - stderr: Optional[List[str]] = None + tool_return: str = Field(..., deprecated=True) + status: Literal["success", "error"] = Field(..., deprecated=True) + tool_call_id: str = Field(..., deprecated=True) + stdout: Optional[List[str]] = Field(None, deprecated=True) + stderr: Optional[List[str]] = Field(None, deprecated=True) + tool_returns: Optional[List[ToolReturn]] = None class ApprovalRequestMessage(LettaMessage):