know.2nth.ai Agents Deep Agents
agents · Deep Agents · Skill Leaf

The Claude Code architecture, minus the model lock-in.

Deep Agents is LangChain's batteries-included agent harness for long-running, high-context work — deep research, whole-codebase engineering, multi-step workflows that outrun a single context window. It bundles the scaffolding that makes tools like Claude Code and Codex effective — planning, sub-agents, a virtual filesystem, and context compaction — into one MIT-licensed library that runs on any tool-calling model. It is not a competitor to LangGraph; it is built on it. pip install deepagents, create_deep_agent(), done.

MIT licensed Built on LangGraph Python · TypeScript Provider-agnostic pip install deepagents

A harness, not a model — and not a new framework.

Deep Agents starts from a specific observation: the capability you feel when you use Claude Code or Codex doesn't come from the raw model. It comes from the scaffolding around it — the system prompt, a planning tool, a filesystem, the ability to spin up sub-agents, and a way to compress the conversation before it overflows. LangChain calls that scaffolding an agent harness, and Deep Agents is the open-source, model-agnostic extraction of exactly that pattern. Point it at any LLM that supports tool calling — frontier API, open-weight, or local — and you get the Claude Code shape without being tied to one vendor's runtime.

The most important thing to get right about Deep Agents is where it sits, because it is easy to mistake for a rival to its own foundation. LangChain states the stack plainly: LangGraph is the graph runtime; create_agent is a minimal agent harness on top of it; Deep Agents is a more opinionated harness on top of create_agent. Same building blocks all the way down — Deep Agents just makes the batteries-included choices so you don't have to assemble them yourself.

Layer 1 · runtime

LangGraph

The graph runtime. Streaming, checkpointing, persistence, human-in-the-loop interrupts. Everything above inherits these for free.

Layer 2 · minimal harness

create_agent

LangChain's lightweight tool-calling loop with middleware hooks. Enough to build a standard agent; you add the rest.

Layer 3 · opinionated harness

Deep Agents

Planning, sub-agents, filesystem, and compaction wired in by default. The batteries-included choice for long-horizon tasks.

What "harness" actually means

A harness is everything wrapped around the core LLM-plus-tool-calling loop that turns a capable model into a capable agent: the system prompt, a way to plan and track steps, a place to write intermediate results, a mechanism to delegate sub-tasks, and a strategy for keeping the context window from overflowing on a long job. LangChain's own term of art — from its "Anatomy of an Agent Harness" post — and Deep Agents is a concrete, opinionated implementation of it. The word matters because it names the layer where the real engineering now lives: not in the model, in the scaffolding.

Four mechanisms, delivered as middleware.

Deep Agents is the sum of four harness mechanisms, each shipped as LangChain middleware you can inspect, swap, or disable: planning, sub-agents, a virtual filesystem, and context compaction. The two-line factory below wires all four in; everything after it is detail on what each one does.

from deepagents import create_deep_agent

# any tool-calling model: frontier, open-weight, or local
agent = create_deep_agent(
    model="anthropic:claude-sonnet-4-6",
    tools=[web_search],
    system_prompt="You are an expert researcher.",
)

result = agent.invoke({"messages": [("user", "Brief me on OKF adoption.")]})

1 · Planning — the write_todos tool (TodoListMiddleware). The agent maintains a stateful todo list — each item pending, in_progress, or completed — persisted in agent state rather than left implicit in the chat history. On a long task, the plan survives context compaction and keeps the agent oriented.

2 · Sub-agents — the task tool (SubAgentMiddleware). The main agent spawns an ephemeral, stateless sub-agent with a fresh, isolated context to do one piece of work, then hands back a compact summary. The point is token economy: the noisy middle of a sub-task — dozens of tool calls, large intermediate results — never pollutes the parent's context. Only the conclusion returns.

3 · Filesystemls, read_file, write_file, edit_file, glob, grep (FilesystemMiddleware). A virtual filesystem the agent reads and writes, backed by in-memory state, a LangGraph store, or real local disk. Its load-bearing job is offloading: large tool results are written to a file and referenced by path instead of being kept inline, so a single big search result can't blow the context budget. The agent pulls back only the slice it needs, when it needs it.

