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
JavaScriptdeepagentstypesInferSubagentByName
Type●Since v1.4

InferSubagentByName

Helper type to extract a subagent by name from a DeepAgent.

Copy
InferSubagentByName: InferDeepAgentSubagents<T> extends readonly SA[]  SA extends __type  SA : never : never
View source on GitHub

Example

Copy
const agent = createDeepAgent({
  subagents: [
    { name: "researcher", description: "...", middleware: [ResearchMiddleware] }
  ] as const,
});

type ResearcherAgent = InferSubagentByName<typeof agent, "researcher">;