Skip to content

Add @openuidev/langflow adapter #1056

Description

@vishxrad

Is your feature request related to a problem? Please describe.

OpenUI does not have a maintained adapter for Langflow's Workflow API. Developers connecting an OpenUI AgentInterface to Langflow currently have to map OpenUI thread and action turns into Langflow workflow inputs, preserve follow-up and form context, scope session ids, and pass Langflow's native AG-UI stream back to OpenUI themselves.

The related Langflow proposal is langflow-ai/langflow#14732:
langflow-ai/langflow#14732

Describe the solution you'd like

Add an @openuidev/langflow package to this repository. The package exposes a Web-standard server helper around Langflow's public POST /api/v2/workflows endpoint. It maps OpenUI threadId values to Langflow session_id values, converts the latest user, follow-up, or form turn into input_value, requests mode: "stream" with stream_protocol: "agui", and returns the native AG-UI response for OpenUI's maintained agUIAdapter().

The request path is:

OpenUI AgentInterface
  -> application server route
  -> @openuidev/langflow
  -> Langflow Workflow API v2 with native AG-UI streaming
  -> Langflow flow, model, tools, and session memory
  -> OpenUI agUIAdapter, parser, renderer, actions, and theme

Langflow owns the workflow graph, model calls, tools, and session memory. OpenUI owns the chat shell, OpenUI Lang parser and renderer, streaming UI state, theme, follow-ups, and form actions. The adapter is the server-side boundary between them and keeps credentials out of the browser.

The proposed scope is:

  • packages/langflow with request handling, session mapping, input normalization, native AG-UI passthrough, typed extension hooks, and focused tests;
  • an API-reference page and integrations-directory entry;
  • root package catalog and npm release-workflow updates.

The implementation targets Langflow Workflow API v2 and was exercised with lfx==1.11.4, lfx-openai==0.1.0, and the OpenUI workspace packages. Package unit tests, typecheck, lint, formatting, build, publint, and AreTheTypesWrong pass. The OpenUI docs production build also passes.

A full Langflow chat application was used for live acceptance. It rendered a labeled chart, sent a follow-up as one new turn in the same session, blocked an incomplete required form, and included edited form values in the next response. OpenUI examples are now standalone and require exact published @openuidev/* versions, so the catalog example should follow after the first package release instead of depending on an unpublished workspace package in this pull request.

I would be happy to maintain @openuidev/langflow as the Langflow API evolves.

Describe alternatives you've considered

  • Keep the adapter in an example. This avoids a package but leaves every application to copy request parsing, action normalization, session mapping, error handling, and Workflow API setup.
  • Put the adapter only in the Langflow repository. That can document Langflow's frontend boundary, but the reusable TypeScript API directly serves OpenUI's message and stream contracts and fits alongside other OpenUI framework adapters.
  • Convert Langflow's stream to an OpenAI-compatible protocol. Langflow already emits AG-UI, so an extra conversion layer adds code and loses the native protocol boundary.

Additional context

The implementation is on visharad/openui-langflow-integration. The package documentation links both projects and records their division of responsibility.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions