High severity intermediate · Fix: 10-20 min

ValueError: agent_type 'ZeroShotReactDescription' not supported

langchain.agents.agent.ValueError (initialize_agent deprecated parameter)

What this error means
LangChain removed ZeroShotReactDescription agent type in v0.1+ and deprecated initialize_agent entirely in favor of create_react_agent with AgentExecutor or LangGraph for modern agent patterns.

Stack trace

traceback
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.
QUICK FIX
Replace `initialize_agent(tools, llm, agent='zero-shot-react-description')` with `agent = create_react_agent(llm, tools); executor = AgentExecutor.from_agent_and_tools(agent=agent, tools=tools, verbose=True); executor.invoke({'input': query})`.

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

1

Using deprecated initialize_agent() with agent_type='ZeroShotReactDescription' (old string-based enum)

✓ Fix

Replace with create_react_agent(llm=llm, tools=tools) + AgentExecutor.from_agent_and_tools(). This is the direct modern equivalent for simple ReAct agents.

2

Agent needs memory, multiple steps, or complex state management beyond simple ReAct

✓ Fix

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.

3

Confused about agent_type parameter: trying other string values like 'structured-chat-zero-shot-react-description'

✓ Fix

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.

4

Using old imports from langchain.agents that no longer exist in current SDK

✓ Fix

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

Broken - triggers the error
python
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?')
Fixed - works correctly
python
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'])
Replaced deprecated initialize_agent() with create_react_agent() + AgentExecutor, updated tool definitions to use @tool decorator, and switched imports to langchain_core and langchain_openai (current SDK structure). Agent type is no longer a string parameter — it's defined by using create_react_agent().

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.

Python 3.9+ · langchain >=0.1.0 · tested on 0.3.x
Verified 2026-04 · gpt-4o-mini, claude-3-5-haiku-20241022
Verify ↗

Community Notes

No notes yetBe the first to share a version-specific fix or tip.