Skip to content
Draft
Show file tree
Hide file tree
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
20 changes: 11 additions & 9 deletions libs/deepagents/src/agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import {
humanInTheLoopMiddleware,
anthropicPromptCachingMiddleware,
todoListMiddleware,
summarizationMiddleware,
SystemMessage,
type AgentMiddleware,
type ResponseFormat,
Expand All @@ -24,6 +23,7 @@ import {
createSkillsMiddleware,
type SubAgent,
} from "./middleware/index.js";
import { createSummarizationMiddleware } from "./middleware/summarization.js";
import { StateBackend } from "./backends/index.js";
import { InteropZodObject } from "@langchain/core/utils/types";
import { CompiledSubAgent } from "./middleware/subagents.js";
Expand Down Expand Up @@ -216,10 +216,11 @@ export function createDeepAgent<
createFilesystemMiddleware({
backend: filesystemBackend,
}),
summarizationMiddleware({
model,
trigger: { tokens: 170_000 },
keep: { messages: 6 },
createSummarizationMiddleware({
model: model as string,
backend: filesystemBackend,
trigger: { type: "tokens", value: 130_000 },
keep: { type: "messages", value: 6 },
}),
anthropicPromptCachingMiddleware({
unsupportedModelBehavior: "ignore",
Expand Down Expand Up @@ -265,10 +266,11 @@ export function createDeepAgent<
/**
* Automatically summarizes conversation history when token limits are approached
*/
summarizationMiddleware({
model,
trigger: { tokens: 170_000 },
keep: { messages: 6 },
createSummarizationMiddleware({
model: model as string,
backend: filesystemBackend,
trigger: { type: "tokens", value: 130_000 },
keep: { type: "messages", value: 6 },
}),
/**
* Enables Anthropic prompt caching for improved performance and reduced costs
Expand Down
Loading
Loading