LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
  • Overview
  • Agent
  • Middleware
  • Backends
  • Sandboxes
  • Skills
  • Subagents
  • 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

OverviewAgentMiddlewareBackendsSandboxesSkillsSubagentsTypes
Modal
Daytona
Deno
Node VFS
Sandbox Standard Tests
Vitest
Language
Theme
JavaScriptdeepagentsnodeForkedSubAgent
Interface●Since v1.13Deprecated

ForkedSubAgent

Copy
interface ForkedSubAgent

Bases

SubAgent

Properties

Inherited fromSubAgent

Properties

Pdescription: string
—

Description shown to the model for subagent selection

PinterruptOn: Record<string, boolean | __type>
—

Human-in-the-loop configuration for specific tools. Requires a checkpointer.

Pmiddleware: readonly AgentMiddleware<any, any, any, readonly ClientTool | ServerTool[], readonly ()
—

Additional middleware to append after default_middleware

View source on GitHub
P
mode
: "isolated" | "fork"
—

Context mode. "isolated" (default) only sees the delegated task.

Pmodel: string | LanguageModelLike
—

The model for the agent. Defaults to defaultModel

Pname: string
—

Identifier used to select this subagent in the task tool

Ppermissions: FilesystemPermission[]
—

Filesystem permission rules for this subagent.

PresponseFormat: ResponseFormatInput<Record<string, any>>
—

Structured output response format for the subagent.

Pskills: readonly string[]
—

Skill source paths for SkillsMiddleware.

PsystemPrompt: string | SystemMessage<MessageStructure<MessageToolSet>>
—

The system prompt for the agent. Falls back to an empty prompt if

Ptools: StructuredTool<ToolInputSchemaBase, any, any, any, unknown>[]
—

The tools to use for the agent (tool instances, not names). Defaults to defaultTools

property
description: string
property
interruptOn: Record<string, boolean | __type>
property
middleware: readonly AgentMiddleware<any, any, any, readonly ClientTool | ServerTool[], readonly () => StreamTransformer<any>[]>[]
property
mode: "fork"
property
model: string | LanguageModelLike
property
name: string
property
permissions: FilesystemPermission[]
property
responseFormat: ResponseFormatInput<Record<string, any>>
property
skills: readonly string[]
property
systemPrompt: string | SystemMessage<MessageStructure<MessageToolSet>>
property
tools: StructuredTool<ToolInputSchemaBase, any, any, any, unknown>[]

A SubAgent with mode: "fork".

Description shown to the model for subagent selection

Human-in-the-loop configuration for specific tools. Requires a checkpointer.

Additional middleware to append after default_middleware

Context mode. "isolated" (default) only sees the delegated task. "fork" inherits the parent's conversation history and mirrors the parent's prompt-producing middleware (skills, memory, custom middleware) so it rebuilds an equivalent system prompt — the tradeoff is cache misses if this subagent's own model differs from the parent's. Cannot declare skills under mode: "fork"; the parent's skills are inherited instead.

The model for the agent. Defaults to defaultModel

Identifier used to select this subagent in the task tool

Filesystem permission rules for this subagent.

When specified, these rules replace the parent agent's permissions for all tool calls made by this subagent. When omitted, the subagent inherits the parent agent's permissions.

Subagent permissions are a full replacement, not a merge.

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.

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.

Not needed when you pass a createSkillsMiddleware in middleware, for example to give the subagent skill tools: that middleware takes the same slot on its own.

The system prompt for the agent. Falls back to an empty prompt if omitted. Under mode: "fork", this is appended to the parent's inherited prompt rather than replacing it.

The tools to use for the agent (tool instances, not names). Defaults to defaultTools

Copy
// Parent denies /restricted/**; this subagent can read it.
const reader: SubAgent = {
  name: "reader",
  permissions: [
    { operations: ["read"], paths: ["/restricted/**"] },
  ],
};
Copy
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(),
  }),
};
Copy
const researcher: SubAgent = {
  name: "researcher",
  description: "Research assistant",
  systemPrompt: "You are a researcher.",
  skills: ["/skills/research/", "/skills/web-search/"],
};