RunsClient.create: support stateless Run creation (#1694)

Co-authored-by: David Duong <david@duong.cz>
This commit is contained in:
Will Badart
2025-09-30 04:22:06 -07:00
committed by GitHub
parent c115fe9409
commit 02beb41e76
2 changed files with 8 additions and 2 deletions
+5
View File
@@ -0,0 +1,5 @@
---
"@langchain/langgraph-sdk": patch
---
Add support for creating stateless runs
+3 -2
View File
@@ -1178,7 +1178,7 @@ export class RunsClient<
* @returns The created run.
*/
async create(
threadId: string,
threadId: string | null,
assistantId: string,
payload?: RunsCreatePayload
): Promise<Run> {
@@ -1210,7 +1210,8 @@ export class RunsClient<
: undefined,
};
const [run, response] = await this.fetch<Run>(`/threads/${threadId}/runs`, {
const endpoint = threadId === null ? "/runs" : `/threads/${threadId}/runs`;
const [run, response] = await this.fetch<Run>(endpoint, {
method: "POST",
json,
signal: payload?.signal,