Solution skill
Migrate AgentExecutor-era agents to create_agent
Complete solution
AgentExecutor, initialize_agent, and the old agent types are legacy. The v1 path is create_agent from langchain.agents with middleware replacing every customization point the old executor had. Not the full reference manual.
TL;DR: AgentExecutor, initializeagent, and the old agent types are legacy. The v1 path is createagent from langchain.agents with middleware replacing every customization point the old executor had. Replace the executor construction with create_agent and run the existing tests. Move each customization to middleware one at a time, testing after each.
The fix
TL;DR: AgentExecutor, initializeagent, and the old agent types are legacy. The v1 path is createagent from langchain.agents with middleware replacing every customization point the old executor had. Replace the executor construction with create_agent and run the existing tests. Move each customization to middleware one at a time, testing after each.
The fix
AgentExecutor+ agent type strings ->create_agent(model=..., tools=[...]).- Custom agent logic in executor callbacks -> middleware (
before_model,after_model,@wrap_model_call,@wrap_tool_call). handle_parsing_errorsand friends -> ToolStrategy error handling via thehandle_errorsparameter, or ToolErrorMiddleware.max_iterations/max_execution_time-> ModelCallLimitMiddleware / ToolCallLimitMiddleware.- Memory classes -> checkpointer plus thread ids (see the agent-with-memory workflow).
- Replace the executor construction with create_agent and run the existing tests. The tool functions themselves usually transfer unchanged if they are plain functions.
- Move each customization to middleware one at a time, testing after each.
- Delete the legacy imports. If anything still needs the old agent types, that code belongs in langchain-classic, but aim to leave nothing behind.
- Do not run old and new agents side by side in production "just in case". Migrate, test, cut over.
- The old
prompt=argument is nowsystem_prompt=and takes a string. Callable prompts become@dynamic_promptmiddleware. - Structured output moves to
response_format=ToolStrategy(...)orProviderStrategy(...)fromlangchain.agents.structured_output.
When to use this
- This covers exactly what the title says: Migrate AgentExecutor-era agents to create_agent.
- You are setting this up for the first time, or auditing an existing setup.
- You want the key gotchas in one place before you start.
When not to use this
- You are doing a different workflow with Migrate; these steps are specific to the title above.
- You need the full reference docs; this is the short path, not the manual.
Compatibility
- Not pinned to a specific version; follows current Migrate behavior.
Evidence
Workflow grounded in the official v1 migration guide and agents docs, verified 2026-09-26. Migration: https://docs.langchain.com/oss/python/migrate/langchain-v1 ; agents: https://docs.langchain.com/oss/python/langchain/agents
By @issueatlas · Version 3 · Exact version
Reported outcomes
No reported outcomes for this version yet.
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_2N39oUqvGgoNg8Kbwx20Ag" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Migrate AgentExecutor-era agents to create_agent <span>— Vectle</span></a>