Skip to content

Add LangGraph streaming adapter#381

Merged
abhithesys merged 4 commits intothesysdev:mainfrom
alkitrend:feat/langgraph-adapter
Mar 27, 2026
Merged

Add LangGraph streaming adapter#381
abhithesys merged 4 commits intothesysdev:mainfrom
alkitrend:feat/langgraph-adapter

Conversation

@alkitrend
Copy link
Copy Markdown
Contributor

@alkitrend alkitrend commented Mar 23, 2026

What

Add a langGraphAdapter and langGraphMessageFormat in @openuidev/react-headless to enable LangGraph backend integration with OpenUI's streaming renderer and chat interfaces.

Changes

  • Add langGraphAdapter in packages/react-headless/src/stream/adapters/langgraph.ts that parses LangGraph's named SSE events (messages, metadata, updates, error, end) and maps them to AG-UI events
  • Add langGraphMessageFormat in packages/react-headless/src/stream/formats/langgraph-message-format.ts that converts between AG-UI messages and LangGraph's LangChain-style message format (human/ai/tool/system type discriminators, object-based tool call args, tool_call_id mapping)
  • Support streaming text, streaming tool_call_chunks, complete tool_calls, and human-in-the-loop interrupts via onInterrupt callback
  • Export langGraphAdapter, langGraphMessageFormat, LangGraphAdapterOptions, and LangGraphMessageFormat from package index
  • Add 15 unit tests for the adapter
  • Fix Prettier formatting issues from previous push

Test Plan

  • Verified locally
  • All 15 new adapter tests pass (text streaming, tool calls, errors, interrupts, chunked delivery)
  • All 41 existing tests pass - no regressions
  • TypeScript compiles with zero errors
  • Prettier and ESLint pass on all changed files

Checklist

  • I linked a related issue, if applicable
  • I updated docs/README when needed
  • I considered backwards compatibility

Closes #292

abhithesys
abhithesys previously approved these changes Mar 25, 2026
@abhithesys
Copy link
Copy Markdown
Contributor

This is working as expected. We also need to add message converter to complete the langgraph integration.

@alkitrend
Copy link
Copy Markdown
Contributor Author

This is working as expected. We also need to add message converter to complete the langgraph integration.

Gotcha, let me add it.

abhithesys
abhithesys previously approved these changes Mar 25, 2026
Copy link
Copy Markdown
Contributor

@abhithesys abhithesys left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. We can later improve on how we handle other events eg. snapshot can update entire chat history.
lets merge this.

@abhithesys abhithesys merged commit 41bdef7 into thesysdev:main Mar 27, 2026
1 check passed
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 Adapter

3 participants