From 651c55dc2aaecefa4b03ac359802bd42dfcffd08 Mon Sep 17 00:00:00 2001 From: cthomas Date: Fri, 10 Oct 2025 14:24:31 -0700 Subject: [PATCH] feat: add approvals support in agentfile (#5337) --- fern/openapi.json | 22 ++++++++++++++++++++++ letta/schemas/agent_file.py | 3 +++ 2 files changed, 25 insertions(+) diff --git a/fern/openapi.json b/fern/openapi.json index 32533b23..48601cc0 100644 --- a/fern/openapi.json +++ b/fern/openapi.json @@ -36797,6 +36797,28 @@ ], "title": "Denial Reason", "description": "An optional explanation for the provided approval status" + }, + "approvals": { + "anyOf": [ + { + "items": { + "anyOf": [ + { + "$ref": "#/components/schemas/ApprovalReturn" + }, + { + "$ref": "#/components/schemas/letta__schemas__message__ToolReturn" + } + ] + }, + "type": "array" + }, + { + "type": "null" + } + ], + "title": "Approvals", + "description": "Approval returns for the message" } }, "type": "object", diff --git a/letta/schemas/agent_file.py b/letta/schemas/agent_file.py index 538c32c3..5d90250b 100644 --- a/letta/schemas/agent_file.py +++ b/letta/schemas/agent_file.py @@ -10,6 +10,7 @@ from letta.schemas.block import Block, CreateBlock from letta.schemas.enums import MessageRole from letta.schemas.file import FileAgent, FileAgentBase, FileMetadata, FileMetadataBase from letta.schemas.group import Group, GroupCreate +from letta.schemas.letta_message import ApprovalReturn from letta.schemas.mcp import MCPServer from letta.schemas.message import Message, MessageCreate, ToolReturn from letta.schemas.source import Source, SourceCreate @@ -59,6 +60,7 @@ class MessageSchema(MessageCreate): approve: Optional[bool] = Field(None, description="Whether the tool has been approved") approval_request_id: Optional[str] = Field(None, description="The message ID of the approval request") denial_reason: Optional[str] = Field(None, description="An optional explanation for the provided approval status") + approvals: Optional[List[ApprovalReturn | ToolReturn]] = Field(None, description="Approval returns for the message") # TODO: Should we also duplicate the steps here? # TODO: What about tool_return? @@ -87,6 +89,7 @@ class MessageSchema(MessageCreate): approve=message.approve, approval_request_id=message.approval_request_id, denial_reason=message.denial_reason, + approvals=message.approvals, )