🤖 AI Hot

Build Production AI Agents with Deep Agents Harness

A
Alex Chen

Most AI agent tutorials are toys. They demo a single tool call and call it a day. Production agents, the kind that actually ship, need to handle task planning, sub-agent delegation, long-running contexts, and partial failure — and most frameworks weren’t built for that.

A new open-source tutorial called Deep Agents in Practice (《Deep Agents 实战》), released by LangChain ambassador @zhanghaili0610, takes a different approach. It walks through building real agents using the Deep Agents Harness, a framework that sits on top of LangChain and LangGraph to solve the problems production agents actually face.

I went through the 8-chapter tutorial and came away with a clear picture of what the framework gets right and where it still stumbles. Here’s what you need to know.

The three-layer architecture that actually makes sense

Most agent frameworks mix concerns. LangChain alone is a sprawling toolkit — you can build an agent a dozen different ways, and half of them break when your prompt gets longer than a few thousand tokens.

Deep Agents Harness introduces a clean three-layer separation:

  • Runtime (LangGraph): Handles state management, checkpointing, and the execution graph. This is where your agent runs, pauses, resumes, and branches.
  • Framework (LangChain): Provides the building blocks — LLM wrappers, tool abstractions, prompt templates, output parsers. You compose these but don’t manage execution flow here.
  • Harness (Deep Agents): The opinionated layer. It enforces how agents are structured, how they delegate to sub-agents, and how context flows between components.

This isn’t just architecture porn. The separation means you can swap the runtime (say, to a custom event loop) without touching your framework code. It also means the Harness layer can make assumptions — like “every task gets a virtual file system” — that would be impossible if everything was tangled together.

Context engineering: the virtual file system trick

The cleverest part of the framework is how it handles context. Instead of stuffing everything into the LLM’s context window and hoping for the best, Deep Agents gives every agent a virtual file system.

Think of it as tmpfs for your agent. When a sub-agent needs to read a file, it doesn’t get the whole thing dumped into context. It reads only what it needs. Intermediate results get written to disk-like buffers. Large files get chunked and read in segments.

This matters because context window management is where most production agents die. You start with a clean prompt, run three tool calls, and suddenly your 200K context window is full of JSON blobs and stack traces. The virtual file system approach means your agent’s working memory stays clean.

The tutorial covers six tools built on this VFS layer:

  • Structured read/write with offset support
  • File listing and metadata queries
  • Temporary scratch space for intermediate computation
  • Cross-agent file sharing (one agent writes, another reads)

Task planning that doesn’t feel bolted on

A lot of agent frameworks treat task planning as an afterthought — “just ask the LLM to make a plan first.” Deep Agents bakes it into the harness.

The planning system works in two phases: first, a lightweight LLM call generates a task tree with dependencies. Then the harness schedules tasks, runs independent ones in parallel, and feeds results into dependent tasks. If a task fails, the harness can retry with more context or route to a fallback.

Parallel sub-agent delegation is where this shines. You can spin up three agents simultaneously — one researching, one coding, one writing tests — and the harness merges their output. Each agent gets its own VFS namespace, so they don’t step on each other.

I’ve seen teams build this kind of orchestration from scratch with Celery and Redis. Having it built into the agent framework cuts out a whole class of infrastructure problems.

Skills reuse across agents

Another pattern the tutorial emphasizes is Skills — packaged, reusable agent capabilities. A Skill is basically a prompt template + tool bundle + validation logic, wrapped up as a self-contained unit.

Once you write a “code review” Skill, every agent in your system can use it. Skills are versioned and composable — you can chain them or run them in parallel. This is a step toward treating agent capabilities like code libraries rather than one-off prompt experiments.

The tutorial’s later chapters show real examples: a document analysis Skill that reads PDFs and produces structured summaries, a code generation Skill with built-in linting and test generation, and a research Skill that crawls sources and cross-references claims.

How context engineering changes agent reliability

Let me make this concrete. Last month I built an agent that reads GitHub issues, searches a codebase, and proposes fixes. Simple in concept. In practice, every tool call pulled in more context — the issue body, then search results, then file contents, then diffs. By the fourth tool call, the agent was drowning in stale context and started hallucinating function names that didn’t exist.

The virtual file system approach would have fixed this. Instead of accumulating context, each tool call would write results to a file, and the agent would read only the slice it needed for the next step. The context window would stay trim — maybe 8K tokens instead of 80K.