4 · Context compaction — summarization middleware. Long threads get compressed: recent messages are retained, everything before is replaced with a summary. This is where a genuinely new capability shipped — and the distinction is worth being precise about.

Two kinds of compaction — and why the second one matters

Threshold-based (the classic). The harness watches the context window and compacts when usage crosses a fixed line. It works, but it's blunt: it can fire in the middle of a delicate multi-step operation, or hold on too long right up to the limit.

Autonomous (the newer mode). LangChain's autonomous context compression (announced March 2026) gives the model a compact_conversation tool and lets it decide when to compress — at a task boundary, after extracting results from a large context, before starting something complex. It's gated so it can't fire too early (eligibility kicks in around half the auto-summarization trigger) and retains roughly the last 10% of context while summarizing the rest. It is opt-in in the SDK and on by default in the deepagents CLI. The shift — from the harness deciding when to the model deciding — is the editorially interesting part; LangChain frames it as letting the reasoning model manage its own memory.

On the threshold number — sources don't agree, so don't quote one

You'll see the classic threshold cited as "around 85% of the window" in some write-ups and as a "~170K-token auto-summarization trigger" in one Deep Agents configuration. These describe different mechanisms and different runs, not a single canonical figure. The honest statement is: fixed-threshold compaction fires at some configured point near the window's limit — and that bluntness is precisely the brittleness the autonomous tool was built to fix. Treat any specific percentage as configuration, not spec.

SDK, CLI, and the LangChain machinery underneath.

Deep Agents inherits LangGraph's runtime (streaming, checkpointing, persistence) and LangSmith's tracing and evaluation. It ships in two shapes: a library you embed, and a CLI that adds the surrounding tooling a real agent workflow needs.

Library · SDK

deepagents / deepagentsjs

The MIT-licensed harness itself, in Python and TypeScript. create_deep_agent() and the four middleware. Embed it in your own app.

Tool · CLI

deepagents CLI

Adds web search, remote sandboxes, persistent memory, custom skills, and human-in-the-loop approval around the SDK. Autonomous compaction on by default here.

Runtime · inherited

LangGraph

Streaming, checkpointing, persistence, interrupts. A Deep Agent is a LangGraph graph underneath — long jobs survive crashes and pauses.

SaaS · observability

LangSmith

Tracing and evaluation for agent runs. The autonomous-compaction work was validated against Terminal-Bench-2 via LangSmith. USD-billed at scale.

Standards it speaks. Deep Agents brings your own tools or any MCP server, and it can load Agent Skills as reusable, on-demand behaviours — so the harness plugs into the same open-standards layer as the rest of the agents tree rather than reinventing it.

Provenance, stated honestly. The middleware isn't all from one package: some ships in deepagents, some in langchain itself, and provider-specific pieces (Anthropic prompt caching, for instance) live in langchain-anthropic. That's normal for a LangChain-family library, but worth knowing when you go to pin versions — a "Deep Agents" behaviour may actually be governed by a dependency's release cadence.

One field note, clearly labelled as opinion: the LangChain engineers describe a stated preference for routing different models to different jobs — Gemini for multimodal, Claude for execution and SQL, a third for long prose. That's practitioner taste, not a benchmarked finding, and Deep Agents' model-agnosticism is what makes acting on it a one-line change rather than a rebuild.

Deep Agents vs create_agent vs raw LangGraph.

This is not a "who wins" table — all three are the same stack at different levels of opinion. The question is only how much harness you want handed to you versus how much control you want to keep. LangChain's own guidance runs top to bottom.

DimensionDeep Agentscreate_agentRaw LangGraph
Harness levelFull, opinionatedMinimalNone — you build it
Out of the boxPlanning, sub-agents, filesystem, compactionTool-calling loop + middleware hooksNodes, edges, state, checkpointer
Built oncreate_agentLangGraph
Best whenLong-horizon, high-context tasksA standard agent with light needsA bespoke agent-loop shape
Effort for deep workLowestMedium — you add the scaffoldingHighest — you design it all

The other axis: Deep Agents vs the proprietary harnesses

