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,