feat: make agent_id optional in conversations list endpoint [LET-7612] (#9585)

* feat: make agent_id optional in conversations list endpoint [LET-7612]

Allow listing all conversations without filtering by agent_id.

**Router changes (conversations.py):**
- Changed agent_id from required (`...`) to optional (`None`)
- Updated description to clarify behavior
- Updated docstring to reflect optional filtering

**Manager changes (conversation_manager.py):**
- Updated list_conversations signature: agent_id: str → Optional[str]
- Updated docstring to clarify optional behavior
- Summary search query: conditionally adds agent_id filter only if provided
- Default list logic: passes agent_id (can be None) to list_async

**How it works:**
- Without agent_id: returns all conversations for the user's organization
- With agent_id: returns conversations filtered by that agent
- list_async handles None gracefully via **kwargs pattern

**Use case:**
- Cloud UI can list all user conversations across agents
- Still supports filtering by agent_id when needed

🐾 Generated with [Letta Code](https://letta.com)

Co-Authored-By: Letta <noreply@letta.com>

* chore: update logs

* chore: update logs

---------

Co-authored-by: Letta <noreply@letta.com>
This commit is contained in:
Shubham Naik
2026-02-20 12:29:21 -08:00
committed by Caren Thomas
parent 257b99923b
commit 73c824f5d2
3 changed files with 29 additions and 18 deletions

View File

@@ -8718,19 +8718,26 @@
"get": {
"tags": ["conversations"],
"summary": "List Conversations",
"description": "List all conversations for an agent.",
"description": "List all conversations for an agent (or all conversations if agent_id not provided).",
"operationId": "list_conversations",
"parameters": [
{
"name": "agent_id",
"in": "query",
"required": true,
"required": false,
"schema": {
"type": "string",
"description": "The agent ID to list conversations for",
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"description": "The agent ID to list conversations for (optional - returns all conversations if not provided)",
"title": "Agent Id"
},
"description": "The agent ID to list conversations for"
"description": "The agent ID to list conversations for (optional - returns all conversations if not provided)"
},
{
"name": "limit",