Skip to content

Commit cca47b4

Browse files
authored
Merge pull request #53 from langchain-ai/hunter/fix-recursion-limit
fix: thread config options to subagents
2 parents 80e0c96 + dbdef4c commit cca47b4

File tree

5 files changed

+17
-14
lines changed

5 files changed

+17
-14
lines changed

.changeset/itchy-needles-admire.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"deepagents": patch
3+
---
4+
5+
thread config options to subagents

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
"@langchain/core": "^1.0.0",
4545
"@langchain/langgraph": "^1.0.0",
4646
"fast-glob": "^3.3.3",
47-
"langchain": "^1.0.0",
47+
"langchain": "^1.0.4",
4848
"micromatch": "^4.0.8",
4949
"zod": "^4.1.11"
5050
},

pnpm-lock.yaml

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/agent.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
type InterruptOnConfig,
1010
} from "langchain";
1111
import type { StructuredTool } from "@langchain/core/tools";
12-
import type { LanguageModelLike } from "@langchain/core/language_models/base";
12+
import type { BaseLanguageModel } from "@langchain/core/language_models/base";
1313
import type {
1414
BaseCheckpointSaver,
1515
BaseStore,
@@ -35,7 +35,7 @@ export interface CreateDeepAgentParams<
3535
| InteropZodObject = AnnotationRoot<any>,
3636
> {
3737
/** The model to use (model name string or LanguageModelLike instance). Defaults to claude-sonnet-4-5-20250929 */
38-
model?: LanguageModelLike | string;
38+
model?: BaseLanguageModel | string;
3939
/** Tools the agent should have access to */
4040
tools?: StructuredTool[];
4141
/** Custom system prompt for the agent. This will be combined with the base agent prompt */
@@ -135,8 +135,7 @@ export function createDeepAgent<
135135
}),
136136
// Subagent middleware: Automatic conversation summarization when token limits are approached
137137
summarizationMiddleware({
138-
// TODO: make sure that the summarization middleware accepts a string model name
139-
model: model as any,
138+
model,
140139
maxTokensBeforeSummary: 170000,
141140
messagesToKeep: 6,
142141
}),
@@ -153,8 +152,7 @@ export function createDeepAgent<
153152
}),
154153
// Automatically summarizes conversation history when token limits are approached
155154
summarizationMiddleware({
156-
// TODO: make sure that the summarization middleware accepts a string model name
157-
model: model as any,
155+
model,
158156
maxTokensBeforeSummary: 170000,
159157
messagesToKeep: 6,
160158
}),

src/middleware/subagents.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ function createTaskTool(options: {
364364
subagentState.messages = [new HumanMessage({ content: description })];
365365

366366
// Invoke the subagent
367-
const result = (await subagent.invoke(subagentState)) as Record<
367+
const result = (await subagent.invoke(subagentState, config)) as Record<
368368
string,
369369
unknown
370370
>;

0 commit comments

Comments
 (0)