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
JavaScriptdeepagentsindexcreateSubAgent
Function●Since v1.10

createSubAgent

Copy
createSubAgent(spec: SubAgent, options: __type): ReactAgent
View source on GitHub

Parameters

NameTypeDescription
spec*SubAgent

Declarative subagent specification. Must specify model and tools.

options__type

Create a runnable agent from a declarative SubAgent spec.

This is the shared entrypoint for compiling a SubAgent into a ReactAgent. Pre-compiled CompiledSubAgent runnables bypass this function entirely.

The spec must have model and tools set — the caller is responsible for coalescing any defaults before calling this function.