
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
@langgraph-js/sdk
Advanced tools
The UI SDK for LangGraph - seamlessly integrate your AI agents with frontend interfaces
The missing UI SDK for LangGraph - seamlessly integrate your AI agents with frontend interfaces
Building AI agent applications is complex, especially when you need to bridge the gap between LangGraph agents and interactive user interfaces. This SDK solves the critical challenges of frontend integration:
# Using npm
npm install @langgraph-js/sdk
# Using yarn
yarn add @langgraph-js/sdk
# Using pnpm
pnpm add @langgraph-js/sdk
Legacy mode is designed to be compatible with environments that don't support AsyncGeneratorFunction (such as WeChat Mini Programs). In these environments, standard async iterators may not work properly.
import { TestLangGraphChat, createChatStore, createLowerJSClient } from "@langgraph-js/sdk";
const client = await createLowerJSClient({
apiUrl: "http://localhost:8123",
defaultHeaders: {
Authorization: "Bearer 123",
},
});
createChatStore(
"graph",
{
defaultHeaders: {
Authorization: "Bearer 123",
},
client,
legacyMode: true,
},
{}
);
You can easily create a reactive store for your LangGraph client:
import { createChatStore } from "@langgraph-js/sdk";
export const globalChatStore = createChatStore(
"agent",
{
// Custom LangGraph backend interaction
apiUrl: "http://localhost:8123",
// Custom headers for authentication
defaultHeaders: JSON.parse(localStorage.getItem("code") || "{}"),
callerOptions: {
// Example for including cookies
// fetch(url: string, options: RequestInit) {
// options.credentials = "include";
// return fetch(url, options);
// },
},
},
{
onInit(client) {
client.tools.bindTools([]);
},
}
);
First, install the nanostores React integration:
pnpm i @nanostores/react
Then use the ChatProvider in your components:
import { ChatProvider, useChat } from "@langgraph-js/sdk/react";
Use it in your components:
export const MyChat = () => {
return (
<ChatProvider
defaultAgent="agent"
apiUrl="http://localhost:8123"
defaultHeaders={{}}
withCredentials={false}
showHistory={true}
showGraph={false}
onInitError={(error, currentAgent) => {
console.error(`Failed to initialize ${currentAgent}:`, error);
// Handle initialization error
}}
>
<ChatComp />
</ChatProvider>
);
};
function ChatComp() {
const chat = useChat();
// Use chat store methods and state here
}
First, install the nanostores Vue integration:
pnpm i @nanostores/vue
Then use the ChatProvider in your components:
import { ChatProvider, useChat, useChatProvider } from "@langgraph-js/sdk/vue";
Use it in your components:
<template>
<ChatProvider
:default-agent="'agent'"
:api-url="'http://localhost:8123'"
:default-headers="{}"
:with-credentials="false"
:show-history="true"
:show-graph="false"
:on-init-error="
(error, currentAgent) => {
console.error(`Failed to initialize ${currentAgent}:`, error);
// Handle initialization error
}
"
>
<ChatComp />
</ChatProvider>
</template>
<script setup lang="ts">
import { ChatProvider } from "@langgraph-js/sdk/vue";
function ChatComp() {
const chat = useChat();
// Use chat store methods and state here
}
</script>
For more flexibility, you can use the hook directly in your setup:
<script setup lang="ts">
import { useChatProvider } from "@langgraph-js/sdk/vue";
const props = {
defaultAgent: "agent",
apiUrl: "http://localhost:8123",
defaultHeaders: {},
withCredentials: false,
showHistory: true,
showGraph: false,
onInitError: (error: any, currentAgent: string) => {
console.error(`Failed to initialize ${currentAgent}:`, error);
// Handle initialization error
},
};
const { unionStore } = useChatProvider(props);
// Use unionStore methods and state here
</script>
<template>
<ChatComp />
</template>
For complete documentation, visit our official docs.
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the Apache-2.0 License.
FAQs
The UI SDK for LangGraph - seamlessly integrate your AI agents with frontend interfaces
We found that @langgraph-js/sdk demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.