SDK message types don't support @langchain/core v1 ContentBlock formats #392

Open
opened 2026-02-15 18:16:24 -05:00 by yindo · 0 comments
Owner

Originally created by @mingxuan-he on GitHub (Jan 3, 2026).

Checked other resources

  • I added a very descriptive title to this issue.
  • I searched the LangGraph.js documentation with the integrated search.
  • I used the GitHub search to find a similar question and didn't find it.
  • I am sure that this is a bug in LangGraph.js rather than my code.
  • The bug is not resolved by updating to the latest stable version of LangGraph (or the specific integration package).

Example Code

import { Message } from "@langchain/langgraph-sdk";
import { HumanMessage } from "@langchain/core/messages";

// This works with SDK
const sdkCompatibleMessage: Message = {
  type: "human",
  content: [
    { type: "text", text: "Hello" },
    { type: "image_url", image_url: { url: "https://example.com/image.png" } }
  ]
};

// This is the newer @langchain/core v1 ContentBlock.Multimodal.Image format
// but not supported by the SDK's MessageContentComplex types
const coreV1ImageBlock = {
  type: "image" as const,
  url: "https://example.com/image.png",
  mimeType: "image/png"
};

// This assignment would fail because the SDK doesn't recognize "image" type
// const sdkMessageWithCoreTypes: Message = {
//   type: "human",
//   content: [coreV1ImageBlock]  // ❌ Type error here
// };

Error Message and Stack Trace (if applicable)

Type '{ type: "image"; url: string; mimeType: string; }' is not assignable to type 'MessageContentComplex'.
Type '{ type: "image"; url: string; mimeType: string; }' is not assignable to type 'MessageContentText'.
Type '{ type: "image"; url: string; mimeType: string; }' is not assignable to type 'MessageContentImageUrl'.
Property 'image_url' is missing in type '{ type: "image"; url: string; mimeType: string; }' but required in type 'MessageContentImageUrl'.

Where MessageContentComplex is defined as:

type MessageContentComplex = MessageContentText | MessageContentImageUrl;

// MessageContentText = { type: "text"; text: string; }
// MessageContentImageUrl = { type: "image_url"; image_url: string | { url: string; detail?: ImageDetail } }

And @langchain/core ContentBlock.Multimodal.Image is:

type Image = Data & {
  readonly type: "image";  // ❌ Not supported by SDK
  // Plus Data properties: mimeType?, url?, data?, fileId?, etc.
}

Description

The @langchain/langgraph-sdk package only supports OpenAI-style message content blocks (text and image_url), but the newer @langchain/core v1 package introduces a more comprehensive ContentBlock format that includes image, file, video, and other multimodal content types.

This creates a type mismatch where developers using the latest @langchain/core ContentBlock types cannot use them directly with the langgraph SDK without type assertions or conversions.

System Info

  • Package: @langchain/langgraph-sdk@1.3.1
  • @langchain/core: 1.1.8
  • Platform: macOS
  • Node version: 20.11.1
  • Package Manager: npm 10.2.4

Package Info:

frontend-react@0.0.0 /path/to/project
├── @langchain/core@1.1.8
└── @langchain/langgraph-sdk@1.3.1
Originally created by @mingxuan-he on GitHub (Jan 3, 2026). ### Checked other resources - [x] I added a very descriptive title to this issue. - [x] I searched the LangGraph.js documentation with the integrated search. - [x] I used the GitHub search to find a similar question and didn't find it. - [x] I am sure that this is a bug in LangGraph.js rather than my code. - [x] The bug is not resolved by updating to the latest stable version of LangGraph (or the specific integration package). ### Example Code ```typescript import { Message } from "@langchain/langgraph-sdk"; import { HumanMessage } from "@langchain/core/messages"; // This works with SDK const sdkCompatibleMessage: Message = { type: "human", content: [ { type: "text", text: "Hello" }, { type: "image_url", image_url: { url: "https://example.com/image.png" } } ] }; // This is the newer @langchain/core v1 ContentBlock.Multimodal.Image format // but not supported by the SDK's MessageContentComplex types const coreV1ImageBlock = { type: "image" as const, url: "https://example.com/image.png", mimeType: "image/png" }; // This assignment would fail because the SDK doesn't recognize "image" type // const sdkMessageWithCoreTypes: Message = { // type: "human", // content: [coreV1ImageBlock] // ❌ Type error here // }; ``` ### Error Message and Stack Trace (if applicable) ``` Type '{ type: "image"; url: string; mimeType: string; }' is not assignable to type 'MessageContentComplex'. Type '{ type: "image"; url: string; mimeType: string; }' is not assignable to type 'MessageContentText'. Type '{ type: "image"; url: string; mimeType: string; }' is not assignable to type 'MessageContentImageUrl'. Property 'image_url' is missing in type '{ type: "image"; url: string; mimeType: string; }' but required in type 'MessageContentImageUrl'. ``` Where `MessageContentComplex` is defined as: ```typescript type MessageContentComplex = MessageContentText | MessageContentImageUrl; // MessageContentText = { type: "text"; text: string; } // MessageContentImageUrl = { type: "image_url"; image_url: string | { url: string; detail?: ImageDetail } } ``` And `@langchain/core` ContentBlock.Multimodal.Image is: ```typescript type Image = Data & { readonly type: "image"; // ❌ Not supported by SDK // Plus Data properties: mimeType?, url?, data?, fileId?, etc. } ``` ### Description The `@langchain/langgraph-sdk` package only supports OpenAI-style message content blocks (`text` and `image_url`), but the newer `@langchain/core` v1 package introduces a more comprehensive ContentBlock format that includes `image`, `file`, `video`, and other multimodal content types. This creates a type mismatch where developers using the latest `@langchain/core` ContentBlock types cannot use them directly with the langgraph SDK without type assertions or conversions. ### System Info - **Package**: @langchain/langgraph-sdk@1.3.1 - **@langchain/core**: 1.1.8 - **Platform**: macOS - **Node version**: 20.11.1 - **Package Manager**: npm 10.2.4 Package Info: ``` frontend-react@0.0.0 /path/to/project ├── @langchain/core@1.1.8 └── @langchain/langgraph-sdk@1.3.1 ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/langgraphjs#392