deepagents 1.10.5 → 1.10.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -44,6 +44,15 @@ pnpm add deepagents
44
44
  yarn add deepagents
45
45
  ```
46
46
 
47
+ > [!IMPORTANT]
48
+ > `deepagents` declares the LangChain runtime packages as **peer dependencies** so
49
+ > your app controls their versions and everything resolves to a single shared copy.
50
+ > npm 7+ and pnpm 8+ install these automatically; **Yarn users must add them explicitly**:
51
+ >
52
+ > ```bash
53
+ > yarn add @langchain/core @langchain/langgraph @langchain/langgraph-checkpoint @langchain/langgraph-sdk langchain langsmith
54
+ > ```
55
+
47
56
  ```typescript
48
57
  import { createDeepAgent } from "deepagents";
49
58
 
package/dist/browser.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_langsmith = require("./langsmith-ZfNZ_Pyb.cjs");
2
+ const require_langsmith = require("./langsmith-Cpzy6cFq.cjs");
3
3
  exports.BaseSandbox = require_langsmith.BaseSandbox;
4
4
  exports.CompositeBackend = require_langsmith.CompositeBackend;
5
5
  exports.ConfigurationError = require_langsmith.ConfigurationError;
package/dist/browser.js CHANGED
@@ -1,2 +1,2 @@
1
- import { A as GENERAL_PURPOSE_SUBAGENT, B as isSandboxProtocol, C as MAX_SKILL_NAME_LENGTH, D as createPatchToolCallsMiddleware, E as filesValue, F as createFilesystemMiddleware, H as adaptBackendProtocol, I as CompositeBackend, L as StateBackend, M as TASK_SYSTEM_PROMPT, O as DEFAULT_GENERAL_PURPOSE_DESCRIPTION, P as createSubAgentMiddleware, R as SandboxError, S as MAX_SKILL_FILE_SIZE, T as createMemoryMiddleware, U as adaptSandboxProtocol, V as resolveBackend, _ as isAsyncSubAgent, a as createDeepAgent, b as createCompletionCallbackMiddleware, c as generalPurposeSubagentConfigSchema, d as serializeProfile, f as EMPTY_HARNESS_PROFILE, g as createAsyncSubAgentMiddleware, h as ConfigurationError, i as StoreBackend, k as DEFAULT_SUBAGENT_PROMPT, l as harnessProfileConfigSchema, m as REQUIRED_MIDDLEWARE_NAMES, n as BaseSandbox, o as getHarnessProfile, p as createHarnessProfile, r as ContextHubBackend, s as registerHarnessProfile, t as LangSmithSandbox, u as parseHarnessProfileConfig, v as computeSummarizationDefaults, w as createSkillsMiddleware, x as MAX_SKILL_DESCRIPTION_LENGTH, y as createSummarizationMiddleware, z as isSandboxBackend } from "./langsmith-wdF8zG42.js";
1
+ import { A as GENERAL_PURPOSE_SUBAGENT, B as isSandboxProtocol, C as MAX_SKILL_NAME_LENGTH, D as createPatchToolCallsMiddleware, E as filesValue, F as createFilesystemMiddleware, H as adaptBackendProtocol, I as CompositeBackend, L as StateBackend, M as TASK_SYSTEM_PROMPT, O as DEFAULT_GENERAL_PURPOSE_DESCRIPTION, P as createSubAgentMiddleware, R as SandboxError, S as MAX_SKILL_FILE_SIZE, T as createMemoryMiddleware, U as adaptSandboxProtocol, V as resolveBackend, _ as isAsyncSubAgent, a as createDeepAgent, b as createCompletionCallbackMiddleware, c as generalPurposeSubagentConfigSchema, d as serializeProfile, f as EMPTY_HARNESS_PROFILE, g as createAsyncSubAgentMiddleware, h as ConfigurationError, i as StoreBackend, k as DEFAULT_SUBAGENT_PROMPT, l as harnessProfileConfigSchema, m as REQUIRED_MIDDLEWARE_NAMES, n as BaseSandbox, o as getHarnessProfile, p as createHarnessProfile, r as ContextHubBackend, s as registerHarnessProfile, t as LangSmithSandbox, u as parseHarnessProfileConfig, v as computeSummarizationDefaults, w as createSkillsMiddleware, x as MAX_SKILL_DESCRIPTION_LENGTH, y as createSummarizationMiddleware, z as isSandboxBackend } from "./langsmith-CbVMIRaK.js";
2
2
  export { BaseSandbox, CompositeBackend, ConfigurationError, ContextHubBackend, DEFAULT_GENERAL_PURPOSE_DESCRIPTION, DEFAULT_SUBAGENT_PROMPT, EMPTY_HARNESS_PROFILE, GENERAL_PURPOSE_SUBAGENT, LangSmithSandbox, MAX_SKILL_DESCRIPTION_LENGTH, MAX_SKILL_FILE_SIZE, MAX_SKILL_NAME_LENGTH, REQUIRED_MIDDLEWARE_NAMES, SandboxError, StateBackend, StoreBackend, TASK_SYSTEM_PROMPT, adaptBackendProtocol, adaptSandboxProtocol, computeSummarizationDefaults, createAsyncSubAgentMiddleware, createCompletionCallbackMiddleware, createDeepAgent, createFilesystemMiddleware, createHarnessProfile, createMemoryMiddleware, createPatchToolCallsMiddleware, createSkillsMiddleware, createSubAgentMiddleware, createSummarizationMiddleware, filesValue, generalPurposeSubagentConfigSchema, getHarnessProfile, harnessProfileConfigSchema, isAsyncSubAgent, isSandboxBackend, isSandboxProtocol, parseHarnessProfileConfig, registerHarnessProfile, resolveBackend, serializeProfile };
