From 662b487bb4f0bf7dd11a952648969268cc34c740 Mon Sep 17 00:00:00 2001 From: Ishaan Jaffer Date: Thu, 7 May 2026 15:50:22 -0700 Subject: [PATCH] managed agents: add GET /v1/managed_agents/agents MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds list_agents — returns every agent ordered by created_at desc. Needed for the agent-platform UI agents-list page. --- .../endpoints_agents.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/litellm/proxy/managed_agents_endpoints/endpoints_agents.py b/litellm/proxy/managed_agents_endpoints/endpoints_agents.py index 19fffc6cca7..12c0b3f7ab2 100644 --- a/litellm/proxy/managed_agents_endpoints/endpoints_agents.py +++ b/litellm/proxy/managed_agents_endpoints/endpoints_agents.py @@ -1,5 +1,6 @@ import asyncio import json +from typing import List from fastapi import Depends, HTTPException @@ -20,6 +21,7 @@ def _agent_row_to_out(row) -> AgentOut: model=row.model, template_id=row.template_id, branch=row.branch, + created_at=getattr(row, "created_at", None), ) @@ -70,6 +72,21 @@ async def create_agent( return _agent_row_to_out(row) +@router.get("/agents", response_model=List[AgentOut]) +async def list_agents( + user_api_key_dict: UserAPIKeyAuth = Depends(user_api_key_auth), +) -> List[AgentOut]: + from litellm.proxy.proxy_server import prisma_client + + if prisma_client is None: + raise HTTPException(status_code=500, detail="prisma client not available") + + rows = await prisma_client.db.litellm_managedagenttable.find_many( + order={"created_at": "desc"} + ) + return [_agent_row_to_out(row) for row in rows] + + @router.get("/agents/{agent_id}", response_model=AgentOut) async def get_agent( agent_id: str,