diff --git a/libs/sdk-js/src/client.ts b/libs/sdk-js/src/client.ts index 32e75017b..04b6537e0 100644 --- a/libs/sdk-js/src/client.ts +++ b/libs/sdk-js/src/client.ts @@ -15,6 +15,7 @@ import { SearchItemsResponse, ListNamespaceResponse, Item, + ThreadStatus, } from "./schema.js"; import { AsyncCaller, AsyncCallerParams } from "./utils/async_caller.js"; import { @@ -515,6 +516,11 @@ export class ThreadsClient extends BaseClient { * Offset to start from. */ offset?: number; + /** + * Thread status to filter on. + * Must be one of 'idle', 'busy', 'interrupted' or 'error'. + */ + status?: ThreadStatus; }): Promise { return this.fetch("/threads/search", { method: "POST", @@ -522,6 +528,7 @@ export class ThreadsClient extends BaseClient { metadata: query?.metadata ?? undefined, limit: query?.limit ?? 10, offset: query?.offset ?? 0, + status: query?.status, }, }); } diff --git a/libs/sdk-js/src/schema.ts b/libs/sdk-js/src/schema.ts index c2de251f6..cf2da3c49 100644 --- a/libs/sdk-js/src/schema.ts +++ b/libs/sdk-js/src/schema.ts @@ -10,7 +10,7 @@ type RunStatus = | "timeout" | "interrupted"; -type ThreadStatus = "idle" | "busy" | "interrupted" | "error"; +export type ThreadStatus = "idle" | "busy" | "interrupted" | "error"; type MultitaskStrategy = "reject" | "interrupt" | "rollback" | "enqueue";