Deep Agents: Context Engineering for Long-Horizon Tasks in LangChain
LangChain
Moonshot AI
Anthropic
The world of AI agents is evolving rapidly: from linear LangChain pipelines to LangGraph graphs and further to ready-made environments like Deep Agents. Deep Agents is a library that gathers middleware, tools, and prompts around the basic ReAct loop for managing context in multi-step tasks. It adds planning, file tools, subagents, history summarization, and other mechanisms, but at a cost — a steep increase in the system prompt (from 35 to 6215 tokens) on an empty request.
Modern AI agents are built on different approaches: ready-made frameworks, configuration through a user interface (UI), or custom development. One popular framework is LangChain, which started out with linear pipelines (Runnable) and then evolved into LangGraph for state graphs with a ReAct (Reasoning + Acting) cycle. For short tasks this is enough, but for long ones the agent accumulates context: history, tool results, plans, files. This gives rise to context engineering — managing the environment around the agent. Deep Agents is a ready-made implementation of such an environment within the LangChain ecosystem, presented as the deepagents library. On top of create_agent, it adds middleware layers, tools, and prompt instructions for long-running tasks: planning (write_todos), file tools with pluggable backends, a general-purpose subagent (task), history summarization, recovery of unfinished tool calls, and, optionally, skills, memory, a human in the loop, and a sandbox. However, even without any additional parameters, the system prompt grows from 35 to 6,215 tokens because of the constant BASE_AGENT_PROMPT and the added tools, which increases cost and can confuse smaller models.
Source: Habr — хаб ИИ —
original
