deepagents 1.6.2 → 1.6.3

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/dist/index.cjs CHANGED
@@ -1438,6 +1438,41 @@ function createPatchToolCallsMiddleware() {
1438
1438
  });
1439
1439
  }
1440
1440
 
1441
+ //#endregion
1442
+ //#region src/values.ts
1443
+ /**
1444
+ * Shared state values for use in StateSchema definitions.
1445
+ *
1446
+ * This module provides pre-configured ReducedValue instances that can be
1447
+ * reused across different state schemas, similar to LangGraph's messagesValue.
1448
+ */
1449
+ /**
1450
+ * Shared ReducedValue for file data state management.
1451
+ *
1452
+ * This provides a reusable pattern for managing file state with automatic
1453
+ * merging of concurrent updates from parallel subagents. Files can be updated
1454
+ * or deleted (using null values) and the reducer handles the merge logic.
1455
+ *
1456
+ * Similar to LangGraph's messagesValue, this encapsulates the common pattern
1457
+ * of managing files in agent state so you don't have to manually configure
1458
+ * the ReducedValue each time.
1459
+ *
1460
+ * @example
1461
+ * ```typescript
1462
+ * import { filesValue } from "@anthropic/deepagents";
1463
+ * import { StateSchema } from "@langchain/langgraph";
1464
+ *
1465
+ * const MyStateSchema = new StateSchema({
1466
+ * files: filesValue,
1467
+ * // ... other state fields
1468
+ * });
1469
+ * ```
1470
+ */
1471
+ const filesValue = new _langchain_langgraph.ReducedValue(zod.z.record(zod.z.string(), FileDataSchema).default(() => ({})), {
1472
+ inputSchema: zod.z.record(zod.z.string(), FileDataSchema.nullable()).optional(),
1473
+ reducer: fileDataReducer
1474
+ });
1475
+
1441
1476
  //#endregion
1442
1477
  //#region src/middleware/memory.ts
1443
1478
  /**
@@ -1494,10 +1529,7 @@ function createPatchToolCallsMiddleware() {
1494
1529
  */
1495
1530
  const MemoryStateSchema = new _langchain_langgraph.StateSchema({
1496
1531
  memoryContents: zod.z.record(zod.z.string(), zod.z.string()).optional(),
1497
- files: new _langchain_langgraph.ReducedValue(zod.z.record(zod.z.string(), FileDataSchema).default(() => ({})), {
1498
- inputSchema: zod.z.record(zod.z.string(), FileDataSchema.nullable()).optional(),
1499
- reducer: fileDataReducer
1500
- })
1532
+ files: filesValue
1501
1533
  });
1502
1534
  /**
1503
1535
  * Default system prompt template for memory.
@@ -1642,12 +1674,10 @@ function createMemoryMiddleware(options) {
1642
1674
  },
1643
1675
  wrapModelCall(request, handler) {
1644
1676
  const formattedContents = formatMemoryContents(request.state?.memoryContents || {}, sources);
1645
- const memorySection = MEMORY_SYSTEM_PROMPT.replace("{memory_contents}", formattedContents);
1646
- const currentSystemPrompt = request.systemPrompt || "";
1647
- const newSystemPrompt = currentSystemPrompt ? `${memorySection}\n\n${currentSystemPrompt}` : memorySection;
1677
+ const newSystemMessage = new langchain.SystemMessage(MEMORY_SYSTEM_PROMPT.replace("{memory_contents}", formattedContents)).concat(request.systemMessage);
1648
1678
  return handler({
1649
1679
  ...request,
1650
- systemPrompt: newSystemPrompt
1680
+ systemMessage: newSystemMessage
1651
1681
  });
1652
1682
  }
1653
1683
  });
@@ -1735,10 +1765,7 @@ const SkillsStateSchema = new _langchain_langgraph.StateSchema({
1735
1765
  inputSchema: zod.z.array(SkillMetadataEntrySchema).optional(),
1736
1766
  reducer: skillsMetadataReducer
1737
1767
  }),
1738
- files: new _langchain_langgraph.ReducedValue(zod.z.record(zod.z.string(), FileDataSchema).default(() => ({})), {
1739
- inputSchema: zod.z.record(zod.z.string(), FileDataSchema.nullable()).optional(),
1740
- reducer: fileDataReducer
1741
- })
1768
+ files: filesValue
1742
1769
  });
1743
1770
  /**
1744
1771
  * Skills System Documentation prompt template.
@@ -3621,7 +3648,7 @@ function createDeepAgent(params = {}) {
3621
3648
  checkpointer,
3622
3649
  store,
3623
3650
  name
3624
- });
3651
+ }).withConfig({ recursionLimit: 1e4 });
3625
3652
  }
3626
3653
 
3627
3654
  //#endregion
@@ -4185,6 +4212,7 @@ exports.createPatchToolCallsMiddleware = createPatchToolCallsMiddleware;
4185
4212
  exports.createSettings = createSettings;
4186
4213
  exports.createSkillsMiddleware = createSkillsMiddleware;
4187
4214
  exports.createSubAgentMiddleware = createSubAgentMiddleware;
4215
+ exports.filesValue = filesValue;
4188
4216
  exports.findProjectRoot = findProjectRoot;
4189
4217
  exports.isSandboxBackend = isSandboxBackend;
4190
4218
  exports.listSkills = listSkills;