From 4abf94846241f3546a0194efd40e109745e7d005 Mon Sep 17 00:00:00 2001 From: lc-arjun Date: Mon, 7 Jul 2025 08:05:46 -0700 Subject: [PATCH] docs: add -tunnel flag for node server (#5373) add -tunnel flag for node server --- docs/docs/troubleshooting/studio.md | 4 +- libs/sdk-js/client.cjs | 1 + libs/sdk-js/client.d.cts | 1 + libs/sdk-js/client.d.ts | 1 + libs/sdk-js/client.js | 1 + libs/sdk-js/docs/README.md | 26 + libs/sdk-js/docs/auth/README.md | 18 + libs/sdk-js/docs/auth/classes/Auth.md | 75 +++ .../sdk-js/docs/auth/classes/HTTPException.md | 185 +++++++ .../docs/auth/interfaces/AuthEventValueMap.md | 481 ++++++++++++++++++ .../docs/auth/type-aliases/AuthFilters.md | 15 + libs/sdk-js/docs/classes/AssistantsClient.md | 385 ++++++++++++++ libs/sdk-js/docs/classes/Client.md | 98 ++++ libs/sdk-js/docs/classes/CronsClient.md | 151 ++++++ libs/sdk-js/docs/classes/RunsClient.md | 469 +++++++++++++++++ libs/sdk-js/docs/classes/StoreClient.md | 314 ++++++++++++ libs/sdk-js/docs/classes/ThreadsClient.md | 433 ++++++++++++++++ libs/sdk-js/docs/functions/getApiKey.md | 32 ++ libs/sdk-js/docs/interfaces/ClientConfig.md | 57 +++ libs/sdk-js/docs/react/README.md | 18 + libs/sdk-js/docs/react/functions/useStream.md | 27 + .../sdk-js/docs/react/interfaces/UseStream.md | 227 +++++++++ .../docs/react/interfaces/UseStreamOptions.md | 343 +++++++++++++ .../react/type-aliases/MessageMetadata.md | 42 ++ libs/sdk-js/docs/type-aliases/RequestHook.md | 25 + libs/sdk-js/index.cjs | 1 + libs/sdk-js/index.d.cts | 1 + libs/sdk-js/index.d.ts | 1 + libs/sdk-js/index.js | 1 + libs/sdk-js/react.cjs | 1 + libs/sdk-js/react.d.cts | 1 + libs/sdk-js/react.d.ts | 1 + libs/sdk-js/react.js | 1 + 33 files changed, 3435 insertions(+), 2 deletions(-) create mode 100644 libs/sdk-js/client.cjs create mode 100644 libs/sdk-js/client.d.cts create mode 100644 libs/sdk-js/client.d.ts create mode 100644 libs/sdk-js/client.js create mode 100644 libs/sdk-js/docs/README.md create mode 100644 libs/sdk-js/docs/auth/README.md create mode 100644 libs/sdk-js/docs/auth/classes/Auth.md create mode 100644 libs/sdk-js/docs/auth/classes/HTTPException.md create mode 100644 libs/sdk-js/docs/auth/interfaces/AuthEventValueMap.md create mode 100644 libs/sdk-js/docs/auth/type-aliases/AuthFilters.md create mode 100644 libs/sdk-js/docs/classes/AssistantsClient.md create mode 100644 libs/sdk-js/docs/classes/Client.md create mode 100644 libs/sdk-js/docs/classes/CronsClient.md create mode 100644 libs/sdk-js/docs/classes/RunsClient.md create mode 100644 libs/sdk-js/docs/classes/StoreClient.md create mode 100644 libs/sdk-js/docs/classes/ThreadsClient.md create mode 100644 libs/sdk-js/docs/functions/getApiKey.md create mode 100644 libs/sdk-js/docs/interfaces/ClientConfig.md create mode 100644 libs/sdk-js/docs/react/README.md create mode 100644 libs/sdk-js/docs/react/functions/useStream.md create mode 100644 libs/sdk-js/docs/react/interfaces/UseStream.md create mode 100644 libs/sdk-js/docs/react/interfaces/UseStreamOptions.md create mode 100644 libs/sdk-js/docs/react/type-aliases/MessageMetadata.md create mode 100644 libs/sdk-js/docs/type-aliases/RequestHook.md create mode 100644 libs/sdk-js/index.cjs create mode 100644 libs/sdk-js/index.d.cts create mode 100644 libs/sdk-js/index.d.ts create mode 100644 libs/sdk-js/index.js create mode 100644 libs/sdk-js/react.cjs create mode 100644 libs/sdk-js/react.d.cts create mode 100644 libs/sdk-js/react.d.ts create mode 100644 libs/sdk-js/react.js diff --git a/docs/docs/troubleshooting/studio.md b/docs/docs/troubleshooting/studio.md index b06f325de..3fcbdea7f 100644 --- a/docs/docs/troubleshooting/studio.md +++ b/docs/docs/troubleshooting/studio.md @@ -17,7 +17,7 @@ Safari blocks plain-HTTP traffic on localhost. When running Studio with `langgra ```shell # Requires @langchain/langgraph-cli>=0.0.26 - npx @langchain/langgraph-cli dev + npx @langchain/langgraph-cli dev --tunnel ``` The command outputs a URL in this format: @@ -55,7 +55,7 @@ Disable Brave Shields for LangSmith using the Brave icon in the URL bar. ```shell # Requires @langchain/langgraph-cli>=0.0.26 - npx @langchain/langgraph-cli dev + npx @langchain/langgraph-cli dev --tunnel ``` The command outputs a URL in this format: diff --git a/libs/sdk-js/client.cjs b/libs/sdk-js/client.cjs new file mode 100644 index 000000000..680e5bd38 --- /dev/null +++ b/libs/sdk-js/client.cjs @@ -0,0 +1 @@ +module.exports = require('./dist/client.cjs'); \ No newline at end of file diff --git a/libs/sdk-js/client.d.cts b/libs/sdk-js/client.d.cts new file mode 100644 index 000000000..1c03ff9cb --- /dev/null +++ b/libs/sdk-js/client.d.cts @@ -0,0 +1 @@ +export * from './dist/client.js' \ No newline at end of file diff --git a/libs/sdk-js/client.d.ts b/libs/sdk-js/client.d.ts new file mode 100644 index 000000000..1c03ff9cb --- /dev/null +++ b/libs/sdk-js/client.d.ts @@ -0,0 +1 @@ +export * from './dist/client.js' \ No newline at end of file diff --git a/libs/sdk-js/client.js b/libs/sdk-js/client.js new file mode 100644 index 000000000..1c03ff9cb --- /dev/null +++ b/libs/sdk-js/client.js @@ -0,0 +1 @@ +export * from './dist/client.js' \ No newline at end of file diff --git a/libs/sdk-js/docs/README.md b/libs/sdk-js/docs/README.md new file mode 100644 index 000000000..a1627b448 --- /dev/null +++ b/libs/sdk-js/docs/README.md @@ -0,0 +1,26 @@ +**@langchain/langgraph-sdk** + +*** + +# @langchain/langgraph-sdk + +## Classes + +- [AssistantsClient](classes/AssistantsClient.md) +- [Client](classes/Client.md) +- [CronsClient](classes/CronsClient.md) +- [RunsClient](classes/RunsClient.md) +- [StoreClient](classes/StoreClient.md) +- [ThreadsClient](classes/ThreadsClient.md) + +## Interfaces + +- [ClientConfig](interfaces/ClientConfig.md) + +## Type Aliases + +- [RequestHook](type-aliases/RequestHook.md) + +## Functions + +- [getApiKey](functions/getApiKey.md) diff --git a/libs/sdk-js/docs/auth/README.md b/libs/sdk-js/docs/auth/README.md new file mode 100644 index 000000000..351cb8490 --- /dev/null +++ b/libs/sdk-js/docs/auth/README.md @@ -0,0 +1,18 @@ +**@langchain/langgraph-sdk** + +*** + +# @langchain/langgraph-sdk/auth + +## Classes + +- [Auth](classes/Auth.md) +- [HTTPException](classes/HTTPException.md) + +## Interfaces + +- [AuthEventValueMap](interfaces/AuthEventValueMap.md) + +## Type Aliases + +- [AuthFilters](type-aliases/AuthFilters.md) diff --git a/libs/sdk-js/docs/auth/classes/Auth.md b/libs/sdk-js/docs/auth/classes/Auth.md new file mode 100644 index 000000000..4b4cc618a --- /dev/null +++ b/libs/sdk-js/docs/auth/classes/Auth.md @@ -0,0 +1,75 @@ +[**@langchain/langgraph-sdk**](../README.md) + +*** + +[@langchain/langgraph-sdk](../README.md) / Auth + +# Class: Auth\ + +Defined in: [src/auth/index.ts:11](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/auth/index.ts#L11) + +## Type Parameters + +• **TExtra** = \{\} + +• **TAuthReturn** *extends* `BaseAuthReturn` = `BaseAuthReturn` + +• **TUser** *extends* `BaseUser` = `ToUserLike`\<`TAuthReturn`\> + +## Constructors + +### new Auth() + +> **new Auth**\<`TExtra`, `TAuthReturn`, `TUser`\>(): [`Auth`](Auth.md)\<`TExtra`, `TAuthReturn`, `TUser`\> + +#### Returns + +[`Auth`](Auth.md)\<`TExtra`, `TAuthReturn`, `TUser`\> + +## Methods + +### authenticate() + +> **authenticate**\<`T`\>(`cb`): [`Auth`](Auth.md)\<`TExtra`, `T`\> + +Defined in: [src/auth/index.ts:25](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/auth/index.ts#L25) + +#### Type Parameters + +• **T** *extends* `BaseAuthReturn` + +#### Parameters + +##### cb + +`AuthenticateCallback`\<`T`\> + +#### Returns + +[`Auth`](Auth.md)\<`TExtra`, `T`\> + +*** + +### on() + +> **on**\<`T`\>(`event`, `callback`): `this` + +Defined in: [src/auth/index.ts:32](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/auth/index.ts#L32) + +#### Type Parameters + +• **T** *extends* `CallbackEvent` + +#### Parameters + +##### event + +`T` + +##### callback + +`OnCallback`\<`T`, `TUser`\> + +#### Returns + +`this` diff --git a/libs/sdk-js/docs/auth/classes/HTTPException.md b/libs/sdk-js/docs/auth/classes/HTTPException.md new file mode 100644 index 000000000..0db191af5 --- /dev/null +++ b/libs/sdk-js/docs/auth/classes/HTTPException.md @@ -0,0 +1,185 @@ +[**@langchain/langgraph-sdk**](../README.md) + +*** + +[@langchain/langgraph-sdk](../README.md) / HTTPException + +# Class: HTTPException + +Defined in: [src/auth/error.ts:66](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/auth/error.ts#L66) + +## Extends + +- `Error` + +## Constructors + +### new HTTPException() + +> **new HTTPException**(`status`, `options`?): [`HTTPException`](HTTPException.md) + +Defined in: [src/auth/error.ts:70](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/auth/error.ts#L70) + +#### Parameters + +##### status + +`number` + +##### options? + +###### cause? + +`unknown` + +###### headers? + +`HeadersInit` + +###### message? + +`string` + +#### Returns + +[`HTTPException`](HTTPException.md) + +#### Overrides + +`Error.constructor` + +## Properties + +### cause? + +> `optional` **cause**: `unknown` + +Defined in: node\_modules/typescript/lib/lib.es2022.error.d.ts:24 + +#### Inherited from + +`Error.cause` + +*** + +### headers + +> **headers**: `HeadersInit` + +Defined in: [src/auth/error.ts:68](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/auth/error.ts#L68) + +*** + +### message + +> **message**: `string` + +Defined in: node\_modules/typescript/lib/lib.es5.d.ts:1077 + +#### Inherited from + +`Error.message` + +*** + +### name + +> **name**: `string` + +Defined in: node\_modules/typescript/lib/lib.es5.d.ts:1076 + +#### Inherited from + +`Error.name` + +*** + +### stack? + +> `optional` **stack**: `string` + +Defined in: node\_modules/typescript/lib/lib.es5.d.ts:1078 + +#### Inherited from + +`Error.stack` + +*** + +### status + +> **status**: `number` + +Defined in: [src/auth/error.ts:67](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/auth/error.ts#L67) + +*** + +### prepareStackTrace()? + +> `static` `optional` **prepareStackTrace**: (`err`, `stackTraces`) => `any` + +Defined in: node\_modules/@types/node/globals.d.ts:28 + +Optional override for formatting stack traces + +#### Parameters + +##### err + +`Error` + +##### stackTraces + +`CallSite`[] + +#### Returns + +`any` + +#### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +#### Inherited from + +`Error.prepareStackTrace` + +*** + +### stackTraceLimit + +> `static` **stackTraceLimit**: `number` + +Defined in: node\_modules/@types/node/globals.d.ts:30 + +#### Inherited from + +`Error.stackTraceLimit` + +## Methods + +### captureStackTrace() + +> `static` **captureStackTrace**(`targetObject`, `constructorOpt`?): `void` + +Defined in: node\_modules/@types/node/globals.d.ts:21 + +Create .stack property on a target object + +#### Parameters + +##### targetObject + +`object` + +##### constructorOpt? + +`Function` + +#### Returns + +`void` + +#### Inherited from + +`Error.captureStackTrace` diff --git a/libs/sdk-js/docs/auth/interfaces/AuthEventValueMap.md b/libs/sdk-js/docs/auth/interfaces/AuthEventValueMap.md new file mode 100644 index 000000000..686e1a39b --- /dev/null +++ b/libs/sdk-js/docs/auth/interfaces/AuthEventValueMap.md @@ -0,0 +1,481 @@ +[**@langchain/langgraph-sdk**](../README.md) + +*** + +[@langchain/langgraph-sdk](../README.md) / AuthEventValueMap + +# Interface: AuthEventValueMap + +Defined in: [src/auth/types.ts:218](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/auth/types.ts#L218) + +## Properties + +### assistants:create + +> **assistants:create**: `object` + +Defined in: [src/auth/types.ts:226](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/auth/types.ts#L226) + +#### assistant\_id? + +> `optional` **assistant\_id**: `Maybe`\<`string`\> + +#### config? + +> `optional` **config**: `Maybe`\<`AssistantConfig`\> + +#### graph\_id + +> **graph\_id**: `string` + +#### if\_exists? + +> `optional` **if\_exists**: `Maybe`\<`"raise"` \| `"do_nothing"`\> + +#### metadata? + +> `optional` **metadata**: `Maybe`\<`Record`\<`string`, `unknown`\>\> + +#### name? + +> `optional` **name**: `Maybe`\<`string`\> + +*** + +### assistants:delete + +> **assistants:delete**: `object` + +Defined in: [src/auth/types.ts:229](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/auth/types.ts#L229) + +#### assistant\_id + +> **assistant\_id**: `string` + +*** + +### assistants:read + +> **assistants:read**: `object` + +Defined in: [src/auth/types.ts:227](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/auth/types.ts#L227) + +#### assistant\_id + +> **assistant\_id**: `string` + +#### metadata? + +> `optional` **metadata**: `Maybe`\<`Record`\<`string`, `unknown`\>\> + +*** + +### assistants:search + +> **assistants:search**: `object` + +Defined in: [src/auth/types.ts:230](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/auth/types.ts#L230) + +#### graph\_id? + +> `optional` **graph\_id**: `Maybe`\<`string`\> + +#### limit? + +> `optional` **limit**: `Maybe`\<`number`\> + +#### metadata? + +> `optional` **metadata**: `Maybe`\<`Record`\<`string`, `unknown`\>\> + +#### offset? + +> `optional` **offset**: `Maybe`\<`number`\> + +*** + +### assistants:update + +> **assistants:update**: `object` + +Defined in: [src/auth/types.ts:228](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/auth/types.ts#L228) + +#### assistant\_id + +> **assistant\_id**: `string` + +#### config? + +> `optional` **config**: `Maybe`\<`AssistantConfig`\> + +#### graph\_id? + +> `optional` **graph\_id**: `Maybe`\<`string`\> + +#### metadata? + +> `optional` **metadata**: `Maybe`\<`Record`\<`string`, `unknown`\>\> + +#### name? + +> `optional` **name**: `Maybe`\<`string`\> + +#### version? + +> `optional` **version**: `Maybe`\<`number`\> + +*** + +### crons:create + +> **crons:create**: `object` + +Defined in: [src/auth/types.ts:232](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/auth/types.ts#L232) + +#### cron\_id? + +> `optional` **cron\_id**: `Maybe`\<`string`\> + +#### end\_time? + +> `optional` **end\_time**: `Maybe`\<`string`\> + +#### payload? + +> `optional` **payload**: `Maybe`\<`Record`\<`string`, `unknown`\>\> + +#### schedule + +> **schedule**: `string` + +#### thread\_id? + +> `optional` **thread\_id**: `Maybe`\<`string`\> + +#### user\_id? + +> `optional` **user\_id**: `Maybe`\<`string`\> + +*** + +### crons:delete + +> **crons:delete**: `object` + +Defined in: [src/auth/types.ts:235](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/auth/types.ts#L235) + +#### cron\_id + +> **cron\_id**: `string` + +*** + +### crons:read + +> **crons:read**: `object` + +Defined in: [src/auth/types.ts:233](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/auth/types.ts#L233) + +#### cron\_id + +> **cron\_id**: `string` + +*** + +### crons:search + +> **crons:search**: `object` + +Defined in: [src/auth/types.ts:236](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/auth/types.ts#L236) + +#### assistant\_id? + +> `optional` **assistant\_id**: `Maybe`\<`string`\> + +#### limit? + +> `optional` **limit**: `Maybe`\<`number`\> + +#### offset? + +> `optional` **offset**: `Maybe`\<`number`\> + +#### thread\_id? + +> `optional` **thread\_id**: `Maybe`\<`string`\> + +*** + +### crons:update + +> **crons:update**: `object` + +Defined in: [src/auth/types.ts:234](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/auth/types.ts#L234) + +#### cron\_id + +> **cron\_id**: `string` + +#### payload? + +> `optional` **payload**: `Maybe`\<`Record`\<`string`, `unknown`\>\> + +#### schedule? + +> `optional` **schedule**: `Maybe`\<`string`\> + +*** + +### store:delete + +> **store:delete**: `object` + +Defined in: [src/auth/types.ts:242](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/auth/types.ts#L242) + +#### key + +> **key**: `string` + +#### namespace? + +> `optional` **namespace**: `Maybe`\<`string`[]\> + +*** + +### store:get + +> **store:get**: `object` + +Defined in: [src/auth/types.ts:239](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/auth/types.ts#L239) + +#### key + +> **key**: `string` + +#### namespace + +> **namespace**: `Maybe`\<`string`[]\> + +*** + +### store:list\_namespaces + +> **store:list\_namespaces**: `object` + +Defined in: [src/auth/types.ts:241](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/auth/types.ts#L241) + +#### limit? + +> `optional` **limit**: `Maybe`\<`number`\> + +#### max\_depth? + +> `optional` **max\_depth**: `Maybe`\<`number`\> + +#### namespace? + +> `optional` **namespace**: `Maybe`\<`string`[]\> + +#### offset? + +> `optional` **offset**: `Maybe`\<`number`\> + +#### suffix? + +> `optional` **suffix**: `Maybe`\<`string`[]\> + +*** + +### store:put + +> **store:put**: `object` + +Defined in: [src/auth/types.ts:238](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/auth/types.ts#L238) + +#### key + +> **key**: `string` + +#### namespace + +> **namespace**: `string`[] + +#### value + +> **value**: `Record`\<`string`, `unknown`\> + +*** + +### store:search + +> **store:search**: `object` + +Defined in: [src/auth/types.ts:240](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/auth/types.ts#L240) + +#### filter? + +> `optional` **filter**: `Maybe`\<`Record`\<`string`, `unknown`\>\> + +#### limit? + +> `optional` **limit**: `Maybe`\<`number`\> + +#### namespace? + +> `optional` **namespace**: `Maybe`\<`string`[]\> + +#### offset? + +> `optional` **offset**: `Maybe`\<`number`\> + +#### query? + +> `optional` **query**: `Maybe`\<`string`\> + +*** + +### threads:create + +> **threads:create**: `object` + +Defined in: [src/auth/types.ts:219](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/auth/types.ts#L219) + +#### if\_exists? + +> `optional` **if\_exists**: `Maybe`\<`"raise"` \| `"do_nothing"`\> + +#### metadata? + +> `optional` **metadata**: `Maybe`\<`Record`\<`string`, `unknown`\>\> + +#### thread\_id? + +> `optional` **thread\_id**: `Maybe`\<`string`\> + +*** + +### threads:create\_run + +> **threads:create\_run**: `object` + +Defined in: [src/auth/types.ts:224](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/auth/types.ts#L224) + +#### after\_seconds? + +> `optional` **after\_seconds**: `Maybe`\<`number`\> + +#### assistant\_id + +> **assistant\_id**: `string` + +#### if\_not\_exists? + +> `optional` **if\_not\_exists**: `Maybe`\<`"reject"` \| `"create"`\> + +#### kwargs + +> **kwargs**: `Record`\<`string`, `unknown`\> + +#### metadata? + +> `optional` **metadata**: `Maybe`\<`Record`\<`string`, `unknown`\>\> + +#### multitask\_strategy? + +> `optional` **multitask\_strategy**: `Maybe`\<`"reject"` \| `"interrupt"` \| `"rollback"` \| `"enqueue"`\> + +#### prevent\_insert\_if\_inflight? + +> `optional` **prevent\_insert\_if\_inflight**: `Maybe`\<`boolean`\> + +#### run\_id + +> **run\_id**: `string` + +#### status + +> **status**: `Maybe`\<`"pending"` \| `"running"` \| `"error"` \| `"success"` \| `"timeout"` \| `"interrupted"`\> + +#### thread\_id? + +> `optional` **thread\_id**: `Maybe`\<`string`\> + +*** + +### threads:delete + +> **threads:delete**: `object` + +Defined in: [src/auth/types.ts:222](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/auth/types.ts#L222) + +#### run\_id? + +> `optional` **run\_id**: `Maybe`\<`string`\> + +#### thread\_id? + +> `optional` **thread\_id**: `Maybe`\<`string`\> + +*** + +### threads:read + +> **threads:read**: `object` + +Defined in: [src/auth/types.ts:220](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/auth/types.ts#L220) + +#### thread\_id? + +> `optional` **thread\_id**: `Maybe`\<`string`\> + +*** + +### threads:search + +> **threads:search**: `object` + +Defined in: [src/auth/types.ts:223](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/auth/types.ts#L223) + +#### limit? + +> `optional` **limit**: `Maybe`\<`number`\> + +#### metadata? + +> `optional` **metadata**: `Maybe`\<`Record`\<`string`, `unknown`\>\> + +#### offset? + +> `optional` **offset**: `Maybe`\<`number`\> + +#### status? + +> `optional` **status**: `Maybe`\<`"error"` \| `"interrupted"` \| `"idle"` \| `"busy"` \| `string` & `object`\> + +#### thread\_id? + +> `optional` **thread\_id**: `Maybe`\<`string`\> + +#### values? + +> `optional` **values**: `Maybe`\<`Record`\<`string`, `unknown`\>\> + +*** + +### threads:update + +> **threads:update**: `object` + +Defined in: [src/auth/types.ts:221](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/auth/types.ts#L221) + +#### action? + +> `optional` **action**: `Maybe`\<`"interrupt"` \| `"rollback"`\> + +#### metadata? + +> `optional` **metadata**: `Maybe`\<`Record`\<`string`, `unknown`\>\> + +#### thread\_id? + +> `optional` **thread\_id**: `Maybe`\<`string`\> diff --git a/libs/sdk-js/docs/auth/type-aliases/AuthFilters.md b/libs/sdk-js/docs/auth/type-aliases/AuthFilters.md new file mode 100644 index 000000000..b9b2e1fb2 --- /dev/null +++ b/libs/sdk-js/docs/auth/type-aliases/AuthFilters.md @@ -0,0 +1,15 @@ +[**@langchain/langgraph-sdk**](../README.md) + +*** + +[@langchain/langgraph-sdk](../README.md) / AuthFilters + +# Type Alias: AuthFilters\ + +> **AuthFilters**\<`TKey`\>: \{ \[key in TKey\]: string \| \{ \[op in "$contains" \| "$eq"\]?: string \} \} + +Defined in: [src/auth/types.ts:367](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/auth/types.ts#L367) + +## Type Parameters + +• **TKey** *extends* `string` \| `number` \| `symbol` diff --git a/libs/sdk-js/docs/classes/AssistantsClient.md b/libs/sdk-js/docs/classes/AssistantsClient.md new file mode 100644 index 000000000..571dc16e8 --- /dev/null +++ b/libs/sdk-js/docs/classes/AssistantsClient.md @@ -0,0 +1,385 @@ +[**@langchain/langgraph-sdk**](../README.md) + +*** + +[@langchain/langgraph-sdk](../README.md) / AssistantsClient + +# Class: AssistantsClient + +Defined in: [client.ts:431](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/client.ts#L431) + +## Extends + +- `BaseClient` + +## Constructors + +### new AssistantsClient() + +> **new AssistantsClient**(`config`?): [`AssistantsClient`](AssistantsClient.md) + +Defined in: [client.ts:183](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/client.ts#L183) + +#### Parameters + +##### config? + +[`ClientConfig`](../interfaces/ClientConfig.md) + +#### Returns + +[`AssistantsClient`](AssistantsClient.md) + +#### Inherited from + +`BaseClient.constructor` + +## Methods + +### create() + +> **create**(`payload`): `Promise`\<`Assistant`\> + +Defined in: [client.ts:496](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/client.ts#L496) + +Create a new assistant. + +#### Parameters + +##### payload + +Payload for creating an assistant. + +###### assistantId? + +`string` + +###### config? + +`Config` + +###### description? + +`string` + +###### graphId + +`string` + +###### ifExists? + +`OnConflictBehavior` + +###### metadata? + +`Metadata` + +###### name? + +`string` + +#### Returns + +`Promise`\<`Assistant`\> + +The created assistant. + +*** + +### delete() + +> **delete**(`assistantId`): `Promise`\<`void`\> + +Defined in: [client.ts:552](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/client.ts#L552) + +Delete an assistant. + +#### Parameters + +##### assistantId + +`string` + +ID of the assistant. + +#### Returns + +`Promise`\<`void`\> + +*** + +### get() + +> **get**(`assistantId`): `Promise`\<`Assistant`\> + +Defined in: [client.ts:438](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/client.ts#L438) + +Get an assistant by ID. + +#### Parameters + +##### assistantId + +`string` + +The ID of the assistant. + +#### Returns + +`Promise`\<`Assistant`\> + +Assistant + +*** + +### getGraph() + +> **getGraph**(`assistantId`, `options`?): `Promise`\<`AssistantGraph`\> + +Defined in: [client.ts:448](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/client.ts#L448) + +Get the JSON representation of the graph assigned to a runnable + +#### Parameters + +##### assistantId + +`string` + +The ID of the assistant. + +##### options? + +###### xray? + +`number` \| `boolean` + +Whether to include subgraphs in the serialized graph representation. If an integer value is provided, only subgraphs with a depth less than or equal to the value will be included. + +#### Returns + +`Promise`\<`AssistantGraph`\> + +Serialized graph + +*** + +### getSchemas() + +> **getSchemas**(`assistantId`): `Promise`\<`GraphSchema`\> + +Defined in: [client.ts:462](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/client.ts#L462) + +Get the state and config schema of the graph assigned to a runnable + +#### Parameters + +##### assistantId + +`string` + +The ID of the assistant. + +#### Returns + +`Promise`\<`GraphSchema`\> + +Graph schema + +*** + +### getSubgraphs() + +> **getSubgraphs**(`assistantId`, `options`?): `Promise`\<`Subgraphs`\> + +Defined in: [client.ts:473](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/client.ts#L473) + +Get the schemas of an assistant by ID. + +#### Parameters + +##### assistantId + +`string` + +The ID of the assistant to get the schema of. + +##### options? + +Additional options for getting subgraphs, such as namespace or recursion extraction. + +###### namespace? + +`string` + +###### recurse? + +`boolean` + +#### Returns + +`Promise`\<`Subgraphs`\> + +The subgraphs of the assistant. + +*** + +### getVersions() + +> **getVersions**(`assistantId`, `payload`?): `Promise`\<`AssistantVersion`[]\> + +Defined in: [client.ts:590](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/client.ts#L590) + +List all versions of an assistant. + +#### Parameters + +##### assistantId + +`string` + +ID of the assistant. + +##### payload? + +###### limit? + +`number` + +###### metadata? + +`Metadata` + +###### offset? + +`number` + +#### Returns + +`Promise`\<`AssistantVersion`[]\> + +List of assistant versions. + +*** + +### search() + +> **search**(`query`?): `Promise`\<`Assistant`[]\> + +Defined in: [client.ts:563](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/client.ts#L563) + +List assistants. + +#### Parameters + +##### query? + +Query options. + +###### graphId? + +`string` + +###### limit? + +`number` + +###### metadata? + +`Metadata` + +###### offset? + +`number` + +###### sortBy? + +`AssistantSortBy` + +###### sortOrder? + +`SortOrder` + +#### Returns + +`Promise`\<`Assistant`[]\> + +List of assistants. + +*** + +### setLatest() + +> **setLatest**(`assistantId`, `version`): `Promise`\<`Assistant`\> + +Defined in: [client.ts:618](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/client.ts#L618) + +Change the version of an assistant. + +#### Parameters + +##### assistantId + +`string` + +ID of the assistant. + +##### version + +`number` + +The version to change to. + +#### Returns + +`Promise`\<`Assistant`\> + +The updated assistant. + +*** + +### update() + +> **update**(`assistantId`, `payload`): `Promise`\<`Assistant`\> + +Defined in: [client.ts:525](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/client.ts#L525) + +Update an assistant. + +#### Parameters + +##### assistantId + +`string` + +ID of the assistant. + +##### payload + +Payload for updating the assistant. + +###### config? + +`Config` + +###### description? + +`string` + +###### graphId? + +`string` + +###### metadata? + +`Metadata` + +###### name? + +`string` + +#### Returns + +`Promise`\<`Assistant`\> + +The updated assistant. diff --git a/libs/sdk-js/docs/classes/Client.md b/libs/sdk-js/docs/classes/Client.md new file mode 100644 index 000000000..b0afc23de --- /dev/null +++ b/libs/sdk-js/docs/classes/Client.md @@ -0,0 +1,98 @@ +[**@langchain/langgraph-sdk**](../README.md) + +*** + +[@langchain/langgraph-sdk](../README.md) / Client + +# Class: Client\ + +Defined in: [client.ts:1620](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/client.ts#L1620) + +## Type Parameters + +• **TStateType** = `DefaultValues` + +• **TUpdateType** = `TStateType` + +• **TCustomEventType** = `unknown` + +## Constructors + +### new Client() + +> **new Client**\<`TStateType`, `TUpdateType`, `TCustomEventType`\>(`config`?): [`Client`](Client.md)\<`TStateType`, `TUpdateType`, `TCustomEventType`\> + +Defined in: [client.ts:1656](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/client.ts#L1656) + +#### Parameters + +##### config? + +[`ClientConfig`](../interfaces/ClientConfig.md) + +#### Returns + +[`Client`](Client.md)\<`TStateType`, `TUpdateType`, `TCustomEventType`\> + +## Properties + +### ~ui + +> **~ui**: `UiClient` + +Defined in: [client.ts:1654](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/client.ts#L1654) + +**`Internal`** + +The client for interacting with the UI. + Used by LoadExternalComponent and the API might change in the future. + +*** + +### assistants + +> **assistants**: [`AssistantsClient`](AssistantsClient.md) + +Defined in: [client.ts:1628](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/client.ts#L1628) + +The client for interacting with assistants. + +*** + +### crons + +> **crons**: [`CronsClient`](CronsClient.md) + +Defined in: [client.ts:1643](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/client.ts#L1643) + +The client for interacting with cron runs. + +*** + +### runs + +> **runs**: [`RunsClient`](RunsClient.md)\<`TStateType`, `TUpdateType`, `TCustomEventType`\> + +Defined in: [client.ts:1638](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/client.ts#L1638) + +The client for interacting with runs. + +*** + +### store + +> **store**: [`StoreClient`](StoreClient.md) + +Defined in: [client.ts:1648](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/client.ts#L1648) + +The client for interacting with the KV store. + +*** + +### threads + +> **threads**: [`ThreadsClient`](ThreadsClient.md)\<`TStateType`, `TUpdateType`\> + +Defined in: [client.ts:1633](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/client.ts#L1633) + +The client for interacting with threads. diff --git a/libs/sdk-js/docs/classes/CronsClient.md b/libs/sdk-js/docs/classes/CronsClient.md new file mode 100644 index 000000000..ae0017d9c --- /dev/null +++ b/libs/sdk-js/docs/classes/CronsClient.md @@ -0,0 +1,151 @@ +[**@langchain/langgraph-sdk**](../README.md) + +*** + +[@langchain/langgraph-sdk](../README.md) / CronsClient + +# Class: CronsClient + +Defined in: [client.ts:334](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/client.ts#L334) + +## Extends + +- `BaseClient` + +## Constructors + +### new CronsClient() + +> **new CronsClient**(`config`?): [`CronsClient`](CronsClient.md) + +Defined in: [client.ts:183](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/client.ts#L183) + +#### Parameters + +##### config? + +[`ClientConfig`](../interfaces/ClientConfig.md) + +#### Returns + +[`CronsClient`](CronsClient.md) + +#### Inherited from + +`BaseClient.constructor` + +## Methods + +### create() + +> **create**(`assistantId`, `payload`?): `Promise`\<`CronCreateResponse`\> + +Defined in: [client.ts:375](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/client.ts#L375) + +#### Parameters + +##### assistantId + +`string` + +Assistant ID to use for this cron job. + +##### payload? + +`CronsCreatePayload` + +Payload for creating a cron job. + +#### Returns + +`Promise`\<`CronCreateResponse`\> + +*** + +### createForThread() + +> **createForThread**(`threadId`, `assistantId`, `payload`?): `Promise`\<`CronCreateForThreadResponse`\> + +Defined in: [client.ts:342](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/client.ts#L342) + +#### Parameters + +##### threadId + +`string` + +The ID of the thread. + +##### assistantId + +`string` + +Assistant ID to use for this cron job. + +##### payload? + +`CronsCreatePayload` + +Payload for creating a cron job. + +#### Returns + +`Promise`\<`CronCreateForThreadResponse`\> + +The created background run. + +*** + +### delete() + +> **delete**(`cronId`): `Promise`\<`void`\> + +Defined in: [client.ts:402](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/client.ts#L402) + +#### Parameters + +##### cronId + +`string` + +Cron ID of Cron job to delete. + +#### Returns + +`Promise`\<`void`\> + +*** + +### search() + +> **search**(`query`?): `Promise`\<`Cron`[]\> + +Defined in: [client.ts:413](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/client.ts#L413) + +#### Parameters + +##### query? + +Query options. + +###### assistantId? + +`string` + +###### limit? + +`number` + +###### offset? + +`number` + +###### threadId? + +`string` + +#### Returns + +`Promise`\<`Cron`[]\> + +List of crons. diff --git a/libs/sdk-js/docs/classes/RunsClient.md b/libs/sdk-js/docs/classes/RunsClient.md new file mode 100644 index 000000000..15f666453 --- /dev/null +++ b/libs/sdk-js/docs/classes/RunsClient.md @@ -0,0 +1,469 @@ +[**@langchain/langgraph-sdk**](../README.md) + +*** + +[@langchain/langgraph-sdk](../README.md) / RunsClient + +# Class: RunsClient\ + +Defined in: [client.ts:912](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/client.ts#L912) + +## Extends + +- `BaseClient` + +## Type Parameters + +• **TStateType** = `DefaultValues` + +• **TUpdateType** = `TStateType` + +• **TCustomEventType** = `unknown` + +## Constructors + +### new RunsClient() + +> **new RunsClient**\<`TStateType`, `TUpdateType`, `TCustomEventType`\>(`config`?): [`RunsClient`](RunsClient.md)\<`TStateType`, `TUpdateType`, `TCustomEventType`\> + +Defined in: [client.ts:183](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/client.ts#L183) + +#### Parameters + +##### config? + +[`ClientConfig`](../interfaces/ClientConfig.md) + +#### Returns + +[`RunsClient`](RunsClient.md)\<`TStateType`, `TUpdateType`, `TCustomEventType`\> + +#### Inherited from + +`BaseClient.constructor` + +## Methods + +### cancel() + +> **cancel**(`threadId`, `runId`, `wait`, `action`): `Promise`\<`void`\> + +Defined in: [client.ts:1227](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/client.ts#L1227) + +Cancel a run. + +#### Parameters + +##### threadId + +`string` + +The ID of the thread. + +##### runId + +`string` + +The ID of the run. + +##### wait + +`boolean` = `false` + +Whether to block when canceling + +##### action + +`CancelAction` = `"interrupt"` + +Action to take when cancelling the run. Possible values are `interrupt` or `rollback`. Default is `interrupt`. + +#### Returns + +`Promise`\<`void`\> + +*** + +### create() + +> **create**(`threadId`, `assistantId`, `payload`?): `Promise`\<`Run`\> + +Defined in: [client.ts:1026](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/client.ts#L1026) + +Create a run. + +#### Parameters + +##### threadId + +`string` + +The ID of the thread. + +##### assistantId + +`string` + +Assistant ID to use for this run. + +##### payload? + +`RunsCreatePayload` + +Payload for creating a run. + +#### Returns + +`Promise`\<`Run`\> + +The created run. + +*** + +### createBatch() + +> **createBatch**(`payloads`): `Promise`\<`Run`[]\> + +Defined in: [client.ts:1076](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/client.ts#L1076) + +Create a batch of stateless background runs. + +#### Parameters + +##### payloads + +`RunsCreatePayload` & `object`[] + +An array of payloads for creating runs. + +#### Returns + +`Promise`\<`Run`[]\> + +An array of created runs. + +*** + +### delete() + +> **delete**(`threadId`, `runId`): `Promise`\<`void`\> + +Defined in: [client.ts:1329](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/client.ts#L1329) + +Delete a run. + +#### Parameters + +##### threadId + +`string` + +The ID of the thread. + +##### runId + +`string` + +The ID of the run. + +#### Returns + +`Promise`\<`void`\> + +*** + +### get() + +> **get**(`threadId`, `runId`): `Promise`\<`Run`\> + +Defined in: [client.ts:1214](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/client.ts#L1214) + +Get a run by ID. + +#### Parameters + +##### threadId + +`string` + +The ID of the thread. + +##### runId + +`string` + +The ID of the run. + +#### Returns + +`Promise`\<`Run`\> + +The run. + +*** + +### join() + +> **join**(`threadId`, `runId`, `options`?): `Promise`\<`void`\> + +Defined in: [client.ts:1249](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/client.ts#L1249) + +Block until a run is done. + +#### Parameters + +##### threadId + +`string` + +The ID of the thread. + +##### runId + +`string` + +The ID of the run. + +##### options? + +###### signal? + +`AbortSignal` + +#### Returns + +`Promise`\<`void`\> + +*** + +### joinStream() + +> **joinStream**(`threadId`, `runId`, `options`?): `AsyncGenerator`\<\{ `data`: `any`; `event`: `StreamEvent`; `id`: `string`; \}\> + +Defined in: [client.ts:1274](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/client.ts#L1274) + +Stream output from a run in real-time, until the run is done. + +#### Parameters + +##### threadId + +The ID of the thread. Can be set to `null` | `undefined` for stateless runs. + +`undefined` | `null` | `string` + +##### runId + +`string` + +The ID of the run. + +##### options? + +Additional options for controlling the stream behavior: + - signal: An AbortSignal that can be used to cancel the stream request + - lastEventId: The ID of the last event received. Can be used to reconnect to a stream without losing events. + - cancelOnDisconnect: When true, automatically cancels the run if the client disconnects from the stream + - streamMode: Controls what types of events to receive from the stream (can be a single mode or array of modes) + Must be a subset of the stream modes passed when creating the run. Background runs default to having the union of all + stream modes enabled. + +`AbortSignal` | \{ `cancelOnDisconnect`: `boolean`; `lastEventId`: `string`; `signal`: `AbortSignal`; `streamMode`: `StreamMode` \| `StreamMode`[]; \} + +#### Returns + +`AsyncGenerator`\<\{ `data`: `any`; `event`: `StreamEvent`; `id`: `string`; \}\> + +An async generator yielding stream parts. + +*** + +### list() + +> **list**(`threadId`, `options`?): `Promise`\<`Run`[]\> + +Defined in: [client.ts:1177](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/client.ts#L1177) + +List all runs for a thread. + +#### Parameters + +##### threadId + +`string` + +The ID of the thread. + +##### options? + +Filtering and pagination options. + +###### limit? + +`number` + +Maximum number of runs to return. +Defaults to 10 + +###### offset? + +`number` + +Offset to start from. +Defaults to 0. + +###### status? + +`RunStatus` + +Status of the run to filter by. + +#### Returns + +`Promise`\<`Run`[]\> + +List of runs. + +*** + +### stream() + +Create a run and stream the results. + +#### Param + +The ID of the thread. + +#### Param + +Assistant ID to use for this run. + +#### Param + +Payload for creating a run. + +#### Call Signature + +> **stream**\<`TStreamMode`, `TSubgraphs`\>(`threadId`, `assistantId`, `payload`?): `TypedAsyncGenerator`\<`TStreamMode`, `TSubgraphs`, `TStateType`, `TUpdateType`, `TCustomEventType`\> + +Defined in: [client.ts:917](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/client.ts#L917) + +##### Type Parameters + +• **TStreamMode** *extends* `StreamMode` \| `StreamMode`[] = `StreamMode` + +• **TSubgraphs** *extends* `boolean` = `false` + +##### Parameters + +###### threadId + +`null` + +###### assistantId + +`string` + +###### payload? + +`Omit`\<`RunsStreamPayload`\<`TStreamMode`, `TSubgraphs`\>, `"multitaskStrategy"` \| `"onCompletion"`\> + +##### Returns + +`TypedAsyncGenerator`\<`TStreamMode`, `TSubgraphs`, `TStateType`, `TUpdateType`, `TCustomEventType`\> + +#### Call Signature + +> **stream**\<`TStreamMode`, `TSubgraphs`\>(`threadId`, `assistantId`, `payload`?): `TypedAsyncGenerator`\<`TStreamMode`, `TSubgraphs`, `TStateType`, `TUpdateType`, `TCustomEventType`\> + +Defined in: [client.ts:935](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/client.ts#L935) + +##### Type Parameters + +• **TStreamMode** *extends* `StreamMode` \| `StreamMode`[] = `StreamMode` + +• **TSubgraphs** *extends* `boolean` = `false` + +##### Parameters + +###### threadId + +`string` + +###### assistantId + +`string` + +###### payload? + +`RunsStreamPayload`\<`TStreamMode`, `TSubgraphs`\> + +##### Returns + +`TypedAsyncGenerator`\<`TStreamMode`, `TSubgraphs`, `TStateType`, `TUpdateType`, `TCustomEventType`\> + +*** + +### wait() + +Create a run and wait for it to complete. + +#### Param + +The ID of the thread. + +#### Param + +Assistant ID to use for this run. + +#### Param + +Payload for creating a run. + +#### Call Signature + +> **wait**(`threadId`, `assistantId`, `payload`?): `Promise`\<`DefaultValues`\> + +Defined in: [client.ts:1093](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/client.ts#L1093) + +##### Parameters + +###### threadId + +`null` + +###### assistantId + +`string` + +###### payload? + +`Omit`\<`RunsWaitPayload`, `"multitaskStrategy"` \| `"onCompletion"`\> + +##### Returns + +`Promise`\<`DefaultValues`\> + +#### Call Signature + +> **wait**(`threadId`, `assistantId`, `payload`?): `Promise`\<`DefaultValues`\> + +Defined in: [client.ts:1099](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/client.ts#L1099) + +##### Parameters + +###### threadId + +`string` + +###### assistantId + +`string` + +###### payload? + +`RunsWaitPayload` + +##### Returns + +`Promise`\<`DefaultValues`\> diff --git a/libs/sdk-js/docs/classes/StoreClient.md b/libs/sdk-js/docs/classes/StoreClient.md new file mode 100644 index 000000000..97e223da3 --- /dev/null +++ b/libs/sdk-js/docs/classes/StoreClient.md @@ -0,0 +1,314 @@ +[**@langchain/langgraph-sdk**](../README.md) + +*** + +[@langchain/langgraph-sdk](../README.md) / StoreClient + +# Class: StoreClient + +Defined in: [client.ts:1347](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/client.ts#L1347) + +## Extends + +- `BaseClient` + +## Constructors + +### new StoreClient() + +> **new StoreClient**(`config`?): [`StoreClient`](StoreClient.md) + +Defined in: [client.ts:183](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/client.ts#L183) + +#### Parameters + +##### config? + +[`ClientConfig`](../interfaces/ClientConfig.md) + +#### Returns + +[`StoreClient`](StoreClient.md) + +#### Inherited from + +`BaseClient.constructor` + +## Methods + +### deleteItem() + +> **deleteItem**(`namespace`, `key`): `Promise`\<`void`\> + +Defined in: [client.ts:1468](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/client.ts#L1468) + +Delete an item. + +#### Parameters + +##### namespace + +`string`[] + +A list of strings representing the namespace path. + +##### key + +`string` + +The unique identifier for the item. + +#### Returns + +`Promise`\<`void`\> + +Promise + +*** + +### getItem() + +> **getItem**(`namespace`, `key`, `options`?): `Promise`\<`null` \| `Item`\> + +Defined in: [client.ts:1424](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/client.ts#L1424) + +Retrieve a single item. + +#### Parameters + +##### namespace + +`string`[] + +A list of strings representing the namespace path. + +##### key + +`string` + +The unique identifier for the item. + +##### options? + +###### refreshTtl? + +`null` \| `boolean` + +Whether to refresh the TTL on this read operation. If null, uses the store's default behavior. + +#### Returns + +`Promise`\<`null` \| `Item`\> + +Promise + +#### Example + +```typescript +const item = await client.store.getItem( + ["documents", "user123"], + "item456", + { refreshTtl: true } +); +console.log(item); +// { +// namespace: ["documents", "user123"], +// key: "item456", +// value: { title: "My Document", content: "Hello World" }, +// createdAt: "2024-07-30T12:00:00Z", +// updatedAt: "2024-07-30T12:00:00Z" +// } +``` + +*** + +### listNamespaces() + +> **listNamespaces**(`options`?): `Promise`\<`ListNamespaceResponse`\> + +Defined in: [client.ts:1564](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/client.ts#L1564) + +List namespaces with optional match conditions. + +#### Parameters + +##### options? + +###### limit? + +`number` + +Maximum number of namespaces to return (default is 100). + +###### maxDepth? + +`number` + +Optional integer specifying the maximum depth of namespaces to return. + +###### offset? + +`number` + +Number of namespaces to skip before returning results (default is 0). + +###### prefix? + +`string`[] + +Optional list of strings representing the prefix to filter namespaces. + +###### suffix? + +`string`[] + +Optional list of strings representing the suffix to filter namespaces. + +#### Returns + +`Promise`\<`ListNamespaceResponse`\> + +Promise + +*** + +### putItem() + +> **putItem**(`namespace`, `key`, `value`, `options`?): `Promise`\<`void`\> + +Defined in: [client.ts:1368](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/client.ts#L1368) + +Store or update an item. + +#### Parameters + +##### namespace + +`string`[] + +A list of strings representing the namespace path. + +##### key + +`string` + +The unique identifier for the item within the namespace. + +##### value + +`Record`\<`string`, `any`\> + +A dictionary containing the item's data. + +##### options? + +###### index? + +`null` \| `false` \| `string`[] + +Controls search indexing - null (use defaults), false (disable), or list of field paths to index. + +###### ttl? + +`null` \| `number` + +Optional time-to-live in minutes for the item, or null for no expiration. + +#### Returns + +`Promise`\<`void`\> + +Promise + +#### Example + +```typescript +await client.store.putItem( + ["documents", "user123"], + "item456", + { title: "My Document", content: "Hello World" }, + { ttl: 60 } // expires in 60 minutes +); +``` + +*** + +### searchItems() + +> **searchItems**(`namespacePrefix`, `options`?): `Promise`\<`SearchItemsResponse`\> + +Defined in: [client.ts:1519](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/client.ts#L1519) + +Search for items within a namespace prefix. + +#### Parameters + +##### namespacePrefix + +`string`[] + +List of strings representing the namespace prefix. + +##### options? + +###### filter? + +`Record`\<`string`, `any`\> + +Optional dictionary of key-value pairs to filter results. + +###### limit? + +`number` + +Maximum number of items to return (default is 10). + +###### offset? + +`number` + +Number of items to skip before returning results (default is 0). + +###### query? + +`string` + +Optional search query. + +###### refreshTtl? + +`null` \| `boolean` + +Whether to refresh the TTL on items returned by this search. If null, uses the store's default behavior. + +#### Returns + +`Promise`\<`SearchItemsResponse`\> + +Promise + +#### Example + +```typescript +const results = await client.store.searchItems( + ["documents"], + { + filter: { author: "John Doe" }, + limit: 5, + refreshTtl: true + } +); +console.log(results); +// { +// items: [ +// { +// namespace: ["documents", "user123"], +// key: "item789", +// value: { title: "Another Document", author: "John Doe" }, +// createdAt: "2024-07-30T12:00:00Z", +// updatedAt: "2024-07-30T12:00:00Z" +// }, +// // ... additional items ... +// ] +// } +``` diff --git a/libs/sdk-js/docs/classes/ThreadsClient.md b/libs/sdk-js/docs/classes/ThreadsClient.md new file mode 100644 index 000000000..7dc422c98 --- /dev/null +++ b/libs/sdk-js/docs/classes/ThreadsClient.md @@ -0,0 +1,433 @@ +[**@langchain/langgraph-sdk**](../README.md) + +*** + +[@langchain/langgraph-sdk](../README.md) / ThreadsClient + +# Class: ThreadsClient\ + +Defined in: [client.ts:626](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/client.ts#L626) + +## Extends + +- `BaseClient` + +## Type Parameters + +• **TStateType** = `DefaultValues` + +• **TUpdateType** = `TStateType` + +## Constructors + +### new ThreadsClient() + +> **new ThreadsClient**\<`TStateType`, `TUpdateType`\>(`config`?): [`ThreadsClient`](ThreadsClient.md)\<`TStateType`, `TUpdateType`\> + +Defined in: [client.ts:183](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/client.ts#L183) + +#### Parameters + +##### config? + +[`ClientConfig`](../interfaces/ClientConfig.md) + +#### Returns + +[`ThreadsClient`](ThreadsClient.md)\<`TStateType`, `TUpdateType`\> + +#### Inherited from + +`BaseClient.constructor` + +## Methods + +### copy() + +> **copy**(`threadId`): `Promise`\<`Thread`\<`TStateType`\>\> + +Defined in: [client.ts:703](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/client.ts#L703) + +Copy an existing thread + +#### Parameters + +##### threadId + +`string` + +ID of the thread to be copied + +#### Returns + +`Promise`\<`Thread`\<`TStateType`\>\> + +Newly copied thread + +*** + +### create() + +> **create**(`payload`?): `Promise`\<`Thread`\<`TStateType`\>\> + +Defined in: [client.ts:648](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/client.ts#L648) + +Create a new thread. + +#### Parameters + +##### payload? + +Payload for creating a thread. + +###### graphId? + +`string` + +Graph ID to associate with the thread. + +###### ifExists? + +`OnConflictBehavior` + +How to handle duplicate creation. + +**Default** + +```ts +"raise" +``` + +###### metadata? + +`Metadata` + +Metadata for the thread. + +###### supersteps? + +`object`[] + +Apply a list of supersteps when creating a thread, each containing a sequence of updates. + +Used for copying a thread between deployments. + +###### threadId? + +`string` + +ID of the thread to create. + +If not provided, a random UUID will be generated. + +#### Returns + +`Promise`\<`Thread`\<`TStateType`\>\> + +The created thread. + +*** + +### delete() + +> **delete**(`threadId`): `Promise`\<`void`\> + +Defined in: [client.ts:736](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/client.ts#L736) + +Delete a thread. + +#### Parameters + +##### threadId + +`string` + +ID of the thread. + +#### Returns + +`Promise`\<`void`\> + +*** + +### get() + +> **get**\<`ValuesType`\>(`threadId`): `Promise`\<`Thread`\<`ValuesType`\>\> + +Defined in: [client.ts:636](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/client.ts#L636) + +Get a thread by ID. + +#### Type Parameters + +• **ValuesType** = `TStateType` + +#### Parameters + +##### threadId + +`string` + +ID of the thread. + +#### Returns + +`Promise`\<`Thread`\<`ValuesType`\>\> + +The thread. + +*** + +### getHistory() + +> **getHistory**\<`ValuesType`\>(`threadId`, `options`?): `Promise`\<`ThreadState`\<`ValuesType`\>[]\> + +Defined in: [client.ts:888](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/client.ts#L888) + +Get all past states for a thread. + +#### Type Parameters + +• **ValuesType** = `TStateType` + +#### Parameters + +##### threadId + +`string` + +ID of the thread. + +##### options? + +Additional options. + +###### before? + +`Config` + +###### checkpoint? + +`Partial`\<`Omit`\<`Checkpoint`, `"thread_id"`\>\> + +###### limit? + +`number` + +###### metadata? + +`Metadata` + +#### Returns + +`Promise`\<`ThreadState`\<`ValuesType`\>[]\> + +List of thread states. + +*** + +### getState() + +> **getState**\<`ValuesType`\>(`threadId`, `checkpoint`?, `options`?): `Promise`\<`ThreadState`\<`ValuesType`\>\> + +Defined in: [client.ts:795](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/client.ts#L795) + +Get state for a thread. + +#### Type Parameters + +• **ValuesType** = `TStateType` + +#### Parameters + +##### threadId + +`string` + +ID of the thread. + +##### checkpoint? + +`string` | `Checkpoint` + +##### options? + +###### subgraphs? + +`boolean` + +#### Returns + +`Promise`\<`ThreadState`\<`ValuesType`\>\> + +Thread state. + +*** + +### patchState() + +> **patchState**(`threadIdOrConfig`, `metadata`): `Promise`\<`void`\> + +Defined in: [client.ts:858](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/client.ts#L858) + +Patch the metadata of a thread. + +#### Parameters + +##### threadIdOrConfig + +Thread ID or config to patch the state of. + +`string` | `Config` + +##### metadata + +`Metadata` + +Metadata to patch the state with. + +#### Returns + +`Promise`\<`void`\> + +*** + +### search() + +> **search**\<`ValuesType`\>(`query`?): `Promise`\<`Thread`\<`ValuesType`\>[]\> + +Defined in: [client.ts:748](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/client.ts#L748) + +List threads + +#### Type Parameters + +• **ValuesType** = `TStateType` + +#### Parameters + +##### query? + +Query options + +###### limit? + +`number` + +Maximum number of threads to return. +Defaults to 10 + +###### metadata? + +`Metadata` + +Metadata to filter threads by. + +###### offset? + +`number` + +Offset to start from. + +###### sortBy? + +`ThreadSortBy` + +Sort by. + +###### sortOrder? + +`SortOrder` + +Sort order. +Must be one of 'asc' or 'desc'. + +###### status? + +`ThreadStatus` + +Thread status to filter on. + +#### Returns + +`Promise`\<`Thread`\<`ValuesType`\>[]\> + +List of threads + +*** + +### update() + +> **update**(`threadId`, `payload`?): `Promise`\<`Thread`\<`DefaultValues`\>\> + +Defined in: [client.ts:716](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/client.ts#L716) + +Update a thread. + +#### Parameters + +##### threadId + +`string` + +ID of the thread. + +##### payload? + +Payload for updating the thread. + +###### metadata? + +`Metadata` + +Metadata for the thread. + +#### Returns + +`Promise`\<`Thread`\<`DefaultValues`\>\> + +The updated thread. + +*** + +### updateState() + +> **updateState**\<`ValuesType`\>(`threadId`, `options`): `Promise`\<`Pick`\<`Config`, `"configurable"`\>\> + +Defined in: [client.ts:829](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/client.ts#L829) + +Add state to a thread. + +#### Type Parameters + +• **ValuesType** = `TUpdateType` + +#### Parameters + +##### threadId + +`string` + +The ID of the thread. + +##### options + +###### asNode? + +`string` + +###### checkpoint? + +`Checkpoint` + +###### checkpointId? + +`string` + +###### values + +`ValuesType` + +#### Returns + +`Promise`\<`Pick`\<`Config`, `"configurable"`\>\> diff --git a/libs/sdk-js/docs/functions/getApiKey.md b/libs/sdk-js/docs/functions/getApiKey.md new file mode 100644 index 000000000..8c8e4f1fa --- /dev/null +++ b/libs/sdk-js/docs/functions/getApiKey.md @@ -0,0 +1,32 @@ +[**@langchain/langgraph-sdk**](../README.md) + +*** + +[@langchain/langgraph-sdk](../README.md) / getApiKey + +# Function: getApiKey() + +> **getApiKey**(`apiKey`?): `undefined` \| `string` + +Defined in: [client.ts:122](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/client.ts#L122) + +Get the API key from the environment. +Precedence: + 1. explicit argument + 2. LANGGRAPH_API_KEY + 3. LANGSMITH_API_KEY + 4. LANGCHAIN_API_KEY + +## Parameters + +### apiKey? + +`string` + +Optional API key provided as an argument + +## Returns + +`undefined` \| `string` + +The API key if found, otherwise undefined diff --git a/libs/sdk-js/docs/interfaces/ClientConfig.md b/libs/sdk-js/docs/interfaces/ClientConfig.md new file mode 100644 index 000000000..38c402010 --- /dev/null +++ b/libs/sdk-js/docs/interfaces/ClientConfig.md @@ -0,0 +1,57 @@ +[**@langchain/langgraph-sdk**](../README.md) + +*** + +[@langchain/langgraph-sdk](../README.md) / ClientConfig + +# Interface: ClientConfig + +Defined in: [client.ts:163](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/client.ts#L163) + +## Properties + +### apiKey? + +> `optional` **apiKey**: `string` + +Defined in: [client.ts:165](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/client.ts#L165) + +*** + +### apiUrl? + +> `optional` **apiUrl**: `string` + +Defined in: [client.ts:164](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/client.ts#L164) + +*** + +### callerOptions? + +> `optional` **callerOptions**: `AsyncCallerParams` + +Defined in: [client.ts:166](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/client.ts#L166) + +*** + +### defaultHeaders? + +> `optional` **defaultHeaders**: `Record`\<`string`, `HeaderValue`\> + +Defined in: [client.ts:168](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/client.ts#L168) + +*** + +### onRequest? + +> `optional` **onRequest**: [`RequestHook`](../type-aliases/RequestHook.md) + +Defined in: [client.ts:169](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/client.ts#L169) + +*** + +### timeoutMs? + +> `optional` **timeoutMs**: `number` + +Defined in: [client.ts:167](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/client.ts#L167) diff --git a/libs/sdk-js/docs/react/README.md b/libs/sdk-js/docs/react/README.md new file mode 100644 index 000000000..0933ca79b --- /dev/null +++ b/libs/sdk-js/docs/react/README.md @@ -0,0 +1,18 @@ +**@langchain/langgraph-sdk** + +*** + +# @langchain/langgraph-sdk/react + +## Interfaces + +- [UseStream](interfaces/UseStream.md) +- [UseStreamOptions](interfaces/UseStreamOptions.md) + +## Type Aliases + +- [MessageMetadata](type-aliases/MessageMetadata.md) + +## Functions + +- [useStream](functions/useStream.md) diff --git a/libs/sdk-js/docs/react/functions/useStream.md b/libs/sdk-js/docs/react/functions/useStream.md new file mode 100644 index 000000000..a9cb7d468 --- /dev/null +++ b/libs/sdk-js/docs/react/functions/useStream.md @@ -0,0 +1,27 @@ +[**@langchain/langgraph-sdk**](../README.md) + +*** + +[@langchain/langgraph-sdk](../README.md) / useStream + +# Function: useStream() + +> **useStream**\<`StateType`, `Bag`\>(`options`): [`UseStream`](../interfaces/UseStream.md)\<`StateType`, `Bag`\> + +Defined in: [react/stream.tsx:652](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/react/stream.tsx#L652) + +## Type Parameters + +• **StateType** *extends* `Record`\<`string`, `unknown`\> = `Record`\<`string`, `unknown`\> + +• **Bag** *extends* `object` = `BagTemplate` + +## Parameters + +### options + +[`UseStreamOptions`](../interfaces/UseStreamOptions.md)\<`StateType`, `Bag`\> + +## Returns + +[`UseStream`](../interfaces/UseStream.md)\<`StateType`, `Bag`\> diff --git a/libs/sdk-js/docs/react/interfaces/UseStream.md b/libs/sdk-js/docs/react/interfaces/UseStream.md new file mode 100644 index 000000000..06d1c4375 --- /dev/null +++ b/libs/sdk-js/docs/react/interfaces/UseStream.md @@ -0,0 +1,227 @@ +[**@langchain/langgraph-sdk**](../README.md) + +*** + +[@langchain/langgraph-sdk](../README.md) / UseStream + +# Interface: UseStream\ + +Defined in: [react/stream.tsx:529](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/react/stream.tsx#L529) + +## Type Parameters + +• **StateType** *extends* `Record`\<`string`, `unknown`\> = `Record`\<`string`, `unknown`\> + +• **Bag** *extends* `BagTemplate` = `BagTemplate` + +## Properties + +### assistantId + +> **assistantId**: `string` + +Defined in: [react/stream.tsx:614](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/react/stream.tsx#L614) + +The ID of the assistant to use. + +*** + +### branch + +> **branch**: `string` + +Defined in: [react/stream.tsx:564](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/react/stream.tsx#L564) + +The current branch of the thread. + +*** + +### client + +> **client**: `Client` + +Defined in: [react/stream.tsx:609](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/react/stream.tsx#L609) + +LangGraph SDK client used to send request and receive responses. + +*** + +### error + +> **error**: `unknown` + +Defined in: [react/stream.tsx:541](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/react/stream.tsx#L541) + +Last seen error from the thread or during streaming. + +*** + +### experimental\_branchTree + +> **experimental\_branchTree**: `Sequence`\<`StateType`\> + +Defined in: [react/stream.tsx:580](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/react/stream.tsx#L580) + +**`Experimental`** + +Tree of all branches for the thread. + +*** + +### getMessagesMetadata() + +> **getMessagesMetadata**: (`message`, `index`?) => `undefined` \| [`MessageMetadata`](../type-aliases/MessageMetadata.md)\<`StateType`\> + +Defined in: [react/stream.tsx:601](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/react/stream.tsx#L601) + +Get the metadata for a message, such as first thread state the message +was seen in and branch information. + +#### Parameters + +##### message + +`Message` + +The message to get the metadata for. + +##### index? + +`number` + +The index of the message in the thread. + +#### Returns + +`undefined` \| [`MessageMetadata`](../type-aliases/MessageMetadata.md)\<`StateType`\> + +The metadata for the message. + +*** + +### history + +> **history**: `ThreadState`\<`StateType`\>[] + +Defined in: [react/stream.tsx:574](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/react/stream.tsx#L574) + +Flattened history of thread states of a thread. + +*** + +### interrupt + +> **interrupt**: `undefined` \| `Interrupt`\<`GetInterruptType`\<`Bag`\>\> + +Defined in: [react/stream.tsx:585](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/react/stream.tsx#L585) + +Get the interrupt value for the stream if interrupted. + +*** + +### isLoading + +> **isLoading**: `boolean` + +Defined in: [react/stream.tsx:546](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/react/stream.tsx#L546) + +Whether the stream is currently running. + +*** + +### joinStream() + +> **joinStream**: (`runId`) => `Promise`\<`void`\> + +Defined in: [react/stream.tsx:619](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/react/stream.tsx#L619) + +Join an active stream. + +#### Parameters + +##### runId + +`string` + +#### Returns + +`Promise`\<`void`\> + +*** + +### messages + +> **messages**: `Message`[] + +Defined in: [react/stream.tsx:591](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/react/stream.tsx#L591) + +Messages inferred from the thread. +Will automatically update with incoming message chunks. + +*** + +### setBranch() + +> **setBranch**: (`branch`) => `void` + +Defined in: [react/stream.tsx:569](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/react/stream.tsx#L569) + +Set the branch of the thread. + +#### Parameters + +##### branch + +`string` + +#### Returns + +`void` + +*** + +### stop() + +> **stop**: () => `void` + +Defined in: [react/stream.tsx:551](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/react/stream.tsx#L551) + +Stops the stream. + +#### Returns + +`void` + +*** + +### submit() + +> **submit**: (`values`, `options`?) => `void` + +Defined in: [react/stream.tsx:556](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/react/stream.tsx#L556) + +Create and stream a run to the thread. + +#### Parameters + +##### values + +`undefined` | `null` | `GetUpdateType`\<`Bag`, `StateType`\> + +##### options? + +`SubmitOptions`\<`StateType`, `GetConfigurableType`\<`Bag`\>\> + +#### Returns + +`void` + +*** + +### values + +> **values**: `StateType` + +Defined in: [react/stream.tsx:536](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/react/stream.tsx#L536) + +The current values of the thread. diff --git a/libs/sdk-js/docs/react/interfaces/UseStreamOptions.md b/libs/sdk-js/docs/react/interfaces/UseStreamOptions.md new file mode 100644 index 000000000..9fbb6f702 --- /dev/null +++ b/libs/sdk-js/docs/react/interfaces/UseStreamOptions.md @@ -0,0 +1,343 @@ +[**@langchain/langgraph-sdk**](../README.md) + +*** + +[@langchain/langgraph-sdk](../README.md) / UseStreamOptions + +# Interface: UseStreamOptions\ + +Defined in: [react/stream.tsx:413](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/react/stream.tsx#L413) + +## Type Parameters + +• **StateType** *extends* `Record`\<`string`, `unknown`\> = `Record`\<`string`, `unknown`\> + +• **Bag** *extends* `BagTemplate` = `BagTemplate` + +## Properties + +### apiKey? + +> `optional` **apiKey**: `string` + +Defined in: [react/stream.tsx:435](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/react/stream.tsx#L435) + +The API key to use. + +*** + +### apiUrl? + +> `optional` **apiUrl**: `string` + +Defined in: [react/stream.tsx:430](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/react/stream.tsx#L430) + +The URL of the API to use. + +*** + +### assistantId + +> **assistantId**: `string` + +Defined in: [react/stream.tsx:420](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/react/stream.tsx#L420) + +The ID of the assistant to use. + +*** + +### callerOptions? + +> `optional` **callerOptions**: `AsyncCallerParams` + +Defined in: [react/stream.tsx:440](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/react/stream.tsx#L440) + +Custom call options, such as custom fetch implementation. + +*** + +### client? + +> `optional` **client**: `Client`\<`DefaultValues`, `DefaultValues`, `unknown`\> + +Defined in: [react/stream.tsx:425](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/react/stream.tsx#L425) + +Client used to send requests. + +*** + +### defaultHeaders? + +> `optional` **defaultHeaders**: `Record`\<`string`, `HeaderValue`\> + +Defined in: [react/stream.tsx:445](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/react/stream.tsx#L445) + +Default headers to send with requests. + +*** + +### messagesKey? + +> `optional` **messagesKey**: `string` + +Defined in: [react/stream.tsx:453](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/react/stream.tsx#L453) + +Specify the key within the state that contains messages. +Defaults to "messages". + +#### Default + +```ts +"messages" +``` + +*** + +### onCreated()? + +> `optional` **onCreated**: (`run`) => `void` + +Defined in: [react/stream.tsx:471](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/react/stream.tsx#L471) + +Callback that is called when a new stream is created. + +#### Parameters + +##### run + +`RunCallbackMeta` + +#### Returns + +`void` + +*** + +### onCustomEvent()? + +> `optional` **onCustomEvent**: (`data`, `options`) => `void` + +Defined in: [react/stream.tsx:483](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/react/stream.tsx#L483) + +Callback that is called when a custom event is received. + +#### Parameters + +##### data + +`GetCustomEventType`\<`Bag`\> + +##### options + +###### mutate + +(`update`) => `void` + +#### Returns + +`void` + +*** + +### onDebugEvent()? + +> `optional` **onDebugEvent**: (`data`) => `void` + +Defined in: [react/stream.tsx:507](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/react/stream.tsx#L507) + +**`Internal`** + +Callback that is called when a debug event is received. + This API is experimental and subject to change. + +#### Parameters + +##### data + +`unknown` + +#### Returns + +`void` + +*** + +### onError()? + +> `optional` **onError**: (`error`, `run`) => `void` + +Defined in: [react/stream.tsx:458](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/react/stream.tsx#L458) + +Callback that is called when an error occurs. + +#### Parameters + +##### error + +`unknown` + +##### run + +`undefined` | `RunCallbackMeta` + +#### Returns + +`void` + +*** + +### onFinish()? + +> `optional` **onFinish**: (`state`, `run`) => `void` + +Defined in: [react/stream.tsx:463](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/react/stream.tsx#L463) + +Callback that is called when the stream is finished. + +#### Parameters + +##### state + +`ThreadState`\<`StateType`\> + +##### run + +`undefined` | `RunCallbackMeta` + +#### Returns + +`void` + +*** + +### onLangChainEvent()? + +> `optional` **onLangChainEvent**: (`data`) => `void` + +Defined in: [react/stream.tsx:501](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/react/stream.tsx#L501) + +Callback that is called when a LangChain event is received. + +#### Parameters + +##### data + +###### data + +`unknown` + +###### event + +`string` & `object` \| `"on_tool_start"` \| `"on_tool_stream"` \| `"on_tool_end"` \| `"on_chat_model_start"` \| `"on_chat_model_stream"` \| `"on_chat_model_end"` \| `"on_llm_start"` \| `"on_llm_stream"` \| `"on_llm_end"` \| `"on_chain_start"` \| `"on_chain_stream"` \| `"on_chain_end"` \| `"on_retriever_start"` \| `"on_retriever_stream"` \| `"on_retriever_end"` \| `"on_prompt_start"` \| `"on_prompt_stream"` \| `"on_prompt_end"` + +###### metadata + +`Record`\<`string`, `unknown`\> + +###### name + +`string` + +###### parent_ids + +`string`[] + +###### run_id + +`string` + +###### tags + +`string`[] + +#### Returns + +`void` + +#### See + +https://langchain-ai.github.io/langgraph/cloud/how-tos/stream_events/#stream-graph-in-events-mode for more details. + +*** + +### onMetadataEvent()? + +> `optional` **onMetadataEvent**: (`data`) => `void` + +Defined in: [react/stream.tsx:495](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/react/stream.tsx#L495) + +Callback that is called when a metadata event is received. + +#### Parameters + +##### data + +###### run_id + +`string` + +###### thread_id + +`string` + +#### Returns + +`void` + +*** + +### onThreadId()? + +> `optional` **onThreadId**: (`threadId`) => `void` + +Defined in: [react/stream.tsx:517](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/react/stream.tsx#L517) + +Callback that is called when the thread ID is updated (ie when a new thread is created). + +#### Parameters + +##### threadId + +`string` + +#### Returns + +`void` + +*** + +### onUpdateEvent()? + +> `optional` **onUpdateEvent**: (`data`) => `void` + +Defined in: [react/stream.tsx:476](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/react/stream.tsx#L476) + +Callback that is called when an update event is received. + +#### Parameters + +##### data + +#### Returns + +`void` + +*** + +### reconnectOnMount? + +> `optional` **reconnectOnMount**: `boolean` \| () => `RunMetadataStorage` + +Defined in: [react/stream.tsx:520](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/react/stream.tsx#L520) + +Will reconnect the stream on mount + +*** + +### threadId? + +> `optional` **threadId**: `null` \| `string` + +Defined in: [react/stream.tsx:512](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/react/stream.tsx#L512) + +The ID of the thread to fetch history and current values from. diff --git a/libs/sdk-js/docs/react/type-aliases/MessageMetadata.md b/libs/sdk-js/docs/react/type-aliases/MessageMetadata.md new file mode 100644 index 000000000..9496a7913 --- /dev/null +++ b/libs/sdk-js/docs/react/type-aliases/MessageMetadata.md @@ -0,0 +1,42 @@ +[**@langchain/langgraph-sdk**](../README.md) + +*** + +[@langchain/langgraph-sdk](../README.md) / MessageMetadata + +# Type Alias: MessageMetadata\ + +> **MessageMetadata**\<`StateType`\>: `object` + +Defined in: [react/stream.tsx:169](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/react/stream.tsx#L169) + +## Type Parameters + +• **StateType** *extends* `Record`\<`string`, `unknown`\> + +## Type declaration + +### branch + +> **branch**: `string` \| `undefined` + +The branch of the message. + +### branchOptions + +> **branchOptions**: `string`[] \| `undefined` + +The list of branches this message is part of. +This is useful for displaying branching controls. + +### firstSeenState + +> **firstSeenState**: `ThreadState`\<`StateType`\> \| `undefined` + +The first thread state the message was seen in. + +### messageId + +> **messageId**: `string` + +The ID of the message used. diff --git a/libs/sdk-js/docs/type-aliases/RequestHook.md b/libs/sdk-js/docs/type-aliases/RequestHook.md new file mode 100644 index 000000000..53d535e2e --- /dev/null +++ b/libs/sdk-js/docs/type-aliases/RequestHook.md @@ -0,0 +1,25 @@ +[**@langchain/langgraph-sdk**](../README.md) + +*** + +[@langchain/langgraph-sdk](../README.md) / RequestHook + +# Type Alias: RequestHook() + +> **RequestHook**: (`url`, `init`) => `Promise`\<`RequestInit`\> \| `RequestInit` + +Defined in: [client.ts:158](https://github.com/langchain-ai/langgraph/blob/a7ea5e44ce12e3618d1a766587163afbfe424e04/libs/sdk-js/src/client.ts#L158) + +## Parameters + +### url + +`URL` + +### init + +`RequestInit` + +## Returns + +`Promise`\<`RequestInit`\> \| `RequestInit` diff --git a/libs/sdk-js/index.cjs b/libs/sdk-js/index.cjs new file mode 100644 index 000000000..c84256f7a --- /dev/null +++ b/libs/sdk-js/index.cjs @@ -0,0 +1 @@ +module.exports = require('./dist/index.cjs'); \ No newline at end of file diff --git a/libs/sdk-js/index.d.cts b/libs/sdk-js/index.d.cts new file mode 100644 index 000000000..485d17256 --- /dev/null +++ b/libs/sdk-js/index.d.cts @@ -0,0 +1 @@ +export * from './dist/index.js' \ No newline at end of file diff --git a/libs/sdk-js/index.d.ts b/libs/sdk-js/index.d.ts new file mode 100644 index 000000000..485d17256 --- /dev/null +++ b/libs/sdk-js/index.d.ts @@ -0,0 +1 @@ +export * from './dist/index.js' \ No newline at end of file diff --git a/libs/sdk-js/index.js b/libs/sdk-js/index.js new file mode 100644 index 000000000..485d17256 --- /dev/null +++ b/libs/sdk-js/index.js @@ -0,0 +1 @@ +export * from './dist/index.js' \ No newline at end of file diff --git a/libs/sdk-js/react.cjs b/libs/sdk-js/react.cjs new file mode 100644 index 000000000..86a38b8c3 --- /dev/null +++ b/libs/sdk-js/react.cjs @@ -0,0 +1 @@ +module.exports = require('./dist/react/index.cjs'); \ No newline at end of file diff --git a/libs/sdk-js/react.d.cts b/libs/sdk-js/react.d.cts new file mode 100644 index 000000000..fd96c4787 --- /dev/null +++ b/libs/sdk-js/react.d.cts @@ -0,0 +1 @@ +export * from './dist/react/index.js' \ No newline at end of file diff --git a/libs/sdk-js/react.d.ts b/libs/sdk-js/react.d.ts new file mode 100644 index 000000000..fd96c4787 --- /dev/null +++ b/libs/sdk-js/react.d.ts @@ -0,0 +1 @@ +export * from './dist/react/index.js' \ No newline at end of file diff --git a/libs/sdk-js/react.js b/libs/sdk-js/react.js new file mode 100644 index 000000000..fd96c4787 --- /dev/null +++ b/libs/sdk-js/react.js @@ -0,0 +1 @@ +export * from './dist/react/index.js' \ No newline at end of file