feat: add approvals support in agentfile (#5337)

This commit is contained in:
cthomas
2025-10-10 14:24:31 -07:00
committed by Caren Thomas
parent 1353bcd524
commit 651c55dc2a
2 changed files with 25 additions and 0 deletions

View File

@@ -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",

View File

@@ -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,
)