This isn’t just about cost (though that matters — stuffing 80K tokens into GPT-4 costs real money). It’s about accuracy. LLMs degrade when context gets bloated. Research from Stanford and others shows that retrieval accuracy drops as context length grows, even with models that technically support 200K+ tokens. The middle of a long context gets “lost” — the model pays less attention to it.

Deep Agents’ VFS is a practical solution to this well-known problem. By treating agent memory like a filesystem — with explicit read/write boundaries, chunking, and garbage collection — it forces good context hygiene. You don’t have to remember to trim. The framework won’t let you bloat.

I want to be clear: this isn’t a Deep Agents invention. Anthropic’s Claude Code uses a similar pattern with its “memory files.” Cognition’s Devin writes intermediate state to disk. The pattern is emerging independently because it works. Deep Agents just packages it cleanly.

Why sub-agent delegation matters more than you think

Most agent demos are single-threaded. One agent, one task, one output. That’s fine for “summarize this PDF” but useless for anything real.

Production work is parallel by nature. When you’re fixing a bug, you don’t read the entire codebase sequentially — you jump between files, check tests, look at git blame, and maybe search Slack for context. A single-threaded agent can’t do this efficiently.

Deep Agents’ parallel delegation model lets you fork. In the tutorial’s workflow example, a “code reviewer” agent spawns three sub-agents simultaneously: one checks style, one checks correctness, one checks security. They run in parallel, write results to their VFS spaces, and the parent merges. Total wall time: the slowest sub-agent, not the sum of all three.

This pattern compounds. An agent that searches documentation, code, and issue trackers in parallel will finish in a third the time of a sequential agent. For teams building agent pipelines that need to process many items — PRs, support tickets, data validation jobs — this is the difference between “nice demo” and “actually ships.”

The tutorial’s later chapters get into more advanced patterns: fan-out/fan-in for bulk processing, priority queues for task scheduling, and graceful degradation when a sub-agent times out. These aren’t abstract patterns — they’re lifted from distributed systems engineering and applied to LLM-based agents. The mapping is surprisingly clean.

Who should use this (and who should not)

Use Deep Agents Harness if:

  • You’re building agents that need to run for more than a few minutes
  • Your agents spawn sub-tasks that need parallel execution
  • Context window management is a recurring headache
  • You want a structured way to reuse agent capabilities

Skip it if:

  • You’re building simple single-turn agents (just use the OpenAI API directly)
  • Your team has no LangChain experience (the learning curve is real)
  • You need something battle-tested in production today (the framework is new)

What’s still missing

The framework is young. I spotted a few gaps:

Observability is thin. You get basic logging but no structured tracing. If a sub-agent silently fails, you might not know until the final output looks wrong.

No built-in evaluation. There’s no way to run an agent on a test suite and check correctness. You’ll need to build your own eval harness.

Python-only for now. The tutorial is Python, the framework is Python. TypeScript support is mentioned but not shipped.

Persistence is file-based. The VFS uses actual files for state. Works for single-machine agents but gets complicated if you’re distributing across nodes. A Redis or S3 backend would be a natural next step.

Error recovery is basic. If a sub-agent crashes, the harness retries with the same context. There’s no automatic root-cause analysis, no “try a different approach” logic. In production, you’d want the parent agent to dynamically adjust strategy based on failure patterns — something the framework doesn’t do yet.

That said, none of these are dealbreakers for early-stage projects. The patterns it teaches — context engineering, task planning, parallel delegation, Skills reuse — are useful even if you end up implementing them differently. And the framework is open source, so these gaps will close as the community contributes.

The bottom line

Most agent frameworks are infrastructure projects disguised as AI products. Deep Agents Harness is the opposite: it assumes you have infrastructure (LangGraph for state, LangChain for tools) and focuses on the patterns that make agents reliable.

The virtual file system alone is worth understanding, even if you never touch the framework. It’s the clearest break I’ve seen from the “cram everything into context” approach that dooms most production agents.

I’m not convinced the framework is production-ready today — it needs better observability and evaluation tooling before I’d trust it with a revenue-critical workload. But the architecture is sound, and the tutorial is one of the best agent-building resources I’ve come across. If you’re building agents that need to actually work, start here. The pattern of separating runtime, framework, and harness concerns is the right call, and I expect we’ll see this three-layer model become the default for serious agent projects over the next year.

Sources

Disclosure: CarCare Guide is reader-supported. When you buy through links on our site, we may earn an affiliate commission at no extra cost to you. Learn more.
A
Alex Chen