Configuration parameters for creating a Deep Agent Matches Python's create_deep_agent parameters
interface CreateDeepAgentParamsBackend instance or factory (default: StateBackend)
Optional checkpointer for persisting agent state between runs
Optional schema for context (not persisted between invocations)
Optional list of memory file paths (AGENTS.md files) to load (e.g., ["~/.deepagents/AGENTS.md", "./.deepagents/AGENTS.md"]). Display names are automatically derived from paths. Memory is loaded at agent startup and added into the system prompt.
Additional middleware to append after default_middleware
The model for the agent. Defaults to defaultModel
Error name for instanceof checks and logging
Filesystem permission rules enforced on every tool call.
Rules are evaluated in declaration order; first match wins; permissive
default. Applies to ls, read_file, write_file, edit_file,
glob, and grep.
Note on execute: permissions are not enforced on execute because
shell commands can access any path regardless of path-based rules. Using
permissions with an execution-capable backend (one where isSandboxBackend
returns true) throws a ConfigurationError unless either:
execute is disabled via tools, orCompositeBackend and every permission path is scoped to
a route prefix.When omitted or empty, all filesystem operations are permitted.
Structured output response format for the subagent.
When specified, the subagent will produce a structuredResponse conforming to the
given schema. The structured response is JSON-serialized and returned as the
ToolMessage content to the parent agent, replacing the default last-message extraction.
Accepts any format supported by createAgent: Zod schemas, JSON schema objects,
toolStrategy(schema), providerStrategy(schema), etc.
import { z } from "zod"
const analyzer: SubAgent = {
name: "analyzer",
description: "Analyzes data and returns structured findings",
systemPrompt: "Analyze the data and return your findings.",
responseFormat: z.object({
findings: z.string(),
confidence: z.number(),
}),
};Skill source paths for SkillsMiddleware.
List of paths to skill directories (e.g., ["/skills/user/", "/skills/project/"]).
When specified, the subagent will have its own SkillsMiddleware that loads skills
from these paths. This allows subagents to have different skill sets than the main agent.
Note: Custom subagents do NOT inherit skills from the main agent by default. Only the general-purpose subagent inherits the main agent's skills.
const researcher: SubAgent = {
name: "researcher",
description: "Research assistant",
systemPrompt: "You are a researcher.",
skills: ["/skills/research/", "/skills/web-search/"],
};Optional schema for custom agent state. Allows you to define custom state properties
beyond built-in messages, todos, and files. These properties can be accessed
in hooks, middleware, and throughout the agent's execution.
Unlike contextSchema the state is persisted between agent invocations when using a
checkpointer, making it suitable for maintaining conversation history, user preferences,
or any other data that should persist across multiple interactions.
import { StateSchema } from "@langchain/langgraph";
import { z } from "zod";
const agent = createDeepAgent({
stateSchema: new StateSchema({
author: z.string().default("unknown"),
}),
});
const result = await agent.invoke({
messages: [{ role: "user", content: "Take a note" }],
author: "Me",
});
// result.author is typed `string`Optional BaseStore for persistent cross-conversation storage
Optional StreamTransformer factories to register with the underlying agent.
These are forwarded as-is to createAgent and their projections are
exposed under run.extensions when using streamEvents(..., { version: "v3" }).
This is separate from the built-in streams createAgent provides on its
own ā such as run.subagents (nested named agents) and run.toolCalls
(tool calls), which land directly on the run, not under run.extensions.
A list of additional subagents to provide to the agent
System prompt override. Set to null to disable. Defaults to ASYNC_TASK_SYSTEM_PROMPT.
Allowlist of built-in filesystem tools to expose to the model.
undefined, null, and "all" preserve the default behavior: every
filesystem tool is registered, subject to backend capability filtering.read_file must be included in every explicit array because it is used
by normal file-inspection flows and by large-result recovery guidance.execute is removed when the resolved backend does not support
command execution, even if it appears in this allowlist.The generated filesystem system prompt is based on the tools that remain visible after this allowlist and backend capability filtering are applied.
createFilesystemMiddleware({
tools: ["read_file", "ls", "glob", "grep"],
});