From 1e175b863349cd02ecf3259bf67026805ea4943d Mon Sep 17 00:00:00 2001 From: cthomas Date: Tue, 21 Oct 2025 13:07:07 -0700 Subject: [PATCH] feat: mark legacy agents routes as deprecated [LET-5762] (#5609) feat: mark legacy agents routes as deprecated --- fern/openapi.json | 9 +++++++++ letta/server/rest_api/routers/v1/agents.py | 23 +++++++++++++--------- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/fern/openapi.json b/fern/openapi.json index 91ec4d5d..4b8da2cb 100644 --- a/fern/openapi.json +++ b/fern/openapi.json @@ -3983,6 +3983,7 @@ "summary": "Retrieve Agent Context Window", "description": "Retrieve the context window of a specific agent.", "operationId": "retrieve_agent_context_window", + "deprecated": true, "parameters": [ { "name": "agent_id", @@ -4517,6 +4518,7 @@ "summary": "Attach Source", "description": "Attach a source to an agent.", "operationId": "attach_source_to_agent", + "deprecated": true, "parameters": [ { "name": "source_id", @@ -4641,6 +4643,7 @@ "summary": "Detach Source", "description": "Detach a source from an agent.", "operationId": "detach_source_from_agent", + "deprecated": true, "parameters": [ { "name": "source_id", @@ -4942,6 +4945,7 @@ "summary": "List Agent Sources", "description": "Get the sources associated with an agent.", "operationId": "list_agent_sources", + "deprecated": true, "parameters": [ { "name": "agent_id", @@ -5372,6 +5376,7 @@ "summary": "Retrieve Agent Memory", "description": "Retrieve the memory state of a specific agent.\nThis endpoint fetches the current memory state of the agent identified by the user ID and agent ID.", "operationId": "retrieve_agent_memory", + "deprecated": true, "parameters": [ { "name": "agent_id", @@ -5795,6 +5800,7 @@ "summary": "List Passages", "description": "Retrieve the memories in an agent's archival memory store (paginated query).", "operationId": "list_passages", + "deprecated": true, "parameters": [ { "name": "agent_id", @@ -5935,6 +5941,7 @@ "summary": "Create Passage", "description": "Insert a memory into an agent's archival memory store.", "operationId": "create_passage", + "deprecated": true, "parameters": [ { "name": "agent_id", @@ -5996,6 +6003,7 @@ "summary": "Search Archival Memory", "description": "Search archival memory using semantic (embedding-based) search with optional temporal filtering.\n\nThis endpoint allows manual triggering of archival memory searches, enabling users to query\nan agent's archival memory store directly via the API. The search uses the same functionality\nas the agent's archival_memory_search tool but is accessible for external API usage.", "operationId": "search_archival_memory", + "deprecated": true, "parameters": [ { "name": "agent_id", @@ -6144,6 +6152,7 @@ "summary": "Delete Passage", "description": "Delete a memory from an agent's archival memory store.", "operationId": "delete_passage", + "deprecated": true, "parameters": [ { "name": "memory_id", diff --git a/letta/server/rest_api/routers/v1/agents.py b/letta/server/rest_api/routers/v1/agents.py index c4c38b82..36799e4f 100644 --- a/letta/server/rest_api/routers/v1/agents.py +++ b/letta/server/rest_api/routers/v1/agents.py @@ -351,7 +351,7 @@ async def import_agent( return ImportedAgentsResponse(agent_ids=agent_ids) -@router.get("/{agent_id}/context", response_model=ContextWindowOverview, operation_id="retrieve_agent_context_window") +@router.get("/{agent_id}/context", response_model=ContextWindowOverview, operation_id="retrieve_agent_context_window", deprecated=True) async def retrieve_agent_context_window( agent_id: str = PATH_VALIDATORS[AgentState.__id_prefix__], server: "SyncServer" = Depends(get_letta_server), @@ -483,7 +483,7 @@ async def modify_approval_for_tool( return await server.agent_manager.get_agent_by_id_async(agent_id=agent_id, actor=actor) -@router.patch("/{agent_id}/sources/attach/{source_id}", response_model=AgentState, operation_id="attach_source_to_agent") +@router.patch("/{agent_id}/sources/attach/{source_id}", response_model=AgentState, operation_id="attach_source_to_agent", deprecated=True) async def attach_source( source_id: str = PATH_VALIDATORS[BaseSource.__id_prefix__], agent_id: str = PATH_VALIDATORS[AgentState.__id_prefix__], @@ -537,7 +537,7 @@ async def attach_folder_to_agent( return agent_state -@router.patch("/{agent_id}/sources/detach/{source_id}", response_model=AgentState, operation_id="detach_source_from_agent") +@router.patch("/{agent_id}/sources/detach/{source_id}", response_model=AgentState, operation_id="detach_source_from_agent", deprecated=True) async def detach_source( source_id: str = PATH_VALIDATORS[BaseSource.__id_prefix__], agent_id: str = PATH_VALIDATORS[AgentState.__id_prefix__], @@ -725,7 +725,7 @@ async def delete_agent( return JSONResponse(status_code=status.HTTP_200_OK, content={"message": f"Agent id={agent_id} successfully deleted"}) -@router.get("/{agent_id}/sources", response_model=list[Source], operation_id="list_agent_sources") +@router.get("/{agent_id}/sources", response_model=list[Source], operation_id="list_agent_sources", deprecated=True) async def list_agent_sources( agent_id: str = PATH_VALIDATORS[AgentState.__id_prefix__], server: "SyncServer" = Depends(get_letta_server), @@ -852,7 +852,7 @@ async def list_files_for_agent( # TODO: remove? can also get with agent blocks -@router.get("/{agent_id}/core-memory", response_model=Memory, operation_id="retrieve_agent_memory") +@router.get("/{agent_id}/core-memory", response_model=Memory, operation_id="retrieve_agent_memory", deprecated=True) async def retrieve_agent_memory( agent_id: str = PATH_VALIDATORS[AgentState.__id_prefix__], server: "SyncServer" = Depends(get_letta_server), @@ -965,7 +965,7 @@ async def detach_block_from_agent( return await server.agent_manager.detach_block_async(agent_id=agent_id, block_id=block_id, actor=actor) -@router.get("/{agent_id}/archival-memory", response_model=list[Passage], operation_id="list_passages") +@router.get("/{agent_id}/archival-memory", response_model=list[Passage], operation_id="list_passages", deprecated=True) async def list_passages( agent_id: str = PATH_VALIDATORS[AgentState.__id_prefix__], server: "SyncServer" = Depends(get_letta_server), @@ -994,7 +994,7 @@ async def list_passages( ) -@router.post("/{agent_id}/archival-memory", response_model=list[Passage], operation_id="create_passage") +@router.post("/{agent_id}/archival-memory", response_model=list[Passage], operation_id="create_passage", deprecated=True) async def create_passage( agent_id: str = PATH_VALIDATORS[AgentState.__id_prefix__], request: CreateArchivalMemory = Body(...), @@ -1011,7 +1011,12 @@ async def create_passage( ) -@router.get("/{agent_id}/archival-memory/search", response_model=ArchivalMemorySearchResponse, operation_id="search_archival_memory") +@router.get( + "/{agent_id}/archival-memory/search", + response_model=ArchivalMemorySearchResponse, + operation_id="search_archival_memory", + deprecated=True, +) async def search_archival_memory( agent_id: str = PATH_VALIDATORS[AgentState.__id_prefix__], query: str = Query(..., description="String to search for using semantic similarity"), @@ -1058,7 +1063,7 @@ async def search_archival_memory( # TODO(ethan): query or path parameter for memory_id? # @router.delete("/{agent_id}/archival") -@router.delete("/{agent_id}/archival-memory/{memory_id}", response_model=None, operation_id="delete_passage") +@router.delete("/{agent_id}/archival-memory/{memory_id}", response_model=None, operation_id="delete_passage", deprecated=True) async def delete_passage( memory_id: str, agent_id: str = PATH_VALIDATORS[AgentState.__id_prefix__],