LangChain's core message types correspond to different actors and phases in a conversation: HumanMessage for user input, AIMessage for model responses, SystemMessage for setting assistant behavior, ToolMessage for returning tool execution results, and FunctionMessage (deprecated) for legacy function responses [citation:1][citation:6].
LangChain uses a class hierarchy derived from BaseMessage, where each type represents a distinct role or phase in the conversation flow, ensuring the LLM can correctly interpret the source and purpose of each message [citation:1][citation:6].
Represents input from the end user to the AI model.
Typically contains the user's question, command, or statement.
The content field holds the user's text or other data. [citation:1][citation:6]
Represents the response generated by the AI model.
Used for both simple text responses and those containing tool calls.
Contains key fields like tool_calls, usage_metadata, and invalid_tool_calls. [citation:1][citation:6]
Provides high-level instructions to the AI model, defining its persona, rules, and capabilities.
This message is typically not visible to the end user and is sent by the developer at the start of a conversation. [citation:1][citation:6]
Used to return the result of a tool execution back to the AI model.
Must include a tool_call_id that matches the id of the original AIMessage's tool call request.
Also can carry a status and an artifact for large output data. [citation:1][citation:6]
The FunctionMessage exists for legacy compatibility with older function-calling patterns and is largely superseded by ToolMessage in modern LangChain versions. The following code example demonstrates a complete round trip of these core message types in an agentic workflow [citation:1].