DeepAgents — Multi-Step Agent Framework by LangChain
Agent harness built on LangGraph by the LangChain team. Features planning tools, filesystem backend, and sub-agent spawning for complex multi-step tasks like codebase refactoring. 16,500+ stars.
What it is
DeepAgents is an agent harness built on LangGraph by the LangChain team. It provides planning tools, a filesystem backend, and sub-agent spawning for complex multi-step tasks like codebase refactoring, research, and document generation. The framework handles the orchestration layer so you can focus on defining what each agent does rather than how agents coordinate.
DeepAgents is designed for developers building AI applications that require multi-step reasoning, tool use, and coordination between specialized sub-agents.
How it saves time or tokens
Building multi-step agent workflows from scratch requires implementing planning logic, state management, error recovery, and sub-agent coordination. DeepAgents provides these as built-in primitives. The planning tool breaks complex tasks into steps automatically, the filesystem backend persists intermediate results, and sub-agent spawning lets you delegate subtasks without manual orchestration. This reduces both development time and the token cost of re-implementing orchestration patterns.
How to use
- Install DeepAgents:
pip install deepagents
- Create and run a simple agent:
from deepagents import Agent
agent = Agent(model='claude-sonnet-4-20250514')
result = agent.run('Refactor the authentication module to use JWT tokens')
print(result)
- For more complex workflows, use the CLI:
deepagents run 'Add comprehensive tests for the payment module'
The agent will plan the task, create sub-agents as needed, and produce the final output.
Example
A multi-step refactoring workflow:
from deepagents import Agent, PlanningTool, FilesystemBackend
agent = Agent(
model='claude-sonnet-4-20250514',
tools=[PlanningTool(), FilesystemBackend(root='./src')],
max_steps=20,
)
# The agent will:
# 1. Analyze the current auth module
# 2. Plan the refactoring steps
# 3. Spawn sub-agents for each file change
# 4. Validate the changes compile
# 5. Return a summary of changes made
result = agent.run(
'Migrate src/auth/ from session-based to JWT authentication. '
'Update all route handlers that check req.session.'
)
Related on TokRepo
- Multi-agent frameworks — Compare multi-agent orchestration frameworks
- LangGraph agents — Deep dive into the LangGraph framework
Common pitfalls
- Setting
max_stepstoo low for complex tasks. The agent may abandon a task mid-way if it runs out of steps. Start with a generous limit and tune down based on observed behavior. - Not providing filesystem access when the task involves code changes. Without a FilesystemBackend, the agent can only suggest changes but cannot apply them directly.
- Expecting deterministic outputs. Multi-step agent workflows involve multiple LLM calls, each with some variability. Run important tasks multiple times and validate results.
Frequently Asked Questions
DeepAgents is built on top of LangGraph, which provides the graph-based orchestration and state management. DeepAgents adds higher-level abstractions like planning tools, filesystem backends, and sub-agent spawning that make it easier to build complex multi-step workflows.
DeepAgents supports any model accessible through LangChain's model integrations, including Claude, GPT-4, and open-source models. You specify the model when creating an Agent instance.
Yes. When the planning tool determines a task can be parallelized, the main agent spawns sub-agents for independent subtasks. Each sub-agent has its own context and tools, and results are merged back into the main agent's state.
DeepAgents provides the building blocks for production workflows, but you should add error handling, rate limiting, and output validation for production deployments. The framework handles orchestration; production hardening is your responsibility.
The FilesystemBackend gives the agent read and write access to a specified directory. The agent can read files to understand code structure, write modified files, and create new files. All operations are scoped to the root directory you specify.
Citations (3)
- DeepAgents GitHub— DeepAgents is built on LangGraph by the LangChain team
- LangGraph Documentation— LangGraph provides graph-based agent orchestration
- LangChain Agent Documentation— Planning and sub-agent patterns for multi-step tasks
Related on TokRepo
Source & Thanks
Created by LangChain AI. Licensed under MIT.
deepagents — ⭐ 16,500+
Thanks to the LangChain team for advancing the state of multi-step AI agents.
Discussion
Related Assets
Moodle — Open-Source Learning Management System
The most widely used open-source learning platform, providing course management, assessments, and collaboration tools for educators and organizations worldwide.
Sylius — Headless E-Commerce Framework on Symfony
An open-source headless e-commerce platform built on Symfony and API Platform, designed for developers who need a customizable and API-first commerce solution.
Akaunting — Free Self-Hosted Accounting Software
A free, open-source online accounting application built on Laravel for small businesses and freelancers to manage invoices, expenses, and financial reports.