-
Notifications
You must be signed in to change notification settings - Fork 166
Description
Issue you'd like to raise.
When calling threads.search from the SDK in our Next.js app, any select and sort_by/sort_order fields we pass are not included in the outgoing request body. The server responds with full thread objects that include values (messages), which is unnecessary for our view and increases payload size significantly.
Environment
SDK: @langchain/langgraph-sdk (web client)
App: Next.js 15 (App Router)
Auth: Supabase or LangSmith proxy (both paths tested)
Endpoint: Deployment proxied via /langgraph/proxy/[deploymentId] or direct deployment URL
The code:
const threads = await client.threads.search({
ids: [],
limit: 50,
metadata: { assistant_id: emp.assistant_id },
// Limit payload size: we only need ids, timestamps, status, metadata for usage grouping
select: [
"thread_id",
"created_at",
"updated_at",
"status",
"metadata",
],
sort_by: "created_at",
sort_order: "desc",
} as any);
Although I had select, and sort_by in the request, observe the actual network request body:
{"metadata":{"assistant_id":"a5aca15e-d6c2-46e5-81f6-13c7a09a25b1"},"limit":50,"offset":0}
The select and sort_* fields are missing from the payload.
The response contains full thread objects including values.messages, which we don’t need in this context.
Not sure what I'm doing wrong
Suggestion:
No response