Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.
feat: add include param to all backend list agents helpers (#5699)
cthomas875908cb4482
diff --git a/letta/services/agent_manager.py b/letta/services/agent_manager.pyindex 655a9d2f4..27c4e5b46 100644--- a/letta/services/agent_manager.py+++ b/letta/services/agent_manager.py@@ -871,6 +871,7 @@ class AgentManager:identity_id: Optional[str] = None,identifier_keys: Optional[List[str]] = None,include_relationships: Optional[List[str]] = None,+ include: List[str] = [],ascending: bool = True,sort_by: Optional[str] = "created_at",show_hidden_agents: Optional[bool] = None,@@ -908,7 +909,7 @@ class AgentManager:query = _apply_filters(query, name, query_text, project_id, template_id, base_template_id)query = _apply_identity_filters(query, identity_id, identifier_keys)query = _apply_tag_filter(query, tags, match_all_tags)- query = _apply_relationship_filters(query, include_relationships)+ query = _apply_relationship_filters(query, include_relationships, include)# Apply hidden filterif not show_hidden_agents:@@ -919,7 +920,9 @@ class AgentManager:query = query.limit(limit)result = await session.execute(query)agents = result.scalars().all()- return await asyncio.gather(*[agent.to_pydantic_async(include_relationships=include_relationships) for agent in agents])+ return await asyncio.gather(+ *[agent.to_pydantic_async(include_relationships=include_relationships, include=include) for agent in agents]+ )@enforce_types@trace_methoddiff --git a/letta/services/block_manager.py b/letta/services/block_manager.pyindex 1fbdce1ed..7014dd7ee 100644--- a/letta/services/block_manager.py+++ b/letta/services/block_manager.py@@ -420,6 +420,7 @@ class BlockManager:block_id: str,actor: PydanticUser,include_relationships: Optional[List[str]] = None,+ include: List[str] = [],before: Optional[str] = None,after: Optional[str] = None,limit: Optional[int] = 50,@@ -501,7 +502,9 @@ class BlockManager:result = await session.execute(query)agents_orm = result.scalars().all()- agents = await asyncio.gather(*[agent.to_pydantic_async(include_relationships=include_relationships) for agent in agents_orm])+ agents = await asyncio.gather(+ *[agent.to_pydantic_async(include_relationships=include_relationships, include=include) for agent in agents_orm]+ )return agents@enforce_typesdiff --git a/letta/services/identity_manager.py b/letta/services/identity_manager.pyindex f84d5d732..6d3ff76b2 100644--- a/letta/services/identity_manager.py+++ b/letta/services/identity_manager.py@@ -294,6 +294,7 @@ class IdentityManager:after: Optional[str] = None,limit: Optional[int] = 50,ascending: bool = False,+ include: List[str] = [],actor: PydanticUser = None,) -> List[AgentState]:"""@@ -314,7 +315,7 @@ class IdentityManager:ascending=ascending,identity_id=identity.id,)- return await asyncio.gather(*[agent.to_pydantic_async() for agent in agents])+ return await asyncio.gather(*[agent.to_pydantic_async(include_relationships=[], include=include) for agent in agents])@enforce_types@trace_method