package/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_langsmith = require("./langsmith-ZfNZ_Pyb.cjs");
3
- const require_src = require("./src-plSII1Kf.cjs");
2
+ const require_langsmith = require("./langsmith-Cpzy6cFq.cjs");
3
+ const require_src = require("./src-Cu2or9PN.cjs");
4
4
  exports.BaseSandbox = require_langsmith.BaseSandbox;
5
5
  exports.CompositeBackend = require_langsmith.CompositeBackend;
6
6
  exports.ConfigurationError = require_langsmith.ConfigurationError;
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
- import { A as GENERAL_PURPOSE_SUBAGENT, B as isSandboxProtocol, C as MAX_SKILL_NAME_LENGTH, D as createPatchToolCallsMiddleware, E as filesValue, F as createFilesystemMiddleware, H as adaptBackendProtocol, I as CompositeBackend, L as StateBackend, M as TASK_SYSTEM_PROMPT, N as createSubAgent, O as DEFAULT_GENERAL_PURPOSE_DESCRIPTION, P as createSubAgentMiddleware, R as SandboxError, S as MAX_SKILL_FILE_SIZE, T as createMemoryMiddleware, U as adaptSandboxProtocol, V as resolveBackend, _ as isAsyncSubAgent, a as createDeepAgent, b as createCompletionCallbackMiddleware, c as generalPurposeSubagentConfigSchema, d as serializeProfile, f as EMPTY_HARNESS_PROFILE, g as createAsyncSubAgentMiddleware, h as ConfigurationError, i as StoreBackend, j as SUBAGENT_RESPONSE_FORMAT_CONFIG_KEY, k as DEFAULT_SUBAGENT_PROMPT, l as harnessProfileConfigSchema, m as REQUIRED_MIDDLEWARE_NAMES, n as BaseSandbox, o as getHarnessProfile, p as createHarnessProfile, r as ContextHubBackend, s as registerHarnessProfile, t as LangSmithSandbox, u as parseHarnessProfileConfig, v as computeSummarizationDefaults, w as createSkillsMiddleware, x as MAX_SKILL_DESCRIPTION_LENGTH, y as createSummarizationMiddleware, z as isSandboxBackend } from "./langsmith-wdF8zG42.js";
2
- import { a as createAgentMemoryMiddleware, i as parseSkillMetadata, n as FilesystemBackend, o as createSettings, r as listSkills, s as findProjectRoot, t as LocalShellBackend } from "./src-DybKvM4T.js";
1
+ import { A as GENERAL_PURPOSE_SUBAGENT, B as isSandboxProtocol, C as MAX_SKILL_NAME_LENGTH, D as createPatchToolCallsMiddleware, E as filesValue, F as createFilesystemMiddleware, H as adaptBackendProtocol, I as CompositeBackend, L as StateBackend, M as TASK_SYSTEM_PROMPT, N as createSubAgent, O as DEFAULT_GENERAL_PURPOSE_DESCRIPTION, P as createSubAgentMiddleware, R as SandboxError, S as MAX_SKILL_FILE_SIZE, T as createMemoryMiddleware, U as adaptSandboxProtocol, V as resolveBackend, _ as isAsyncSubAgent, a as createDeepAgent, b as createCompletionCallbackMiddleware, c as generalPurposeSubagentConfigSchema, d as serializeProfile, f as EMPTY_HARNESS_PROFILE, g as createAsyncSubAgentMiddleware, h as ConfigurationError, i as StoreBackend, j as SUBAGENT_RESPONSE_FORMAT_CONFIG_KEY, k as DEFAULT_SUBAGENT_PROMPT, l as harnessProfileConfigSchema, m as REQUIRED_MIDDLEWARE_NAMES, n as BaseSandbox, o as getHarnessProfile, p as createHarnessProfile, r as ContextHubBackend, s as registerHarnessProfile, t as LangSmithSandbox, u as parseHarnessProfileConfig, v as computeSummarizationDefaults, w as createSkillsMiddleware, x as MAX_SKILL_DESCRIPTION_LENGTH, y as createSummarizationMiddleware, z as isSandboxBackend } from "./langsmith-CbVMIRaK.js";
2
+ import { a as createAgentMemoryMiddleware, i as parseSkillMetadata, n as FilesystemBackend, o as createSettings, r as listSkills, s as findProjectRoot, t as LocalShellBackend } from "./src-5s_gtczU.js";
3
3
  export { BaseSandbox, CompositeBackend, ConfigurationError, ContextHubBackend, DEFAULT_GENERAL_PURPOSE_DESCRIPTION, DEFAULT_SUBAGENT_PROMPT, EMPTY_HARNESS_PROFILE, FilesystemBackend, GENERAL_PURPOSE_SUBAGENT, LangSmithSandbox, LocalShellBackend, MAX_SKILL_DESCRIPTION_LENGTH, MAX_SKILL_FILE_SIZE, MAX_SKILL_NAME_LENGTH, REQUIRED_MIDDLEWARE_NAMES, SUBAGENT_RESPONSE_FORMAT_CONFIG_KEY, SandboxError, StateBackend, StoreBackend, TASK_SYSTEM_PROMPT, adaptBackendProtocol, adaptSandboxProtocol, computeSummarizationDefaults, createAgentMemoryMiddleware, createAsyncSubAgentMiddleware, createCompletionCallbackMiddleware, createDeepAgent, createFilesystemMiddleware, createHarnessProfile, createMemoryMiddleware, createPatchToolCallsMiddleware, createSettings, createSkillsMiddleware, createSubAgent, createSubAgentMiddleware, createSummarizationMiddleware, filesValue, findProjectRoot, generalPurposeSubagentConfigSchema, getHarnessProfile, harnessProfileConfigSchema, isAsyncSubAgent, isSandboxBackend, isSandboxProtocol, listSkills, parseHarnessProfileConfig, parseSkillMetadata, registerHarnessProfile, resolveBackend, serializeProfile };
