The langchain package namespace has been significantly reduced in v1 to focus on essential building blocks for agents. The streamlined package makes it easier to discover and use the core functionality.
The import path for the agent prebuilt has changed from langgraph.prebuilt to langchain.agents.
The name of the function has changed from create_react_agent to create_agent:
from langgraph.prebuilt import create_react_agent from langchain.agents import create_agent
The prompt parameter has been renamed to system_prompt:
from langchain.agents import create_agentagent = create_agent( model="claude-sonnet-4-6", tools=[check_weather], system_prompt="You are a helpful assistant")
from langgraph.prebuilt import create_react_agentagent = create_react_agent( model="claude-sonnet-4-6", tools=[check_weather], prompt="You are a helpful assistant")
If using SystemMessage objects in the system prompt, extract the string content:
from langchain.agents import create_agentagent = create_agent( model="claude-sonnet-4-6", tools=[check_weather], system_prompt="You are a helpful assistant")
from langchain.messages import SystemMessagefrom langgraph.prebuilt import create_react_agentagent = create_react_agent( model="claude-sonnet-4-6", tools=[check_weather], prompt=SystemMessage(content="You are a helpful assistant"))
Dynamic prompts are a core context engineering pattern—they adapt what you tell the model based on the current conversation state. To do this, use the @dynamic_prompt decorator:
Pre-model hooks are now implemented as middleware with the before_model method.
This new pattern is more extensible—you can define multiple middlewares to run before the model is called,
reusing common patterns across different agents.Common use cases include:
Summarizing conversation history
Trimming messages
Input guardrails, like PII redaction
v1 now has summarization middleware as a built in option:
Post-model hooks are now implemented as middleware with the after_model method.
This new pattern is more extensible—you can define multiple middlewares to run after the model is called,
reusing common patterns across different agents.Common use cases include:
from langgraph.prebuilt import create_react_agentfrom langgraph.prebuilt import AgentStatedef custom_human_in_the_loop_hook(state: AgentState): """Custom logic for human in the loop approval.""" ...agent = create_react_agent( model="claude-sonnet-4-6", tools=[read_email, send_email], post_model_hook=custom_human_in_the_loop_hook)
Via middleware - Best for state managed by specific middleware hooks and tools attached to said middleware
Defining custom state via middleware is preferred over defining it via state_schema on create_agent because it allows you to keep state extensions conceptually scoped to the relevant middleware and tools.state_schema is still supported for backwards compatibility on create_agent.
Middleware can also define custom state by setting the state_schema attribute.
This helps to keep state extensions conceptually scoped to the relevant middleware and tools.
Simply inherit from langchain.agents.AgentState instead of BaseModel or decorating with dataclass.
If you need to perform validation, handle it in middleware hooks instead.
Dynamic model selection allows you to choose different models based on runtime context (e.g., task complexity, cost constraints, or user preferences). create_react_agent released in v0.6 of langgraph-prebuilt supported dynamic model and tool selection via a callable passed to the model parameter.This functionality has been ported to the middleware interface in v1.
Structured output used to be generated in a separate node from the main agent. This is no longer the case.
We generate structured output in the main loop, reducing cost and latency.
from langchain.agents import create_agentfrom langchain.agents.structured_output import ToolStrategy, ProviderStrategyfrom pydantic import BaseModelclass OutputSchema(BaseModel): summary: str sentiment: str# Using ToolStrategyagent = create_agent( model="gpt-5.4-mini", tools=tools, # explicitly using tool strategy response_format=ToolStrategy(OutputSchema))
from langgraph.prebuilt import create_react_agentfrom pydantic import BaseModelclass OutputSchema(BaseModel): summary: str sentiment: stragent = create_react_agent( model="gpt-5.4-mini", tools=tools, # using tool strategy by default with no option for provider strategy response_format=OutputSchema )# ORagent = create_react_agent( model="gpt-5.4-mini", tools=tools, # using a custom prompt to instruct the model to generate the output schema response_format=("please generate ...", OutputSchema))
Prompted output is no longer supported via the response_format argument. Compared to strategies
like artificial tool calling and provider native structured output, prompted output has not proven to be particularly reliable.
The old config["configurable"] pattern still works for backward compatibility, but using the new context parameter is recommended for new applications or applications migrating to v1.
In v1, messages gain provider-agnostic standard content blocks. Access them via message.content_blocks for a consistent, typed view across providers. The existing message.content field remains unchanged for strings or provider-native structures.
Standard content blocks are not serialized into the content attribute by default. If you need to access standard content blocks in the content attribute (e.g., when sending messages to a client), you can opt-in to serializing them into content.
export LC_OUTPUT_VERSION=v1
from langchain.chat_models import init_chat_modelmodel = init_chat_model( "gpt-5-nano", output_version="v1",)
The langchain package namespace has been significantly reduced in v1 to focus on essential building blocks for agents. The streamlined package makes it easier to discover and use the core functionality.
The return type signature for chat model invocation has been fixed from BaseMessage to AIMessage. Custom chat models implementing bind_tools should update their return signature:
When interacting with the Responses API, langchain-openai now defaults to storing response items in message content. To restore previous behavior, set the LC_OUTPUT_VERSION environment variable to v0, or specify output_version="v0" when instantiating ChatOpenAI.
# Enforce previous behavior with output_version flagmodel = ChatOpenAI(model="gpt-5.4-mini", output_version="v0")
The max_tokens parameter in langchain-anthropic now defaults to higher values based on the model chosen, rather than the previous default of 1024. If you relied on the old default, explicitly set max_tokens=1024.
Existing functionality outside the focus of standard interfaces and agents has been moved to the langchain-classic package. See the Simplified namespace section for details on what’s available in the core langchain package and what moved to langchain-classic.
Methods, functions, and other objects that were already deprecated and slated for removal in 1.0 have been deleted. Check the deprecation notices from previous versions for replacement APIs.
AIMessageChunk objects now include a chunk_position attribute with position 'last' to indicate the final chunk in a stream. This allows for clearer handling of streamed messages. If the chunk is not the final one, chunk_position will be None.
The logic for merging message chunks (AIMessageChunk.add) has been updated with more sophisticated selection handling for the final id for the merged chunk. It prioritizes provider-assigned IDs over LangChain-generated IDs.