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 get_archive_by_id endpoint [LET-4405] (#5640)

Ari Webb4083f335f495
diff --git a/fern/openapi.json b/fern/openapi.json
index 7685855cb..6ae3e163b 100644
--- a/fern/openapi.json
+++ b/fern/openapi.json
@@ -200,6 +200,51 @@
}
},
"/v1/archives/{archive_id}": {
+ "get": {
+ "tags": ["archives"],
+ "summary": "Get Archive By Id",
+ "description": "Get a single archive by its ID.",
+ "operationId": "get_archive_by_id",
+ "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"
+ }
+ }
+ }
+ }
+ }
+ },
"patch": {
"tags": ["archives"],
"summary": "Modify Archive",
diff --git a/letta/server/rest_api/routers/v1/archives.py b/letta/server/rest_api/routers/v1/archives.py
index 0f5e03921..284f994f5 100644
--- a/letta/server/rest_api/routers/v1/archives.py
+++ b/letta/server/rest_api/routers/v1/archives.py
@@ -83,6 +83,22 @@ async def list_archives(
return archives
[email protected]("/{archive_id}", response_model=PydanticArchive, operation_id="get_archive_by_id")
+async def get_archive_by_id(
+ archive_id: ArchiveId,
+ server: "SyncServer" = Depends(get_letta_server),
+ headers: HeaderParams = Depends(get_headers),
+):
+ """
+ Get a single archive by its ID.
+ """
+ actor = await server.user_manager.get_actor_or_default_async(actor_id=headers.actor_id)
+ return await server.archive_manager.get_archive_by_id_async(
+ archive_id=archive_id,
+ actor=actor,
+ )
+
+
@router.patch("/{archive_id}", response_model=PydanticArchive, operation_id="modify_archive")
async def modify_archive(
archive_id: ArchiveId,