Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 3 additions & 31 deletions src/oss/deepagents/subagents.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down