Skip to content

feat(examples): add LangGraph multi-agent chat example (#293)#644

Open
NandishwarSingh wants to merge 1 commit into
thesysdev:mainfrom
NandishwarSingh:example/langgraph-chat
Open

feat(examples): add LangGraph multi-agent chat example (#293)#644
NandishwarSingh wants to merge 1 commit into
thesysdev:mainfrom
NandishwarSingh:example/langgraph-chat

Conversation

@NandishwarSingh

Copy link
Copy Markdown

What

Adds examples/langgraph-chat — a Next.js app that renders OpenUI generative UI streamed from a multi-agent LangGraph graph. Resolves #293.

Built in TypeScript, per the approach approved in the issue.

How it works

  • Graph (src/agent/graph.ts) — a supervisor router dispatches each message to a weather, finance, or research specialist. Each specialist is a streaming ReAct loop that shares the generated OpenUI system prompt, so its output renders as generative UI (cards, tables, charts). Exposed via langgraph.json, so it runs with langgraphjs dev locally and deploys to LangGraph Platform unchanged.
  • Proxy (src/app/api/chat/route.ts) — opens a stateless run with @langchain/langgraph-sdk and forwards the native LangGraph SSE to the client. Normalizes the token event to messages for langGraphAdapter() and drops the supervisor's internal routing tokens so only specialist output renders.
  • Frontend (src/app/page.tsx) — <FullScreen streamProtocol={langGraphAdapter()}> with langGraphMessageFormat.toApi, mirroring examples/openui-chat.
  • README — covers both local (langgraphjs devLANGGRAPH_API_URL=http://localhost:2024) and LangGraph Cloud (LANGGRAPH_ASSISTANT_ID + LANGSMITH_API_KEY) setups. Mock weather / stock / web-search tools mean it runs with no third-party keys.

Notes

  • The run is stateless — the full message history is sent each turn — which keeps the example focused (no server-side thread management).

Verification

  • pnpm build (typecheck + compile) and pnpm lint pass.
  • langgraphjs dev registers the graph; the stateless /runs/stream SSE contract was verified against a running server.

Add `examples/langgraph-chat`, a Next.js app that renders OpenUI generative
UI streamed from a multi-agent LangGraph graph.

- Supervisor router dispatches to weather/finance/research specialists, each a
  streaming ReAct loop sharing the generated OpenUI system prompt.
- `/api/chat` proxies a stateless run via `@langchain/langgraph-sdk`, forwarding
  native LangGraph SSE to `langGraphAdapter()` and filtering internal-node tokens.
- README documents both local (`langgraphjs dev`) and LangGraph Cloud setups.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

LangGraph Example

1 participant