LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
  • Overview
  • Agent
  • Middleware
  • Backends
  • Sandboxes
  • Skills
  • Subagents
  • Configuration
  • Types
Modal
Daytona
Deno
Node VFS
Sandbox Standard Tests
  • Vitest
⌘I

LangChain Assistant

Ask a question to get started

Enter to send•Shift+Enter new line

Menu

OverviewAgentMiddlewareBackendsSandboxesSkillsSubagentsConfigurationTypes
Modal
Daytona
Deno
Node VFS
Sandbox Standard Tests
Vitest
Language
Theme
JavaScriptdeepagentsAgent

Agent

The createDeepAgent function is the main entry point for creating deep agents. It returns a DeepAgent instance with built-in planning, file system access, and subagent capabilities.

Learn more: For tutorials and guides on building deep agents, see the Deep Agents documentation.

Basic Usage

import { createDeepAgent } from "deepagents";

// Create an agent with default settings
const agent = createDeepAgent();

// Run the agent
const result = await agent.invoke({
  messages: [{ role: "user", content: "Research quantum computing" }],
});

With Custom Tools and Subagents

import { createDeepAgent } from "deepagents";

const agent = createDeepAgent({
  model: new ChatAnthropic({ model: "claude-sonnet-4-20250514" }),
  tools: [mySearchTool],
  subagents: [researchSubagent],
  systemPrompt: "You are an expert researcher.",
});

API Reference

Functions

Function

createDeepAgent

Create a Deep Agent with middleware-based architecture.

Interfaces

Interface

CreateDeepAgentParams

Configuration parameters for creating a Deep Agent

Interface

SubAgent

Specification for a subagent that can be dynamically created.

Interface

CompiledSubAgent

Type definitions for pre-compiled agents.

Types

Type

DeepAgent

DeepAgent extends ReactAgent with additional subagent type information.

Type

MergedDeepAgentState

Combined state type including custom middleware and subagent middleware states