[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-73797":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":17,"stars7d":18,"stars30d":19,"stars90d":16,"forks30d":16,"starsTrendScore":20,"compositeScore":21,"rankGlobal":10,"rankLanguage":10,"license":22,"archived":23,"fork":23,"defaultBranch":24,"hasWiki":25,"hasPages":23,"topics":26,"createdAt":10,"pushedAt":10,"updatedAt":31,"readmeContent":32,"aiSummary":33,"trendingCount":16,"starSnapshotCount":16,"syncStatus":34,"lastSyncTime":35,"discoverSource":36},73797,"agent-chat-ui","langchain-ai\u002Fagent-chat-ui","langchain-ai","🦜💬 Web app for interacting with any LangGraph agent (PY & TS) via a chat interface.","https:\u002F\u002Fagentchat.vercel.app",null,"TypeScript",2920,637,20,53,0,14,32,95,42,30.41,"MIT License",false,"main",true,[27,28,29,30],"agent","chat","langgraph","llm","2026-06-12 02:03:18","# Agent Chat UI\n\nAgent Chat UI is a Next.js application which enables chatting with any LangGraph server with a `messages` key through a chat interface.\n\n> [!NOTE]\n> 🎥 Watch the video setup guide [here](https:\u002F\u002Fyoutu.be\u002FlInrwVnZ83o).\n\n## Setup\n\n> [!TIP]\n> Don't want to run the app locally? Use the deployed site here: [agentchat.vercel.app](https:\u002F\u002Fagentchat.vercel.app)!\n\nFirst, clone the repository, or run the [`npx` command](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002Fcreate-agent-chat-app):\n\n```bash\nnpx create-agent-chat-app\n```\n\nor\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Flangchain-ai\u002Fagent-chat-ui.git\n\ncd agent-chat-ui\n```\n\nInstall dependencies:\n\n```bash\npnpm install\n```\n\nRun the app:\n\n```bash\npnpm dev\n```\n\nThe app will be available at `http:\u002F\u002Flocalhost:3000`.\n\n## Usage\n\nOnce the app is running (or if using the deployed site), you'll be prompted to enter:\n\n- **Deployment URL**: The URL of the LangGraph server you want to chat with. This can be a production or development URL.\n- **Assistant\u002FGraph ID**: The name of the graph, or ID of the assistant to use when fetching, and submitting runs via the chat interface.\n- **LangSmith API Key**: (only required for connecting to deployed LangGraph servers) Your LangSmith API key to use when authenticating requests sent to LangGraph servers.\n- **Built with Agent Builder**: Toggle this on for Agent Builder deployments. This automatically sets the auth scheme to `langsmith-api-key`.\n\nAfter entering these values, click `Continue`. You'll then be redirected to a chat interface where you can start chatting with your LangGraph server.\n\n## Environment Variables\n\nYou can bypass the initial setup form by setting the following environment variables:\n\n```bash\nNEXT_PUBLIC_API_URL=http:\u002F\u002Flocalhost:2024\nNEXT_PUBLIC_ASSISTANT_ID=agent\nNEXT_PUBLIC_AUTH_SCHEME=\n```\n\n> [!NOTE]\n> If you are connecting to a LangSmith Agent Builder deployment, set `NEXT_PUBLIC_AUTH_SCHEME=langsmith-api-key`.\n\n> [!TIP]\n> If you want to connect to a production LangGraph server, read the [Going to Production](#going-to-production) section.\n\nTo use these variables:\n\n1. Copy the `.env.example` file to a new file named `.env`\n2. Fill in the values in the `.env` file\n3. Restart the application\n\nWhen these environment variables are set, the application will use them instead of showing the setup form.\n\n## Hiding Messages in the Chat\n\nYou can control the visibility of messages within the Agent Chat UI in two main ways:\n\n**1. Prevent Live Streaming:**\n\nTo stop messages from being displayed _as they stream_ from an LLM call, add the `langsmith:nostream` tag to the chat model's configuration. The UI normally uses `on_chat_model_stream` events to render streaming messages; this tag prevents those events from being emitted for the tagged model.\n\n_Python Example:_\n\n```python\nfrom langchain_anthropic import ChatAnthropic\n\n# Add tags via the .with_config method\nmodel = ChatAnthropic().with_config(\n    config={\"tags\": [\"langsmith:nostream\"]}\n)\n```\n\n_TypeScript Example:_\n\n```typescript\nimport { ChatAnthropic } from \"@langchain\u002Fanthropic\";\n\nconst model = new ChatAnthropic()\n  \u002F\u002F Add tags via the .withConfig method\n  .withConfig({ tags: [\"langsmith:nostream\"] });\n```\n\n**Note:** Even if streaming is hidden this way, the message will still appear after the LLM call completes if it's saved to the graph's state without further modification.\n\n**2. Hide Messages Permanently:**\n\nTo ensure a message is _never_ displayed in the chat UI (neither during streaming nor after being saved to state), prefix its `id` field with `do-not-render-` _before_ adding it to the graph's state, along with adding the `langsmith:do-not-render` tag to the chat model's configuration. The UI explicitly filters out any message whose `id` starts with this prefix.\n\n_Python Example:_\n\n```python\nresult = model.invoke([messages])\n# Prefix the ID before saving to state\nresult.id = f\"do-not-render-{result.id}\"\nreturn {\"messages\": [result]}\n```\n\n_TypeScript Example:_\n\n```typescript\nconst result = await model.invoke([messages]);\n\u002F\u002F Prefix the ID before saving to state\nresult.id = `do-not-render-${result.id}`;\nreturn { messages: [result] };\n```\n\nThis approach guarantees the message remains completely hidden from the user interface.\n\n## Rendering Artifacts\n\nThe Agent Chat UI supports rendering artifacts in the chat. Artifacts are rendered in a side panel to the right of the chat. To render an artifact, you can obtain the artifact context from the `thread.meta.artifact` field. Here's a sample utility hook for obtaining the artifact context:\n\n```tsx\nexport function useArtifact\u003CTContext = Record\u003Cstring, unknown>>() {\n  type Component = (props: {\n    children: React.ReactNode;\n    title?: React.ReactNode;\n  }) => React.ReactNode;\n\n  type Context = TContext | undefined;\n\n  type Bag = {\n    open: boolean;\n    setOpen: (value: boolean | ((prev: boolean) => boolean)) => void;\n\n    context: Context;\n    setContext: (value: Context | ((prev: Context) => Context)) => void;\n  };\n\n  const thread = useStreamContext\u003C\n    { messages: Message[]; ui: UIMessage[] },\n    { MetaType: { artifact: [Component, Bag] } }\n  >();\n\n  return thread.meta?.artifact;\n}\n```\n\nAfter which you can render additional content using the `Artifact` component from the `useArtifact` hook:\n\n```tsx\nimport { useArtifact } from \"..\u002Futils\u002Fuse-artifact\";\nimport { LoaderIcon } from \"lucide-react\";\n\nexport function Writer(props: {\n  title?: string;\n  content?: string;\n  description?: string;\n}) {\n  const [Artifact, { open, setOpen }] = useArtifact();\n\n  return (\n    \u003C>\n      \u003Cdiv\n        onClick={() => setOpen(!open)}\n        className=\"cursor-pointer rounded-lg border p-4\"\n      >\n        \u003Cp className=\"font-medium\">{props.title}\u003C\u002Fp>\n        \u003Cp className=\"text-sm text-gray-500\">{props.description}\u003C\u002Fp>\n      \u003C\u002Fdiv>\n\n      \u003CArtifact title={props.title}>\n        \u003Cp className=\"whitespace-pre-wrap p-4\">{props.content}\u003C\u002Fp>\n      \u003C\u002FArtifact>\n    \u003C\u002F>\n  );\n}\n```\n\n## Going to Production\n\nOnce you're ready to go to production, you'll need to update how you connect, and authenticate requests to your deployment. By default, the Agent Chat UI is setup for local development, and connects to your LangGraph server directly from the client. This is not possible if you want to go to production, because it requires every user to have their own LangSmith API key, and set the LangGraph configuration themselves.\n\n### Production Setup\n\nTo productionize the Agent Chat UI, you'll need to pick one of two ways to authenticate requests to your LangGraph server. Below, I'll outline the two options:\n\n### Quickstart - API Passthrough\n\nThe quickest way to productionize the Agent Chat UI is to use the [API Passthrough](https:\u002F\u002Fgithub.com\u002Fbracesproul\u002Flanggraph-nextjs-api-passthrough) package ([NPM link here](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002Flanggraph-nextjs-api-passthrough)). This package provides a simple way to proxy requests to your LangGraph server, and handle authentication for you.\n\nThis repository already contains all of the code you need to start using this method. The only configuration you need to do is set the proper environment variables.\n\n```bash\nNEXT_PUBLIC_ASSISTANT_ID=\"agent\"\n# This should be the deployment URL of your LangGraph server\nLANGGRAPH_API_URL=\"https:\u002F\u002Fmy-agent.default.us.langgraph.app\"\n# This should be the URL of your website + \"\u002Fapi\". This is how you connect to the API proxy\nNEXT_PUBLIC_API_URL=\"https:\u002F\u002Fmy-website.com\u002Fapi\"\n# Your LangSmith API key which is injected into requests inside the API proxy\nLANGSMITH_API_KEY=\"lsv2_...\"\n```\n\nLet's cover what each of these environment variables does:\n\n- `NEXT_PUBLIC_ASSISTANT_ID`: The ID of the assistant you want to use when fetching, and submitting runs via the chat interface. This still needs the `NEXT_PUBLIC_` prefix, since it's not a secret, and we use it on the client when submitting requests.\n- `LANGGRAPH_API_URL`: The URL of your LangGraph server. This should be the production deployment URL.\n- `NEXT_PUBLIC_API_URL`: The URL of your website + `\u002Fapi`. This is how you connect to the API proxy. For the [Agent Chat demo](https:\u002F\u002Fagentchat.vercel.app), this would be set as `https:\u002F\u002Fagentchat.vercel.app\u002Fapi`. You should set this to whatever your production URL is.\n- `LANGSMITH_API_KEY`: Your LangSmith API key to use when authenticating requests sent to LangGraph servers. Once again, do _not_ prefix this with `NEXT_PUBLIC_` since it's a secret, and is only used on the server when the API proxy injects it into the request to your deployed LangGraph server.\n\nFor in depth documentation, consult the [LangGraph Next.js API Passthrough](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002Flanggraph-nextjs-api-passthrough) docs.\n\n### Advanced Setup - Custom Authentication\n\nCustom authentication in your LangGraph deployment is an advanced, and more robust way of authenticating requests to your LangGraph server. Using custom authentication, you can allow requests to be made from the client, without the need for a LangSmith API key. Additionally, you can specify custom access controls on requests.\n\nTo set this up in your LangGraph deployment, please read the LangGraph custom authentication docs for [Python](https:\u002F\u002Flangchain-ai.github.io\u002Flanggraph\u002Ftutorials\u002Fauth\u002Fgetting_started\u002F), and [TypeScript here](https:\u002F\u002Flangchain-ai.github.io\u002Flanggraphjs\u002Fhow-tos\u002Fauth\u002Fcustom_auth\u002F).\n\nOnce you've set it up on your deployment, you should make the following changes to the Agent Chat UI:\n\n1. Configure any additional API requests to fetch the authentication token from your LangGraph deployment which will be used to authenticate requests from the client.\n2. Set the `NEXT_PUBLIC_API_URL` environment variable to your production LangGraph deployment URL.\n3. Set the `NEXT_PUBLIC_ASSISTANT_ID` environment variable to the ID of the assistant you want to use when fetching, and submitting runs via the chat interface.\n4. Modify the [`useTypedStream`](src\u002Fproviders\u002FStream.tsx) (extension of `useStream`) hook to pass your authentication token through headers to the LangGraph server:\n\n```tsx\nconst streamValue = useTypedStream({\n  apiUrl: process.env.NEXT_PUBLIC_API_URL,\n  assistantId: process.env.NEXT_PUBLIC_ASSISTANT_ID,\n  \u002F\u002F ... other fields\n  defaultHeaders: {\n    Authentication: `Bearer ${addYourTokenHere}`, \u002F\u002F this is where you would pass your authentication token\n  },\n});\n```\n","Agent Chat UI 是一个基于Next.js的应用程序，通过聊天界面与任何具有`messages`键的LangGraph服务器进行交互。该项目使用TypeScript构建，支持用户通过简单的配置即可连接到指定的LangGraph代理，并开始对话交流。其主要功能包括支持自定义部署URL、助手\u002F图ID以及认证方案等设置，便于开发者快速集成自己的AI模型至聊天应用中。此外，它还提供了灵活的消息流控制选项，允许根据需求调整消息显示方式。此工具非常适合那些希望为其LangGraph项目添加直观聊天前端界面的研究人员或开发团队使用。",2,"2026-06-11 03:47:25","high_star"]