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: add approvals support in agentfile (#5337)

cthomas651c55dc2aae
diff --git a/fern/openapi.json b/fern/openapi.json
index 32533b230..48601cc04 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 538c32c33..5d90250b4 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,
)