Repository navigation
✨ feat: Read Conversation Metadata Through the Agents API - #18490
Open
dustinhealy wants to merge 2 commits into
Open
dustinhealy wants to merge 2 commits into
dustinhealy wants to merge 2 commits into
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The label-length cap rejects filters for valid stored labels longer than 256 characters, causing HTTP 400 when filtering by labels returned in conversation metadata.
1 open issue
What changed in this PR
Adds read-only conversation metadata endpoints to the Agents API, providing a focused part of the broader conversation-management work in #15682. Access requires explicit opt-in on an OIDC client binding and uses the bound account’s owner and tenant scope.
Changes:
- Adds list and detail reads with archive, agent, and exact-tag filters.
- Implements cursor pagination for tied and missing timestamps, with shared conversation visibility rules.
- Adds access checks, API documentation, and authentication and end-to-end tests.
| File | Description |
|---|---|
packages/data-schemas/src/methods/index.ts |
Registers metadata database methods. |
packages/data-schemas/src/methods/conversationMetadata.ts |
Implements scoped queries, projection, and pagination. |
packages/data-schemas/src/index.ts |
Exports metadata types. |
packages/data-provider/src/config.ts |
Adds the conversationRead binding option. |
packages/api/src/openapi/registry.ts |
Registers conversation schemas and endpoints. |
packages/api/src/openapi/document.ts |
Updates the API description to include conversations. |
packages/api/src/openapi/conversations.ts |
Defines list and detail API contracts. |
packages/api/src/middleware/management.ts |
Enforces explicit conversation-read access. |
packages/api/src/middleware/management.spec.ts |
Tests opt-in admission and principal resolution. |
packages/api/src/conversations/metadata.ts |
Adds validation, cursors, and HTTP handlers. |
packages/api/src/conversations/index.ts |
Exports metadata handlers and schemas. |
packages/api/openapi/agents.openapi.json |
Publishes generated conversation contracts. |
e2e/specs/mock/conversation-metadata.spec.ts |
Tests filtering, pagination, visibility, and detail reads. |
e2e/setup/agent-management.ts |
Enables conversation reads for the test binding. |
docs/conversation-metadata-api.md |
Documents configuration and endpoint behavior. |
api/server/routes/agents/middleware.js |
Wires conversation-read authentication. |
api/server/routes/agents/index.js |
Mounts the conversation router. |
api/server/routes/agents/conversations.js |
Connects authentication, middleware, and read handlers. |
Review effort: Balanced
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
The Agents API exposes
GET /api/agents/v1/conversationsandGET /api/agents/v1/conversations/{id}for the LibreChat account bound to a management OIDC client. Operators enable access per binding withconversationRead: trueunderendpoints.agents.managementApi.auth.clients.The list supports archive, agent and exact tag filters. The cursor preserves ordering when timestamps tie and when older conversations have no update timestamp. Both routes use the account and tenant resolved by the existing management authentication flow and return a fixed metadata projection.
Related to #15682
How it works
The Express router wires the existing management OIDC verifier to the read handlers in
packages/api. The data-schemas query applies the owner, tenant and conversation visibility predicates before returning its projection. The generated OpenAPI contract describes both reads.Type of change
Testing
Screenshots / recordings
No user interface change.
Risk / compatibility
Existing client bindings require explicit opt-in. The new reads use existing indexes and keep the result page at 100 rows or fewer. On a synthetic fixture with 5,000 conversations for the bound account, the first and deep 20-row pages examined 22 and 23 documents. A sparse or absent tag filter used an owner-bounded index and examined 9,000 document entries, including repeated fetches across visibility branches. The median was 3.3 ms across ten warm local samples. No production latency measurement was taken.
Checklist