diff --git a/agents-api/agents_api/routers/agents/list_agents.py b/agents-api/agents_api/routers/agents/list_agents.py index aa6986d0d..a24f0667c 100644 --- a/agents-api/agents_api/routers/agents/list_agents.py +++ b/agents-api/agents_api/routers/agents/list_agents.py @@ -30,7 +30,9 @@ async def list_agents( offset=offset, sort_by=sort_by, direction=direction, - metadata_filter=metadata_filter.model_dump(mode="json"), + metadata_filter=metadata_filter.model_dump(mode="json") + if metadata_filter + else {}, ) return ListResponse[Agent](items=agents) diff --git a/agents-api/agents_api/routers/docs/list_docs.py b/agents-api/agents_api/routers/docs/list_docs.py index 0cd823919..f342f4b4b 100644 --- a/agents-api/agents_api/routers/docs/list_docs.py +++ b/agents-api/agents_api/routers/docs/list_docs.py @@ -32,7 +32,9 @@ async def list_user_docs( offset=offset, sort_by=sort_by, direction=direction, - metadata_filter=metadata_filter.model_dump(mode="json"), + metadata_filter=metadata_filter.model_dump(mode="json") + if metadata_filter + else {}, ) return ListResponse[Doc](items=docs) @@ -58,7 +60,9 @@ async def list_agent_docs( offset=offset, sort_by=sort_by, direction=direction, - metadata_filter=metadata_filter.model_dump(mode="json"), + metadata_filter=metadata_filter.model_dump(mode="json") + if metadata_filter + else {}, ) return ListResponse[Doc](items=docs) diff --git a/agents-api/agents_api/routers/sessions/list_sessions.py b/agents-api/agents_api/routers/sessions/list_sessions.py index ae011fb18..157b9f681 100644 --- a/agents-api/agents_api/routers/sessions/list_sessions.py +++ b/agents-api/agents_api/routers/sessions/list_sessions.py @@ -29,7 +29,9 @@ async def list_sessions( offset=offset, sort_by=sort_by, direction=direction, - metadata_filter=metadata_filter.model_dump(mode="json"), + metadata_filter=metadata_filter.model_dump(mode="json") + if metadata_filter + else {}, ) return ListResponse[Session](items=sessions)