diff --git a/src/oss/deepagents/subagents.mdx b/src/oss/deepagents/subagents.mdx index ea8ce4c7f8..71c0ff420a 100644 --- a/src/oss/deepagents/subagents.mdx +++ b/src/oss/deepagents/subagents.mdx @@ -54,6 +54,7 @@ For most use cases, define subagents as dictionaries: - **middleware** (`List[Middleware]`): Additional middleware for custom behavior, logging, or rate limiting. - **interrupt_on** (`Dict[str, bool]`): Configure human-in-the-loop for specific tools. Requires a checkpointer. +:::python ### CompiledSubAgent For complex workflows, use a pre-built LangGraph graph: @@ -62,6 +63,7 @@ For complex workflows, use a pre-built LangGraph graph: - **name** (`str`): Unique identifier - **description** (`str`): What this subagent does - **runnable** (`Runnable`): A compiled LangGraph graph (must call `.compile()` first) +::: ## Using SubAgent @@ -163,11 +165,11 @@ const agent = createDeepAgent({ ``` ::: +:::python ## Using CompiledSubAgent For more complex use cases, you can provide your own pre-built LangGraph graph as a subagent: -:::python ```python from deepagents import create_deep_agent, CompiledSubAgent from langchain.agents import create_agent @@ -197,36 +199,6 @@ agent = create_deep_agent( ``` ::: -:::js -```typescript -import { createDeepAgent, CompiledSubAgent } from "deepagents"; -import { createAgent } from "langchain"; - -// Create a custom agent graph -const customGraph = createAgent({ - model: yourModel, - tools: specializedTools, - prompt: "You are a specialized agent for data analysis...", -}); - -// Use it as a custom subagent -const customSubagent: CompiledSubAgent = { - name: "data-analyzer", - description: "Specialized agent for complex data analysis tasks", - runnable: customGraph, -}; - -const subagents = [customSubagent]; - -const agent = createDeepAgent({ - model: "claude-sonnet-4-5-20250929", - tools: [internetSearch], - systemPrompt: researchInstructions, - subagents: subagents, -}); -``` -::: - ## The general-purpose subagent In addition to any user-defined subagents, deep agents have access to a `general-purpose` subagent at all times. This subagent: