Deep Agents (JS)
The batteries-included TypeScript harness for building controllable, production-ready LangGraph agents.
Repository Health
Technical Analysis
deepagents is the TypeScript port of LangChain’s Deep Agents library, an opinionated agent harness that ships with planning, a virtual filesystem, sub-agent delegation, and smart middleware defaults out of the box. Instead of wiring prompts, tools, and context management from scratch, createDeepAgent() returns a working LangGraph agent immediately, and every piece — the model, tools, system prompt, backends, and middleware — is swappable when you outgrow the defaults.
Under the hood it is a thin, well-typed layer on top of LangChain’s createAgent: middleware modules add write_todos planning, filesystem tools (read_file, write_file, edit_file, ls, glob, grep), a task tool for spawning isolated sub-agents, and optional skills, memory, summarization, and human-in-the-loop interrupts. Because the returned object is a compiled LangGraph graph, it inherits LangGraph’s streaming, checkpointing, and Studio support. Pluggable backends (in-memory state, local filesystem, LangGraph store, sandboxes, LangSmith, local shell) decide where the agent’s files and tool execution actually live, which is what lets the same agent code run safely in a browser, a Node server, or a sandboxed execution environment.
What You Get
- A ready-to-run
createDeepAgent()entrypoint with planning, filesystem, and sub-agent middleware pre-wired - Composable middleware modules (filesystem, sub-agents, summarization, memory, skills, human-in-the-loop) you can mix into a custom LangGraph agent
- Multiple backend implementations (state, filesystem, store, sandbox, LangSmith, local shell) for where agent files and tool execution actually live
- Environment-specific entrypoints (
deepagents,deepagents/browser,deepagents/node) so browser bundles avoid Node-only code - TypeScript-first APIs with full type inference across sub-agents, response formats, and middleware state
Common Use Cases
- Building a research agent that plans, searches, and writes a report to a virtual filesystem
- Adding human-in-the-loop approval gates before an agent runs risky tools
- Running agents inside a sandboxed backend (LangSmith or local shell) for code-execution safety
- Composing custom middleware stacks on top of LangChain’s
createAgentinstead of using the defaults - Delegating long-running subtasks to isolated sub-agents with their own context windows
Under The Hood
Architecture
deepagents is organized as a monorepo package (libs/deepagents) that layers a small orchestration entrypoint (agent.ts, createDeepAgent) over composable middleware modules (middleware/filesystem, middleware/subagents, middleware/summarization, middleware/memory, middleware/skills, middleware/agent-memory) and a pluggable backend abstraction (backends/state.ts, backends/filesystem.ts, backends/store.ts, backends/sandbox.ts, backends/context-hub.ts, backends/langsmith.ts, backends/local-shell.ts). createDeepAgent resolves a harness profile, merges middleware stacks, normalizes the system prompt, and delegates to LangChain’s createAgent/LangGraph compile step, so the abstraction that would break hardest under change is the middleware-merge contract in middleware/utils.ts, since every feature (filesystem, sub-agents, memory, HITL) is expressed as middleware layered onto that same graph.
Tech Stack
The package is written in TypeScript on top of the LangChain/LangGraph JS ecosystem (langchain, @langchain/core, @langchain/langgraph, @langchain/langgraph-checkpoint, @langchain/langgraph-sdk as peer dependencies so the host app controls their versions), with zod for schema validation, fast-glob/micromatch for filesystem tool globbing, and yaml for skill metadata parsing. It builds with tsdown into dual ESM/CJS output plus dedicated browser and Node entrypoints, tests with vitest, lints/formats with oxlint/oxfmt, and lives inside a pnpm workspace monorepo alongside sibling packages for sandboxes (Daytona, Modal, Deno, QuickJS) and an ACP server integration.
Code Quality
Test coverage is extensive and colocated with source — nearly every module under src/ has a matching .test.ts, with additional .int.test.ts integration suites for backends, filesystem middleware, and sub-agent flows, run via vitest run/vitest run --mode int. CI enforces formatting, type-checking, and the test suite on every PR. Naming is consistent and modules are narrowly scoped; types are strict and extensively exported (dozens of named type exports from index.ts), and JSDoc-style comments document public entrypoints like createDeepAgent.
What Makes It Unique Rather than exposing raw LangGraph primitives, deepagents packages an opinionated “harness” of defaults — planning, filesystem-as-working-memory, and sub-agent delegation — as swappable middleware, and generalizes execution environment behind a backend protocol so the identical agent definition can run against an in-memory state, a real filesystem, a remote sandbox, or a LangSmith-hosted execution environment. The harness-profile system (model-specific prompt and middleware bundles for Anthropic, OpenAI, and others) and async sub-agent support for long-running delegated work are less common in comparable JS agent libraries, most of which stop at tool-calling helpers rather than a full opinionated runtime.