ValueError: agent_type 'ZeroShotReactDescription' not supported
langchain.agents.agent.ValueError (initialize_agent deprecated parameter)
Stack trace
ValueError: Got unsupported agent type 'ZeroShotReactDescription'. Valid types are: 'react', 'structured-chat-zero-shot-react-description', 'openai-functions', 'openai-multi-actions-agent'. Use `from langchain.agents import create_react_agent` instead.
Why it happens
LangChain v0.1+ redesigned the agent API to separate agent logic from execution. The old agent_type parameter with 'ZeroShotReactDescription' string no longer exists. initialize_agent() itself is now deprecated in favor of create_react_agent() which takes explicit Tool objects and LLM, making the agent composition transparent and testable. This change improves code clarity and enables LangGraph for complex stateful agents.
Detection
Your code imports initialize_agent and passes agent_type='ZeroShotReactDescription' or agent_type='zero-shot-react-description'. Check your agent instantiation for this pattern and replace it before deploying to production.
Causes & fixes
Using deprecated initialize_agent() with agent_type='ZeroShotReactDescription' (old string-based enum)
Replace with create_react_agent(llm=llm, tools=tools) + AgentExecutor.from_agent_and_tools(). This is the direct modern equivalent for simple ReAct agents.
Agent needs memory, multiple steps, or complex state management beyond simple ReAct
Migrate to LangGraph StateGraph with nodes for each step and conditional edges. LangGraph is the recommended pattern for agents with memory, tool loops, or multi-turn interactions in 2026.
Confused about agent_type parameter: trying other string values like 'structured-chat-zero-shot-react-description'
Stop passing agent_type entirely. Use create_react_agent() directly (no agent_type param). The agent type is now determined by how you structure the agent, not a string.
Using old imports from langchain.agents that no longer exist in current SDK
Update imports: use `from langchain.agents import create_react_agent, AgentExecutor` and `from langchain_core.tools import tool` instead of langchain.tools or deprecated langchain.agents.Tool.
Code: broken vs fixed
import os
from langchain.agents import initialize_agent, load_tools
from langchain.llm import OpenAI
llm = OpenAI(api_key=os.environ.get('OPENAI_API_KEY'))
tools = load_tools(['wikipedia', 'llm-math'], llm=llm)
# This line raises ValueError — ZeroShotReactDescription no longer exists
agent = initialize_agent(
tools,
llm,
agent='zero-shot-react-description', # ❌ BROKEN: deprecated agent_type
verbose=True
)
response = agent.run('What is the capital of France?') import os
from langchain_openai import ChatOpenAI
from langchain.agents import create_react_agent, AgentExecutor
from langchain_core.tools import tool
import json
llm = ChatOpenAI(
model='gpt-4o-mini',
api_key=os.environ.get('OPENAI_API_KEY')
)
# Define tools using modern @tool decorator
@tool
def wikipedia_lookup(query: str) -> str:
"""Look up information on Wikipedia. Return relevant summary."""
# Mock implementation — replace with real wikipedia API
return f"Wikipedia result for {query}: France is a country in Western Europe."
@tool
def calculator(expression: str) -> str:
"""Evaluate a math expression and return the result."""
try:
result = eval(expression)
return str(result)
except Exception as e:
return f"Error: {str(e)}"
tools = [wikipedia_lookup, calculator]
# ✅ FIXED: Use create_react_agent instead of initialize_agent
from langchain.agents import create_react_agent, AgentExecutor
from langchain import hub
prompt = hub.pull('hwchase17/react')
agent = create_react_agent(llm, tools, prompt)
executor = AgentExecutor.from_agent_and_tools(
agent=agent,
tools=tools,
verbose=True,
max_iterations=10
)
result = executor.invoke({'input': 'What is the capital of France?'})
print(result['output']) Workaround
If you cannot upgrade LangChain immediately, pin your version to langchain==0.0.352 or earlier where initialize_agent with agent='zero-shot-react-description' still works. However, schedule migration within 2-4 weeks since older versions lack bug fixes and security updates. Add a TODO comment in code noting the deprecation so the team prioritizes the migration.
Prevention
Always use create_react_agent + AgentExecutor for simple agent loops, or LangGraph StateGraph for agents with memory, branching logic, or multi-turn interactions. Never rely on string-based agent_type parameters: they are a legacy pattern. Use type hints on your tool functions so the agent understands the expected input/output schemas. Test agent behavior with mock LLMs before deploying to production.