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: archives delete endpoint [LET-4397] (#5655)

Ari Webb8611c1704688
diff --git a/fern/openapi.json b/fern/openapi.json
index 6ae3e163b..6111fa287 100644
--- a/fern/openapi.json
+++ b/fern/openapi.json
@@ -299,6 +299,51 @@
}
}
}
+ },
+ "delete": {
+ "tags": ["archives"],
+ "summary": "Delete Archive",
+ "description": "Delete an archive by its ID.",
+ "operationId": "delete_archive",
+ "parameters": [
+ {
+ "name": "archive_id",
+ "in": "path",
+ "required": true,
+ "schema": {
+ "type": "string",
+ "minLength": 44,
+ "maxLength": 44,
+ "pattern": "^archive-[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
+ "description": "The ID of the archive in the format 'archive-<uuid4>'",
+ "examples": ["archive-123e4567-e89b-42d3-8456-426614174000"],
+ "title": "Archive Id"
+ },
+ "description": "The ID of the archive in the format 'archive-<uuid4>'"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "Successful Response",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Archive"
+ }
+ }
+ }
+ },
+ "422": {
+ "description": "Validation Error",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/HTTPValidationError"
+ }
+ }
+ }
+ }
+ }
}
},
"/v1/tools/{tool_id}": {
diff --git a/letta/server/rest_api/routers/v1/archives.py b/letta/server/rest_api/routers/v1/archives.py
index 284f994f5..9b6bc94d3 100644
--- a/letta/server/rest_api/routers/v1/archives.py
+++ b/letta/server/rest_api/routers/v1/archives.py
@@ -116,3 +116,19 @@ async def modify_archive(
description=archive.description,
actor=actor,
)
+
+
[email protected]("/{archive_id}", response_model=PydanticArchive, operation_id="delete_archive")
+async def delete_archive(
+ archive_id: ArchiveId,
+ server: "SyncServer" = Depends(get_letta_server),
+ headers: HeaderParams = Depends(get_headers),
+):
+ """
+ Delete an archive by its ID.
+ """
+ actor = await server.user_manager.get_actor_or_default_async(actor_id=headers.actor_id)
+ return await server.archive_manager.delete_archive_async(
+ archive_id=archive_id,
+ actor=actor,
+ )