@@ -1,4 +1,4 @@
1
- import { AIMessage, HumanMessage, SystemMessage, ToolMessage, anthropicPromptCachingMiddleware, context, countTokensApproximately, createAgent, createMiddleware, humanInTheLoopMiddleware, todoListMiddleware, tool } from "langchain";
1
+ import { AIMessage, HumanMessage, SystemMessage, ToolMessage, anthropicPromptCachingMiddleware, bedrockPromptCachingMiddleware, context, countTokensApproximately, createAgent, createMiddleware, humanInTheLoopMiddleware, todoListMiddleware, tool } from "langchain";
2
2
  import { Command, REMOVE_ALL_MESSAGES, ReducedValue, StateSchema, getConfig, getCurrentTaskInput, getStore, isCommand } from "@langchain/langgraph";
3
3
  import { z } from "zod/v4";
4
4
  import micromatch from "micromatch";
@@ -400,16 +400,19 @@ function grepMatchesFromFiles(files, pattern, path = null, glob = null) {
400
400
  /**
401
401
  * Determine MIME type from a file path's extension.
402
402
  *
403
- * Returns "application/octet-stream" for unknown extensions so that
404
- * binary files are not accidentally treated as text (grep, read_file,
405
- * etc. rely on {@link isTextMimeType} which would return true for
406
- * "text/plain").
403
+ * Defaults to "text/plain" for unknown extensions. Only the known non-text
404
+ * formats above (images, audio, video, PDF/PPT) are treated as binary by
405
+ * {@link isTextMimeType}; everything else reads as text, including source files
406
+ * with uncommon extensions (.properties, .scss, .tf) and extension-less files
407
+ * (Dockerfile, mvnw). This avoids base64-encoding text into document blocks,
408
+ * which the model can't read and which the Anthropic provider rejects with a
409
+ * 400.
407
410
  *
408
411
  * @param filePath - File path to inspect
409
- * @returns MIME type string (e.g., "image/png", "application/octet-stream")
412
+ * @returns MIME type string (e.g., "image/png", "text/plain")
410
413
  */
411
414
  function getMimeType(filePath) {
412
- return MIME_TYPES[extname(filePath).toLocaleLowerCase()] || "application/octet-stream";
415
+ return MIME_TYPES[extname(filePath).toLocaleLowerCase()] || "text/plain";
413
416
  }
414
417
  /**
415
418
  * Check whether a MIME type represents text content.
@@ -2312,11 +2315,16 @@ function returnCommandWithStateUpdate(result, toolCallId) {
2312
2315
  let content;
2313
2316
  if (result.structuredResponse != null) content = JSON.stringify(result.structuredResponse);
2314
2317
  else {
2315
- const messages = result.messages;
2316
- content = (messages?.[messages.length - 1])?.content || "Task completed";
2317
- if (Array.isArray(content)) {
2318
- content = content.filter((block) => !INVALID_TOOL_MESSAGE_BLOCK_TYPES.includes(block.type));
2319
- if (content.length === 0) content = "Task completed";
2318
+ const messages = result.messages ?? [];
2319
+ content = "Task completed";
2320
+ for (let i = messages.length - 1; i >= 0; i -= 1) {
2321
+ const message = messages[i];
2322
+ if (!message || !AIMessage$1.isInstance(message)) continue;
2323
+ const text = typeof message.content === "string" ? message.content.trim() : message.text?.trim() ?? "";
2324
+ if (text) {
2325
+ content = text;
2326
+ break;
2327
+ }
2320
2328
  }
2321
2329
  }
2322
2330
  return new Command({ update: {
@@ -2678,6 +2686,30 @@ function isAnthropicModel(model) {
2678
2686
  return model.getName() === "ChatAnthropic";
2679
2687
  }
2680
2688
  /**
2689
+ * Detect whether a model is an AWS Bedrock Converse model.
2690
+ *
2691
+ * Accepts the wider `RunnableInterface` shape (the type of `request.model`
2692
+ * inside `wrapModelCall`, aliased as `AgentLanguageModelLike` in langchain)
2693
+ * because the function only depends on `.getName()`, which is part of the
2694
+ * Runnable contract. `BaseLanguageModel` extends `Runnable`, so existing
2695
+ * call sites still type-check.
2696
+ */
2697
+ function isBedrockConverseModel(model) {
2698
+ if (typeof model === "string") {
2699
+ const colonIdx = model.indexOf(":");
2700
+ if (colonIdx !== -1) {
2701
+ const prefix = model.slice(0, colonIdx);
2702
+ if (prefix === "bedrock" || prefix === "aws") return true;
2703
+ }
2704
+ return model.startsWith("amazon.");
2705
+ }
2706
+ if (model.getName() === "ConfigurableModel") {
2707
+ const provider = model._defaultConfig?.modelProvider;
2708
+ return provider === "bedrock" || provider === "aws";
2709
+ }
2710
+ return model.getName() === "ChatBedrockConverse";
2711
+ }
2712
+ /**
2681
2713
  * Extract the provider name from a model instance for profile lookup.
2682
2714
  *
2683
2715
  * Checks `_defaultConfig.modelProvider` (ConfigurableModel) and falls
@@ -5751,10 +5783,17 @@ function createDeepAgent(params = {}) {
5751
5783
  const toolOverrides = harnessProfile.toolDescriptionOverrides;
5752
5784
  const effectiveTools = Object.keys(toolOverrides).length > 0 ? tools.map((t) => t.name in toolOverrides ? Object.assign(Object.create(Object.getPrototypeOf(t)), t, { description: toolOverrides[t.name] }) : t) : tools;
5753
5785
  const anthropicModel = isAnthropicModel(model);
5754
- const cacheMiddleware = anthropicModel ? [anthropicPromptCachingMiddleware({
5755
- unsupportedModelBehavior: "ignore",
5756
- minMessagesToCache: 1
5757
- }), createCacheBreakpointMiddleware()] : [];
5786
+ const bedrockModel = isBedrockConverseModel(model);
5787
+ let cacheMiddleware = [];
5788
+ if (anthropicModel) cacheMiddleware = [
5789
+ ...cacheMiddleware,
5790
+ anthropicPromptCachingMiddleware({
5791
+ unsupportedModelBehavior: "ignore",
5792
+ minMessagesToCache: 1
5793
+ }),
5794
+ createCacheBreakpointMiddleware()
5795
+ ];
5796
+ if (bedrockModel) cacheMiddleware = [...cacheMiddleware, bedrockPromptCachingMiddleware({ unsupportedModelBehavior: "ignore" })];
5758
5797
  /**
5759
5798
  * Process subagents to add SkillsMiddleware for those with their own skills.
5760
5799
  *
@@ -7318,4 +7357,4 @@ var LangSmithSandbox = class LangSmithSandbox extends BaseSandbox {
7318
7357
  //#endregion
7319
7358
  export { GENERAL_PURPOSE_SUBAGENT as A, isSandboxProtocol as B, MAX_SKILL_NAME_LENGTH as C, createPatchToolCallsMiddleware as D, filesValue as E, createFilesystemMiddleware as F, getMimeType as G, adaptBackendProtocol as H, CompositeBackend as I, isTextMimeType as K, StateBackend as L, TASK_SYSTEM_PROMPT as M, createSubAgent as N, DEFAULT_GENERAL_PURPOSE_DESCRIPTION as O, createSubAgentMiddleware as P, SandboxError as R, MAX_SKILL_FILE_SIZE as S, createMemoryMiddleware as T, adaptSandboxProtocol as U, resolveBackend as V, checkEmptyContent as W, isAsyncSubAgent as _, createDeepAgent as a, createCompletionCallbackMiddleware as b, generalPurposeSubagentConfigSchema as c, serializeProfile as d, EMPTY_HARNESS_PROFILE as f, createAsyncSubAgentMiddleware as g, ConfigurationError as h, StoreBackend as i, SUBAGENT_RESPONSE_FORMAT_CONFIG_KEY as j, DEFAULT_SUBAGENT_PROMPT as k, harnessProfileConfigSchema as l, REQUIRED_MIDDLEWARE_NAMES as m, BaseSandbox as n, getHarnessProfile as o, createHarnessProfile as p, performStringReplacement as q, ContextHubBackend as r, registerHarnessProfile as s, LangSmithSandbox as t, parseHarnessProfileConfig as u, computeSummarizationDefaults as v, createSkillsMiddleware as w, MAX_SKILL_DESCRIPTION_LENGTH as x, createSummarizationMiddleware as y, isSandboxBackend as z };
7320
7359
 
7321
- //# sourceMappingURL=langsmith-wdF8zG42.js.map
7360
+ //# sourceMappingURL=langsmith-CbVMIRaK.js.map