The second comparison people actually mean is Deep Agents vs Claude Code or Codex — the closed harnesses it's modelled on. Those are polished, vendor-tuned, and tied to one model family. Deep Agents trades some of that polish for two things: it runs on any tool-calling model, and it's yours to modify — the middleware is open and swappable. If you're happy inside one vendor's tool and never need to change models, the proprietary harness is the smoother ride. If model-agnosticism or customisation is the point, Deep Agents is the reason to switch. There is no clean public benchmark pitting them head-to-head; don't trust one that claims to.

Where the full harness pays for itself.

Deep Agents earns its overhead on tasks that are long, context-heavy, and decomposable — the patterns the primary sources actually name, not a customer-logo roster.

  • Deep research — the canonical example. Plan the investigation, fan out sub-agents to chase separate threads in isolated contexts, offload the raw findings to the filesystem, compact along the way, synthesise at the end. No single context window ever holds all of it.
  • Whole-codebase software engineering — navigate a large repo with glob/grep, read and edit files, run sub-agents for isolated changes, and keep a live todo list across a multi-file task. This is the Claude Code shape, model-agnostic.
  • Long-horizon multi-step workflows — jobs with dozens of steps where the plan must persist and the context must be actively managed rather than allowed to overflow.
  • Parallel sub-task fan-out — anything that decomposes into independent pieces whose noisy intermediate work should stay quarantined from the main thread.

An honest limit. Unlike LangGraph, Deep Agents doesn't yet have a public roster of named production case studies (the Klarna / Replit kind). It's a younger library. Treat the use cases above as the patterns it's designed for, not as claims about who's already running it at scale.

Use Deep Agents when. Skip it when.

The harness is a real cost — middleware, compaction, sub-agent spawns all add overhead. On the right task that overhead buys you a working long-horizon agent; on the wrong one it's dead weight. Honest two-sided guidance follows.

Use Deep Agents when

  • The task is long-running and context-heavy — deep research, whole-codebase work
  • You want the Claude Code scaffolding but model-agnostic across vendors
  • You need planning, sub-agents, filesystem, and compaction out of the box, not hand-built
  • You're running a multi-model strategy and want to swap the model node freely
  • You already build on LangGraph and want the opinionated layer on top
  • You want MCP tools and Agent Skills loaded into the harness

Version note

Deep Agents is young and moving fast — autonomous compaction landed in early 2026 and the middleware surface is still settling. Pin your versions in production, and remember the provenance point: some behaviours are governed by langchain or langchain-anthropic releases, not deepagents alone. The durable artefact is your agent definition; expect to track runtime updates more actively than you would with a 1.0-stable framework.

Model-agnostic is the POPIA feature.

Deep Agents' model-agnosticism isn't just a portability nicety in SA delivery — it's the compliance and cost lever. Same harness, different model node, no rebuild.

Residency · swap the model, keep the harness

The whole value of a model-agnostic harness under POPIA is that the model is one node you can move. Prototype against Claude (US), then swap to a local Ollama- or vLLM-hosted open-weight running in africa-south1 or on-prem — the planning, sub-agents, filesystem, and compaction all stay identical. POPIA Section 72 cross-border-transfer becomes a per-deployment decision about one line of config, not an architecture rewrite. The harness is the durable asset; the model is the substitutable runtime.

Resilience · long jobs survive load-shedding

Because Deep Agents runs on LangGraph, a long-horizon job is checkpointed and its working state lives on the filesystem. A load-shedding interruption or a sandbox timeout mid-research doesn't cost the whole run — it resumes from the last checkpoint. For SA teams running multi-hour agent jobs on unreliable power, that durability is a practical, not theoretical, benefit.

Cost · free harness, watch the LangSmith line

The harness itself is free MIT and self-hostable — no per-seat licence, no FX exposure on the library. The USD-billed piece is the same as the LangGraph leaf: LangSmith at production volume. Use the free tier through pilots; treat paid observability as a deliberate line item, or self-host an OpenTelemetry stack if FX exposure is the binding constraint. The model spend is yours to control precisely because you choose the model node.

Where Deep Agents links in the tree.

Primary sources.

Authored from the canonical langchain-ai/deepagents repo, the Deep Agents documentation and reference, and LangChain Inc.'s harness and autonomous-compaction posts. Last reviewed 2026-07-19.