deep-agents

v2026.09.24

Build hierarchical AI agents with the deepagents npm package. Use when creating orchestrators that plan multi-step tasks, delegate to child agents, or maintain persistent memory.

GitHub
Install command
npx skhub add laurigates/deep-agents
Markdown
SKILL.md

Deep Agents

When to Use This Skill

Use this skill when...Use langgraph-agents instead when...
Building hierarchical agents with planning and subagent delegationYou need a single stateful graph without sub-agents
Managing large context via file-system memory across runsShort-lived state fits in checkpointed graph memory
Long-running, multi-step workflows modelled on Deep ResearchSimple LCEL chains suffice (use langchain-development)
Scaffolding from scratch (use /langchain:init first)The project is already initialised and only needs graph wiring

Core Expertise

Deep Agents (deepagents) is a TypeScript library for building sophisticated AI agents:

  • Built on LangGraph with planning and decomposition
  • File system context management (prevents token overflow)
  • Subagent delegation for focused exploration
  • Persistent memory across conversations
  • Modeled after Claude Code and Deep Research patterns

The package name on npm is deepagents (one word, unscoped). The source lives at langchain-ai/deepagentsjs.

Installation

# Install Deep Agents
npm install deepagents

# Add a model provider (pick the one matching your model)
npm install @langchain/openai  # or @langchain/anthropic, @langchain/google-genai

deepagents declares langsmith as a peer dependency (for tracing) and builds on @langchain/langgraph + @langchain/core, which are pulled in transitively.

Basic Agent Setup

createDeepAgent() returns a compiled LangGraph graph. The model can be a provider-prefixed string (e.g. "openai:gpt-5") or a model instance.

import { createDeepAgent } from "deepagents";
import { ChatOpenAI } from "@langchain/openai";

const model = new ChatOpenAI({
  model: "gpt-5",
  temperature: 0,
});

const agent = createDeepAgent({
  model,
  systemPrompt: `You are a research assistant.
    Break complex questions into steps using write_todos.
    Use read_file and write_file to manage context.`,
});

const result = await agent.invoke({
  messages: [{ role: "user", content: "Research X and summarize" }],
});

For browser or Node-explicit builds, import the backend-scoped entrypoints:

import { createDeepAgent, StateBackend } from "deepagents/browser";
import { createDeepAgent, FilesystemBackend } from "deepagents/node";

Built-in Tools

Deep Agents ships these tools automatically: write_todos, ls, read_file, write_file, edit_file, glob, grep, and task.

Planning Tools

// write_todos - Task decomposition (available automatically)

// The agent uses it to plan:
// write_todos([
//   { task: "Search for X", status: "pending" },
//   { task: "Analyze results", status: "pending" },
//   { task: "Write summary", status: "pending" },
// ])

File System Tools

// Built-in tools for context management

// ls        - List directory contents
// read_file - Read file content
// write_file - Write/create files
// edit_file - Modify existing files
// glob      - Match files by pattern
// grep      - Search file contents

// The agent stores intermediate results in files
// to prevent context overflow.

Subagent Delegation

// task - Spawn a focused subagent with an isolated context window

// The parent agent delegates:
// task({
//   description: "Research pricing models",
//   subagent_type: "research-agent",
// })

// The subagent runs independently and returns results.

Agentic Optimizations

ContextPattern
Large docsWrite to file, read sections as needed
Multi-stepUse write_todos to track progress
Focused workDelegate via the task tool
Long sessionsEnable checkpointing
Learned patternsStore via LangGraph store
DebugEnable LANGCHAIN_TRACING_V2

Quick Reference

Agent Methods

MethodDescription
.invoke(input, config)Run to completion
.stream(input, config)Stream execution
.batch(inputs, config)Parallel execution

Built-in Tools

ToolPurpose
write_todosPlan and track tasks
lsList directory
read_fileRead file contents
write_fileCreate/overwrite file
edit_fileModify file section
globMatch files by pattern
grepSearch file contents
taskDelegate to a subagent

Config Keys

KeyDescription
thread_idConversation ID
checkpoint_idResume point
recursion_limitMax iterations

Environment Variables

VariableDescription
LANGCHAIN_TRACING_V2Enable LangSmith
LANGCHAIN_API_KEYLangSmith key
LANGCHAIN_PROJECTProject name

For custom tools, persistence, full configuration options, multi-agent subagent patterns, context-management strategy, streaming, and the Claude Code comparison, see REFERENCE.md.

Discovery
Tags

No tags published for this skill.

Version
Latest version metadata

Version

v2026.09.24

Published

Sep 24, 2026

Category

Uncategorized

License

MIT

Source path

langchain-plugin/skills/deep-agents

Default branch

main

Latest commit

1668324

Tree SHA

b2d4cc3