From 01692c9cd93ffe577d143cdb27e7807558fb9a9b Mon Sep 17 00:00:00 2001 From: Mason Daugherty Date: Fri, 6 Feb 2026 15:00:27 -0500 Subject: [PATCH] docs(langchain-classic): add warning for `initialize_agent` function (#35051) Add clear warning to docstring (in addition to already being deprecated) --- .../langchain_classic/agents/initialize.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/libs/langchain/langchain_classic/agents/initialize.py b/libs/langchain/langchain_classic/agents/initialize.py index c01e0e441ea..8ef42dfe5c5 100644 --- a/libs/langchain/langchain_classic/agents/initialize.py +++ b/libs/langchain/langchain_classic/agents/initialize.py @@ -34,6 +34,18 @@ def initialize_agent( ) -> AgentExecutor: """Load an agent executor given tools and LLM. + !!! warning + + This function is no deprecated in favor of + [`create_agent`][langchain.agents.create_agent] from the `langchain` + package, which provides a more flexible agent factory with middleware + support, structured output, and integration with LangGraph. + + For migration guidance, see + [Migrating to langchain v1](https://docs.langchain.com/oss/python/migrate/langchain-v1) + and + [Migrating from AgentExecutor](https://python.langchain.com/docs/how_to/migrate_agent/). + Args: tools: List of tools this agent has access to. llm: Language model to use as the agent. @@ -44,7 +56,6 @@ def initialize_agent( agent_path: Path to serialized agent to use. If `None` and agent is also None, will default to AgentType.ZERO_SHOT_REACT_DESCRIPTION. agent_kwargs: Additional keyword arguments to pass to the underlying agent. - tags: Tags to apply to the traced runs. kwargs: Additional keyword arguments passed to the agent executor.